Bug 265593

Summary: konqueror autosave spins up disk even when idle
Product: [Applications] konqueror Reporter: Vincent de Phily <moltonel>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: andreas_nordal_4, gaaf
Priority: NOR    
Version: 4.6.0   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 4.10.5
Sentry Crash Report:

Description Vincent de Phily 2011-02-06 12:16:23 UTC
Version:           4.6.0 (using KDE 4.6.0) 
OS:                Linux

Even on a blank page, konqueror will spin up the disk regularly to read a write a bit of data. Looking at it via strace, it seems to be caused by the autosave feature.

Reproducible: Always

Steps to Reproduce:
* Start konqueror in a blank page
* watch disk activity in ksysguard
* strace -p <konq_pid>

Actual Results:  
read(7, 0x12660acc24, 4096)             = -1 EAGAIN (Resource temporarily unavailable)
unlink("/home/work/.kde4/share/apps/konqueror/autosave/_1.51") = 0
stat("/home/work/.kde4/share/config/", {st_mode=S_IFDIR|0700, st_size=12288, ...}) = 0
access("/etc/kde4rc", R_OK)             = -1 ENOENT (No such file or directory)
lstat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/work", {st_mode=S_IFDIR|0755, st_size=626688, ...}) = 0
lstat("/home/work/.kde4", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror/autosave", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x3d9dac4e2a0) = -1 ENOENT (No such file or directory)
stat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x126707f5c8) = -1 ENOENT (No such file or directory)
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x3d9dac4f090) = -1 ENOENT (No such file or directory)
stat("/etc/localtime", {st_mode=S_IFREG|0644, st_size=2945, ...}) = 0
access("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", W_OK) = -1 ENOENT (No such file or directory)
access("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", F_OK) = -1 ENOENT (No such file or directory)
access("/home/work/.kde4/share/apps/konqueror/autosave", W_OK) = 0
stat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x1267d41708) = -1 ENOENT (No such file or directory)
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x3d9dac4ed80) = -1 ENOENT (No such file or directory)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"\24\0\6\0\24\0\340\3E\1\0\0E\1\0\0\0\0\0\0\1\0\0\0", 24}, {NULL, 0}, {"", 0}], 3) = 24
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "\1 \253\v\1\0\0\0E\1\0\0\4\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 36
read(7, 0x12660acc24, 4096)             = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x12660acc24, 4096)             = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=7, events=POLLIN|POLLOUT}], 1, -1) = 1 ([{fd=7, revents=POLLOUT}])
writev(7, [{"\24\0\6\0\24\0\340\3g\1\0\0\4\0\0\0\0\0\0\0\0\10\0\0", 24}, {NULL, 0}, {"", 0}], 3) = 24
poll([{fd=7, events=POLLIN}], 1, -1)    = 1 ([{fd=7, revents=POLLIN}])
read(7, "\1 \254\v\1\0\0\0\4\0\0\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 4096) = 36
read(7, 0x12660acc24, 4096)             = -1 EAGAIN (Resource temporarily unavailable)
read(7, 0x12660acc24, 4096)             = -1 EAGAIN (Resource temporarily unavailable)
stat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
stat("/home/work", {st_mode=S_IFDIR|0755, st_size=626688, ...}) = 0
stat("/home/work/.kde4", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/home/work/.kde4/share", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/home/work/.kde4/share/apps", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/home/work/.kde4/share/apps/konqueror", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/home/work/.kde4/share/apps/konqueror/autosave", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock", 0x3d9dac4f160) = -1 ENOENT (No such file or directory)
stat("/tmp/kde-work/", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
stat("/home/work/.kde4/share/apps/konqueror/autosave", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
open("/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock.th6001", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 10
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
fchmod(10, 0644)                        = 0
uname({sys="Linux", node="moltowork", ...}) = 0
fstat(10, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0
write(10, "6001\n", 5)                  = 5
write(10, "konqueror\n", 10)            = 10
write(10, "moltowork\n", 10)            = 10
link("/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock.th6001", "/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock") = 0
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock.th6001", {st_mode=S_IFREG|0644, st_size=25, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock", {st_mode=S_IFREG|0644, st_size=25, ...}) = 0
lseek(10, 0, SEEK_SET)                  = 0
close(10)                               = 0
unlink("/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock.th6001") = 0
stat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x12670a8a58) = -1 ENOENT (No such file or directory)
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x3d9dac4ebd0) = -1 ENOENT (No such file or directory)
stat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x1266f88188) = -1 ENOENT (No such file or directory)
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x3d9dac4efa0) = -1 ENOENT (No such file or directory)
lstat("/home", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat("/home/work", {st_mode=S_IFDIR|0755, st_size=626688, ...}) = 0
lstat("/home/work/.kde4", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror/autosave", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x3d9dac4df80) = -1 ENOENT (No such file or directory)
access("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", W_OK) = -1 ENOENT (No such file or directory)
access("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", F_OK) = -1 ENOENT (No such file or directory)
access("/home/work/.kde4/share/apps/konqueror/autosave", W_OK) = 0
stat("/home/work/.kde4/share/apps/konqueror/autosave", {st_mode=S_IFDIR|0700, st_size=4096, ...}) = 0
open("/home/work/.kde4/share/apps/konqueror/autosave/_1.51XQ6001.new", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 10
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
stat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x1266cc55e8) = -1 ENOENT (No such file or directory)
lstat("/home/work/.kde4/share/apps/konqueror/autosave/_1.51", 0x3d9dac4ee80) = -1 ENOENT (No such file or directory)
fchmod(10, 0644)                        = 0
open("/home/work/.kde4/share/apps/konqueror/autosave/_1.51XQ6001.new", O_RDWR|O_CREAT|O_CLOEXEC, 0666) = 11
fcntl(11, F_SETFD, FD_CLOEXEC)          = 0
lseek(10, 0, SEEK_SET)                  = 0
close(10)                               = 0
fchmod(11, 0600)                        = 0
fstat(11, {st_mode=S_IFREG|0600, st_size=0, ...}) = 0
write(11, "[General]\nNumber of Windows=1\n\n["..., 16364) = 16364
write(11, "file:///usr/share/doc/erlang-13."..., 15539) = 15539
write(11, "\\x00\\x00\\x00.http://code.google."..., 6930) = 6930
fstat(11, {st_mode=S_IFREG|0600, st_size=38833, ...}) = 0
close(11)                               = 0
rename("/home/work/.kde4/share/apps/konqueror/autosave/_1.51XQ6001.new", "/home/work/.kde4/share/apps/konqueror/autosave/_1.51") = 0
unlink("/home/work/.kde4/share/apps/konqueror/autosave/_1.51.lock") = 0
stat("/home/work/.kde4/share/apps/konqueror/autosave/owned_by_1.51", 0x12670a8a58) = -1 ENOENT (No such file or directory)
lstat("/home/work/.kde4/share/apps/konqueror/autosave/owned_by_1.51", 0x3d9dac4f390) = -1 ENOENT (No such file or directory)
read(7, 0x12660acc24, 4096)             = -1 EAGAIN (Resource temporarily unavailable)
poll([{fd=3, events=POLLIN}, {fd=8, events=POLLIN}, {fd=9, events=POLLIN}, {fd=7, events=POLLIN}], 4, 9999


(repeated at short and regular intervals)

Expected Results:  
* No autosave activity (and therefore no disk spinup) unless I have actually done something (opening a new tab, a website, changing some layout...) in the browser since the last autosave.
* When an autosave does occur, perhaps make it more efficient ? A lot of those syscalls seem redundant (I may be wrong on that one).
Comment 1 Alex Hermann 2011-10-01 09:20:23 UTC
This is killing to SSD's. Every konqueror instance will write to the autosave directory every second, even when nothing has changed in the browser.

These writes should be skipped if nothing has changed and should be directed to the tmp (or cache if it must be semi-persistent) directory.
Comment 2 Vincent de Phily 2011-10-03 19:20:04 UTC
Agreed that those writes wear SSDs pointlessly (although you need much more than that to kill them). But for the record, I was more concerned about battery usage (obviously ?) and general system responsiveness (I have a slow HD and my workload is sensitive to IO latency).
Comment 3 Andreas Nordal 2012-11-25 14:29:38 UTC
I'm seeing an average 1770 B/s of disk writes caused by Konqueror 4.8.5 on OpenSuse 12.2.
Comment 4 Tommi Tervo 2013-06-17 17:50:25 UTC
There is a patch on the reviewboard which should reduce pointless disk activity:

https://git.reviewboard.kde.org/r/111048/
Comment 5 Christoph Feck 2013-06-24 09:43:30 UTC
Fixed by Dawit Alemayehu.

http://commits.kde.org/kde-baseapps/96deec69aeba370311236d3ecb7918b68fb77c2c