After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 673550 - "free space: unknown" and CPU spins instead
"free space: unknown" and CPU spins instead
Status: RESOLVED FIXED
Product: nautilus
Classification: Core
Component: File Properties Dialog
0.x.x [obsolete]
Other All
: Normal major
: ---
Assigned To: Nautilus Maintainers
Nautilus Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-04-05 05:38 UTC by Allison Karlitskaya (desrt)
Modified: 2012-04-05 16:00 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
NautilusFile: keep free space information directly (6.35 KB, patch)
2012-04-05 14:55 UTC, Allison Karlitskaya (desrt)
committed Details | Review

Description Allison Karlitskaya (desrt) 2012-04-05 05:38:19 UTC
Opening the properties dialog on a directory in nautilus gives

  Free space: unknown

Meanwhile, the CPU is spinning in a loop due to the dialog calling nautilus_file_get_volume_free_space() which performs an async call which causes a change signal to be emitted which causes the dialog to try to update the value again...

This has been broken since 2009.  This seemingly-innocent commit introduced the problem:

  http://git.gnome.org/browse/nautilus/commit/?id=2d61fcdf4987802441b7d9dab5364a28fb2dbd7c

That commit looks like a legitimate fix, but it seems that leaking the directory was good because it caused the value to be cached and therefore not continuously refetched...

This code probably needs a bit of a rethink.
Comment 1 Allison Karlitskaya (desrt) 2012-04-05 14:55:50 UTC
Created attachment 211392 [details] [review]
NautilusFile: keep free space information directly

There were previously some tricks in nautilus to this effect:

 - when you call nautilus_file_get_volume_free_space() on a
   NautilusFile, the return result is NULL at first and later you get a
   "changed" signal on the file after the value is filled in

 - the value is being stored inside the NautilusDirectory equivalent for
   the file that is created when the call is first performed and kept
   around until after the change signal fires (so that the person
   receiving the change signal can still get the data).  This is done to
   save space by not expanding NautilusFile.

   The NautilusDirectory is then unreffed after the change signal is
   done firing.

 - the nautilus properties window has a 200ms timeout after changes to
   files being reported before it re-queries the properties

The end result is that the NautilusDirectory (which holds the
information about the free space) is already freed by the time the
properties window tries to update the free space display.  This results
in the directory being recreated and the process starting over again.
The end result is that we never get the free space shown in the dialog
and instead we have an infinite loop of CPU usage (fortunately repeating
only every 200ms, so you get ~5% CPU usage instead of 100%).

We can solve the problem by just storing the free space information
directly in the NautilusFile details structure and dropping the dance
with NautilusDirectory; nothing in NautilusDirectory is actually using
that information anyway.
Comment 2 Alexander Larsson 2012-04-05 15:42:50 UTC
Review of attachment 211392 [details] [review]:

Looks good to me.
Comment 3 Allison Karlitskaya (desrt) 2012-04-05 16:00:27 UTC
Attachment 211392 [details] pushed as ba04ec0 - NautilusFile: keep free space information directly