Bug 284383

Summary: ~/.kde/share/apps/kwebkitpart/autosave/ growing to insane sizes
Product: [Frameworks and Libraries] kwebkitpart Reporter: Olivier Goffart <ogoffart>
Component: generalAssignee: webkit-devel
Status: RESOLVED FIXED    
Severity: normal CC: adawit, faure
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In: 1.3.0
Sentry Crash Report:

Description Olivier Goffart 2011-10-18 16:42:07 UTC
Version:           unspecified (using KDE 4.7.2) 
OS:                Linux

Files in the directory ~/.kde/share/apps/kwebkitpart/autosave/ becomes quite big, and are not removed, taking all the space available on the hardrive. (more than 10Gb)

David suggested http://www.davidfaure.fr/2011/webkitext.diff (untested)
I suggest to store the temporary directory for such files 



Reproducible: Didn't try

Steps to Reproduce:
check your directory ~/.kde/share/apps/kwebkitpart/autosave/


Expected Results:  
it should not be several gigabytes
Comment 1 Dawit Alemayehu 2011-10-19 18:15:10 UTC
(In reply to comment #0)
> Version:           unspecified (using KDE 4.7.2) 
> OS:                Linux
> 
> Files in the directory ~/.kde/share/apps/kwebkitpart/autosave/ becomes quite
> big, and are not removed, taking all the space available on the hardrive. (more
> than 10Gb)

> David suggested http://www.davidfaure.fr/2011/webkitext.diff (untested)
> I suggest to store the temporary directory for such files 


Hmm.. that won't work. The reason why these session files are currently not removed when Konqueror terminates normally is because the file descriptors referencing them in kwebkitpart_ext.cpp was not properly closed after use. The code I wrote incorrectly assumed that the destructor of QBuffer which inherits QIODevice will call close() from its destructor, but it seems that it does not. As such, most of the session files are never removed on proper termination of kwebkitpart. I will fix this shortly.

<side note>
For the record none of this, kwebkitpart saving its own session information, would have been necessary were it not for the fact that Konqueror invokes KPart::BrowserExtension::restoreState only for the very last visited url when it recovers from a crash or restores a previous session. That means, in kwebkitpart, we can never properly restore the history state for any tab other than the one where the last visited url was displayed. Anyhow, you can read http://lists.kde.org/?l=kfm-devel&m=128275102319735&w=2 or commit e2ded37 in kwebkitpart for further details.
</side note>
Comment 2 Dawit Alemayehu 2011-10-19 18:31:27 UTC
Git commit 54e2d3346d2a3409bb41ed442f7b2b4bcbf3fcdc by Dawit Alemayehu.
Committed on 19/10/2011 at 20:19.
Pushed by adawit into branch 'master'.

Properly close all the QIODevice instances after use.

This should fix the issue where unnecessary session files are left lingering
around whenever kwebkitpart terminates normally.

CCBUG:284383

M  +2    -0    src/kwebkitpart_ext.cpp

http://commits.kde.org/kwebkitpart/54e2d3346d2a3409bb41ed442f7b2b4bcbf3fcdc
Comment 3 Dawit Alemayehu 2012-02-06 06:18:12 UTC
Git commit 36e31ddb6552dc8e0f884a47df8f96f83d9f2795 by Dawit Alemayehu.
Committed on 02/02/2012 at 10:10.
Pushed by adawit into branch 'master'.

Do not write QtWebKit's history data to temporary files anymore.

Note that this is yet another attempt at integrating Konqueror's history
navigation with QtWebKit's without causing a regression. This change should
finally put this never ending problem to rest without eating up a user's
disk space.
FIXED-IN: 1.3.0

M  +45   -87   src/kwebkitpart.cpp
M  +3    -3    src/kwebkitpart.h
M  +90   -47   src/kwebkitpart_ext.cpp
M  +3    -4    src/kwebkitpart_ext.h
M  +19   -49   src/kwebkitpartfactory.cpp
M  +6    -6    src/kwebkitpartfactory.h
M  +16   -22   src/webpage.cpp
M  +0    -1    src/webpage.h

http://commits.kde.org/kwebkitpart/36e31ddb6552dc8e0f884a47df8f96f83d9f2795