Bug 236607 - Konqueror cache size is ignored
Summary: Konqueror cache size is ignored
Status: CONFIRMED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: 4.4.3
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-06 21:16 UTC by Alex Hermann
Modified: 2013-07-19 22:06 UTC (History)
7 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch attempt (521 bytes, patch)
2012-11-18 21:46 UTC, Raúl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Hermann 2010-05-06 21:16:44 UTC
Version:           4.4.3 (KDE 4.4.3) (using 4.4.3 (KDE 4.4.3), Debian packages)
Compiler:          cc
OS:                Linux (x86_64) release 2.6.32.9

The "disk cache size" setting is completely ignored. The /var/tmp/kdecache-${USER}/http directory is filled until the disk is full. Even if setting is 0 or 1.
Comment 1 Vsevolod Krishchenko 2010-07-12 11:50:56 UTC
I see the same behaviour in all 4.* versions (Kubuntu).
My cache size is 50000 (KiB), but I just deleted 4Gb /var/tmp/kdecache-${USER}/http cache.
Comment 2 Rosetzky Cedric 2010-09-08 23:03:23 UTC
Same here, and this can provoke crashes when the partition is full, especially when /var/tmp is in the root partition.
Comment 3 Martin Koller 2011-06-11 17:09:06 UTC
I can reproduce this with 4.6.3
Comment 4 Dawit Alemayehu 2012-01-09 20:46:23 UTC
See comment #3.
Comment 5 Martin Koller 2012-01-09 21:21:52 UTC
Was the closure intended ? My comment #3 says that I still can reproduce it....
Puzzled...
Comment 6 Rosetzky Cedric 2012-01-09 21:27:19 UTC
Read slower, he said CAN not CAN'T ;). 
I don't know if it's fixed or not though, since my /var/tmp folder is now liked to my /tmp partition, avoiding my root patition to be full and make linux crash.
Comment 7 Dawit Alemayehu 2012-01-10 00:26:25 UTC
Still... I cannot reproduce this. This problem should only occur if kio_http_cache_cleaner never runs to reclaim the expired or old cached document. Do you see a kio_http_cache_cleaner process running on your system ? If not and you have caching enabled, then that is the problem. 

Otherwise, can one of you enable debug area 7113 and look for messages that prints out "total size of cache files after cleaning is..." ? Compare the size printed out there with the one that is set in the cache settings dialog.
Comment 8 Martin Koller 2012-01-14 16:57:36 UTC
I retested now with 4.8RC2.
I have no idea how often the cache cleaner does its work - maybe this is the problem. I see that it reduces the cache when I login into KDE, but it does not reduce the cache when I simply reduce the cache size, e.g. from 1000 KB to 100 KB. Does it do its job when I never logout ?
Maybe one needs to know when this should happen. Can you explain ?
Comment 9 Raúl 2012-11-16 20:03:17 UTC
I'm running into the same problem. This is the second time I've noticed since I'm following this bug when I noticed the http cache dir had growed a lot till it consumed all my partition free space.
I checked that the kio_http_cache_cleaner process was running, I then reset the maximum cache with a different value and pressed "Clean cache" button in the konqueror settings->web browsing->cache. I noticed the cache was actually cleaned after a long while. It looked all files in the cache were being analized. After that the cache was cleaned and after some browsing it reached the top I had set before and it was keeped there, as expected.
Some time later, after some long konqueror sessions (I use hibernate, hence I reboot seldom) and some reboots I've just noticed the current http cache dir is about 662MB. My current maximum cache size is set to 51200KiB
May anyone provide some guidance on how to get useful information when I've reached this point?
Regards,
Comment 10 Raúl 2012-11-18 21:46:36 UTC
Created attachment 75347 [details]
Patch attempt

I think the problem is that cleaner object is never created since (newBytesCounter > g_maxCacheSize) comparison is most of times wrong since newBytesCounter type (int) is not enough to compare with g_maxCacheSize which is qint64.
Find attached a patch that fixes newBytesCounter and trigger cleaner object properly. It worked for me after killing http_cache_cleaner and running the fixed version. This is something that wasn't working before.
HTH,
Comment 11 Dawit Alemayehu 2012-11-20 21:41:56 UTC
(In reply to comment #10)
> Created attachment 75347 [details]
> Patch attempt
> 
> I think the problem is that cleaner object is never created since
> (newBytesCounter > g_maxCacheSize) comparison is most of times wrong since
> newBytesCounter type (int) is not enough to compare with g_maxCacheSize
> which is qint64.
> Find attached a patch that fixes newBytesCounter and trigger cleaner object
> properly. It worked for me after killing http_cache_cleaner and running the
> fixed version. This is something that wasn't working before.
> HTH,

The patch looks fine to me. Are you able to commit it or do you need someone to do it for you ?
Comment 12 Raúl 2012-11-20 22:04:59 UTC
Thanks for reviewing Dawit. I have no git access and therefore I'd appreciate someone to commit it. If someone else is willing to try it, it'd be also great that the patch would be backported. Hint: Debian Wheezy will release with KDE 4.8.4 ;)
Comment 13 Dawit Alemayehu 2012-11-29 12:04:51 UTC
Git commit f23c23d9645513305e32758357211ff17c395f0b by Dawit Alemayehu.
Committed on 21/11/2012 at 07:22.
Pushed by adawit into branch 'KDE/4.10'.

Prevent integer overflow that could potentiall cause Konqueror to ignore cache
size limit under certain circumstances.

Though this fix is necessary to address use of incorrectly sized integer
variable, I am not entirely sure it is 'the' fix for bug# 236607.

Original patch provided by Raul.

M  +4    -4    kioslave/http/http_cache_cleaner.cpp

http://commits.kde.org/kdelibs/f23c23d9645513305e32758357211ff17c395f0b
Comment 14 Michael Reiher 2013-07-19 22:06:03 UTC
Seems not fixed yet. Running KDE 4.10.4 here and had >800 MB in the cache dir, even though configuration is set to 50 MB. 

Manually cleaning the entire cache (/usr/lib/kde4/libexec/kio_http_cache_cleaner --clear-all) worked, though.