-
-
Notifications
You must be signed in to change notification settings - Fork 126
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NullPointerException when reading cache file #6
Comments
Hm... the tree view requesting child #23 when there are only 0..22 is kind of weird. After all, the DirTreeModel told him in rowCount() how many children there are. One thing I could imagine is that there are no plain files on that directory level, only subdirectories. In that case, in a final step (finalizeLocal()) the parent directory cleans up the unused "Files" item (the "dot entry"), which means that from that point on there is one less child on that level - that dot entry was deleted. Does that sound likely in your scenario? Only subdirectories on that directory level, no files? |
No, the top directory has both subdirectories and files in it. But the last entry in the cache file is a directory without files. I'll try playing with the cache file to see if I can narrow down the reason or anonymize and send it as soon as I have time. |
I have the same problem here (qdirstat crashes with NullPointerException from QDirStat::DirTreeModel::index(), and logs message like In my case, the cache file can be read with k4dirstat, but at closer look it is actually displayed incorrectly in k4dirstat - there are lots of top-level directories missing, and total data size is way off. That bug is actually the reason why I've looked at qdirstat at all :-) The cache file was created with Btw. the cache file contains pathes with double slashes, like this: |
Hm - maybe the double slashes really have something to do with this. It's a remote possibility, but it's a hint. I'll try to reproduce the problem with this scenario. If it's just a double-slash problem, it should be easy enough to fix. |
Looks like I found a way to reproduce this, albeit not with a double slash ("//") path: 2016-02-01 14:26:17.773 [12441] DirTreeModel.cpp:180 findChild(): Child #2 is out of range: 0..1 children for /space/shundhammer Do you guys also have a lot of "could not locate parent" messages in the log? 2016-02-01 14:26:17.760 [12441] DirTreeCache.cpp:404 addItem(): /tmp/qdirstat.cache.gz:118556: Could not locate parent /space/shundhammer/obs/YaST:Head |
Great to hear that you could repro such a crash! However, there are no
I created this log by starting Edit: Btw. what did you do to get the crash? |
I used a really large cache file - large enough for the tree widget to try to display something while cache reading was still in progress. |
Please test again with the latest version which includes 5354e0b This should fix the problem. Background: While directories are being read, only finished directories are reported to the tree view by the data model so the view doesn't get confused by partially read directories. Otherwise the model would have to keep track what parts of the directory tree it already reported to which view (there might be any number of views connected to it) and report delta information (what's new) individually. Whenever a view requests information from the model, the model returns "0 items on this level" while a directory is being read, i.e. it has read state DirReading. With cache files, that status used to be set to "DirCached" immediately, yet it could happen just as well that a directory was only partially read - albeit much less frequently because the chunks in which cache files are read are pretty large, and today's hardware is really fast at simple text processing. Now, the read status remains at DirQueued for all those cached directories until the very last moment: In the destructor of the CacheReader all directories in the cache are "finalized" at the same time, i.e. their read state is set to DirCached and empty or unneded "" items ("dot entries") are removed. Thus, there is no more time gap during which the data model releases premature information to the view(s); it's all from zero to complete in an instant. |
chrti, oliver, please test with this fix at your earliest convenience and write a note here if this really fixes the problem. I sure hope so. ;-) |
Your fix works for me - qdirstat no longer crashes! Thanks a lot for the quick response! The directory list read from cache file is still displayed incompletely (as it was in kdirstat), but I'll open a separate ticket for that. |
During debugging this, I found that there seems to be a problem with directories that have a colon ":" in their name. I suspect some URL escape or unescape function might be a problem here. With a little bit of luck, I can find some time today or in the next few days to address this. BTW that seems to be the reason for those "Could not locate parent" errors I mentioned: One of their ancestor directories had a name like "YaST:Head". |
Your fix works for me too - I tried the commit you mentioned and its parent; my cache file crashes the older version, but not the one with the fix. Good job! |
OK, thanks for the feedback! |
When opening a cache file generated with the qdirstat-cache-writer script, qdirstat starts displaying the directory tree and then terminates with a NullPointerException. Backtrace:
The cache file is from a separate machine, so the actual directory structure is not accessible for qdirstat. The same cache file works fine when opened in k4dirstat after changing the header to
[kdirstat 4.0 cache file]
. Unfortunately, I can't share this particular cache file and haven't yet managed to reproduce this error on another file.It might also be interesting that according to the logfile, the last child is
<Files>
:If I can do something more to help investigate this, please let me know.
The text was updated successfully, but these errors were encountered: