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 331876 - Hang while trying to load large library
Hang while trying to load large library
Status: RESOLVED OBSOLETE
Product: rhythmbox
Classification: Other
Component: general
HEAD
Other All
: Normal critical
: ---
Assigned To: RhythmBox Maintainers
RhythmBox Maintainers
: 352494 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2006-02-20 09:47 UTC by Alex Lancaster
Modified: 2018-05-24 11:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Screenshot rhythmbox & top (141.13 KB, image/png)
2006-03-20 08:56 UTC, Giò
Details

Description Alex Lancaster 2006-02-20 09:47:53 UTC
Please describe the problem:
When I try and load a large library of music (~80 GB) that has previously loaded
(so metadata tags and the rhythmdb.xml is already created), I get a hang.   

The application doesn't crash, but it just spins:



Steps to reproduce:
1. gdb shell/rhythmbox
2. (gdb) run -d > ~/rb.log 2>&1
3. Ctrl-C when application hangs


Actual results:
In step 1, interface comes up, lists in browser and songs start being populated,
and status displays "Loading...", then it hangs, just after reaching (what I
remember seems to be full count of songs).

In step 2, looking at the rb.log, the last entry in the log is different from
run to run, here's one:
[0x9fdf130] [rhythmdb_process_events] rhythmdb.c:1664 (01:44:25): processing
RHYTHMDB_EVENT_STAT
[0x9fdf130] [rhythmdb_process_stat_event] rhythmdb.c:1454 (01:44:25): not
modified:
file:///mnt/data/iTunes/Everything%20But%20The%20Girl/Missing/03%20Missing%20(Rockin'%20Blue%20Mix).mp3

In step 3:, here's the backtrace:

Program received signal SIGINT, Interrupt.

Thread NaN (LWP 26665)

  • #0 __kernel_vsyscall
  • #1 __write_nocancel
    from /lib/libpthread.so.0
  • #2 ??
    from /usr/lib/libfam.so.0
  • #3 ??
    from /usr/lib/libfam.so.0
  • #4 FAMMonitorDirectory
    from /usr/lib/libfam.so.0
  • #5 ??
    from /usr/lib/gnome-vfs-2.0/modules/libfile.so
  • #6 _gnome_vfs_monitor_do_add
    from /usr/lib/libgnomevfs-2.so.0
  • #7 gnome_vfs_monitor_add
    from /usr/lib/libgnomevfs-2.so.0
  • #8 rhythmdb_monitor_uri_path
    at rhythmdb.c line 1164
  • #9 rhythmdb_process_stat_event
    at rhythmdb.c line 1456
  • #10 rhythmdb_idle_poll_events
    at rhythmdb.c line 1665
  • #11 g_child_watch_add
    from /usr/lib/libglib-2.0.so.0
  • #12 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #13 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #14 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #15 bonobo_main
    from /usr/lib/libbonobo-2.so.0
  • #16 main
    at main.c line 407



Expected results:
No hang, application should load.

Does this happen every time?
Yes, with this library with current CVS HEAD.  Previous versions have loaded
successfully, but I have had problems like this in the past, intermittently, but
a while ago now, so I thought they were fixed.

Other information:
Comment 1 Alex Lancaster 2006-02-20 09:49:28 UTC
Here is what the process looks like:

$ ps aux|grep rhythmbox
alex     26664  1.6  4.2  48508 44208 pts/18   S+   01:43   0:04 gdb ./shell/rhythmbox
alex     26665  8.8  3.6  87004 38224 pts/18   Tl   01:43   0:26 /home/alex/src/remote-cvs/gnome.org/rhythmbox/shell/rhythmbox -d
Comment 2 Alex Lancaster 2006-02-20 10:03:20 UTC
I could also successfully load the track that the library was hanging on before, when starting up with a clean rhythmdb.xml:

<?xml version="1.0" standalone="yes"?>
<rhythmdb version="1.1">  <entry type="song">
    <title>Missing (Rockin' Blue Mix)</title>
    <genre>Rock</genre>
    <artist>Everything But the Girl</artist>
    <album>Missing</album>
    <track-number>3</track-number>
    <duration>469</duration>
    <file-size>9383792</file-size>
    <location>file:///mnt/data/iTunes/Everything%20But%20The%20Girl/Missing/03%20Missing%20(Rockin'%20Blue%20Mix).mp3</location>
    <mountpoint>file:///mnt/data</mountpoint>
    <mtime>1072612244</mtime>
    <first-seen>1140429665</first-seen>
    <last-seen>1140429665</last-seen>
    <rating>1.000000</rating>
    <date>728294</date>
    <mimetype>application/x-id3</mimetype>
  </entry>
</rhythmdb>

Also, the problem also occurs when loading up a fresh library, and re-importing the songs.
Comment 3 James "Doc" Livingston 2006-02-20 10:07:48 UTC
We should probably add the vfs monitors asynchronously (or in another thread if there are no async versions). Jonathan has mentioned before that adding the monitors all at once can cause gnome-vfs to block for a long time.
Comment 4 Alex Lancaster 2006-02-20 11:47:00 UTC
(In reply to comment #3)
> Jonathan has mentioned before that adding the monitors all at once can cause 
> gnome-vfs to block for a long time.

Is that bug #325215?
Comment 5 Jonathan Matthew 2006-02-20 20:41:48 UTC
I have actually seen it deadlock a couple of times.  It's a problem with the communication between gnome-vfs and gamin, and I vaguely recall deciding that it can't be fixed without changing the FAM API.  Since gnome-vfs 2.13.x can apparently use inotify directly, the problem should go away (for linux users, anyway) by itself.

If you strace the rhythmbox and gam_server processes once the deadlock has occurred, you should see them both in a blocking write to the socket connecting them.  Since neither side has a timeout on the write, they'll just sit there until one side is killed.
Comment 6 Alex Lancaster 2006-02-21 10:23:09 UTC
(In reply to comment #5)
> I have actually seen it deadlock a couple of times.  It's a problem with the
> communication between gnome-vfs and gamin, and I vaguely recall deciding that
> it can't be fixed without changing the FAM API.  Since gnome-vfs 2.13.x can
> apparently use inotify directly, the problem should go away (for linux users,
> anyway) by itself.

Is there no workaround for gnome-vfs < 2.13.x that we can implement?
Comment 7 James "Doc" Livingston 2006-02-21 10:42:18 UTC
As well as gnome-vfs < 2.13, it's also needed for non-linux systems, and situations when FAM gets used anyway (e.g. over NFS).

A solution would be to add an async queue for monitor additions, and have a thread processing that which limits the rate (e.g. sleeping for a short time, or whatever).
Comment 8 Alex Lancaster 2006-02-23 03:06:25 UTC
(In reply to comment #5)

> If you strace the rhythmbox and gam_server processes once the deadlock has
> occurred, you should see them both in a blocking write to the socket connecting
> them.  Since neither side has a timeout on the write, they'll just sit there
> until one side is killed.

Yep, bingo, tracing gam_server:

$ gdb --pid 8645()
[...]
(gdb) bt
  • #0 ??
  • #1 __write_nocancel
    from /lib/libc.so.6
  • #2 ??
  • #3 ??
  • #4 ??
  • #5 ??
  • #6 ??
  • #7 g_list_free
  • #8 ??
  • #9 ??
  • #0 ??
  • #1 __write_nocancel
    from /lib/libpthread.so.0
  • #2 ??
    from /usr/lib/libfam.so.0
  • #3 ??
    from /usr/lib/libfam.so.0
  • #4 FAMMonitorDirectory
    from /usr/lib/libfam.so.0
  • #5 ??
    from /usr/lib/gnome-vfs-2.0/modules/libfile.so
  • #6 _gnome_vfs_monitor_do_add
    from /usr/lib/libgnomevfs-2.so.0
  • #7 gnome_vfs_monitor_add
    from /usr/lib/libgnomevfs-2.so.0
  • #8 rhythmdb_monitor_uri_path
    at rhythmdb.c line 1153
  • #9 monitor_entry_file
    at rhythmdb.c line 4132
  • #10 rhythmdb_tree_entry_foreach_func
    at rhythmdb-tree.c line 1926
  • #11 g_hash_table_foreach
    from /usr/lib/libglib-2.0.so.0
  • #12 rhythmdb_tree_entry_foreach
    at rhythmdb-tree.c line 1937
  • #13 rhythmdb_entry_foreach
    at rhythmdb.c line 3324
  • #14 rhythmdb_sync_library_location
    at rhythmdb.c line 4173
  • #15 rhythmdb_sync_library_idle
    at rhythmdb.c line 2131
  • #16 g_main_context_wakeup
    from /usr/lib/libglib-2.0.so.0
  • #17 g_main_context_dispatch
    from /usr/lib/libglib-2.0.so.0
  • #18 g_main_context_check
    from /usr/lib/libglib-2.0.so.0
  • #19 g_main_loop_run
    from /usr/lib/libglib-2.0.so.0
  • #20 bonobo_main
    from /usr/lib/libbonobo-2.so.0

Both hang with the _write_nocancel.

OK, so what to do?
Comment 9 Giò 2006-03-20 02:08:23 UTC
I have the same problem with gam-server (gamin) and rhythmbox.

The problem arose today after I decided to copy all my Music partition on another hard disk that would substitute the previous (external) hd. So, rhythmbox couldn't "see" the difference (they were both known as /dev/sda1). Anyway, rhythmbox has re-scanned the music folder (of about 90 gigas) but at the end of the process the cpu usage still is at 100% of its capacity. That is due to gam-server as I can see tabbing "$ top" by shell. Another thing is that after the first run and quit I can't run rhythmbox until next reboot, even by "$ shell" (but I can do it with root privilege).

I use Rhythmbox 0.9.3.1 on my Debian Sid. What can I do?

thnx,
giopas
Comment 10 Giò 2006-03-20 08:56:52 UTC
Created attachment 61596 [details]
Screenshot rhythmbox & top

here a screenshot of rhythmbox and top after a complete loading. As you can see, there is a "gam-server" process that occupies a huge amount of resources, even if there is no file to load anymore.
Comment 11 James "Doc" Livingston 2006-03-27 07:28:59 UTC
Slowing down the addition of directory monitors should be fairly simple to do. The question is how fast can we safely add them?
Comment 12 André Klapper 2006-08-25 11:53:54 UTC
this is critical, but this isn't a blocker by definition.
any news on this?
Comment 13 Jonathan Matthew 2006-10-08 03:54:36 UTC
*** Bug 352494 has been marked as a duplicate of this bug. ***
Comment 14 Andrew Conkling 2006-10-10 00:31:48 UTC
Is there some hidden yet incredibly useful way to automatically refresh the library?  0.9.6 is faster on restarting, but I hate to do that every time I want to see something I updated in the library.
Comment 15 Andrew Conkling 2006-10-10 00:33:31 UTC
(In reply to comment #14)
> Is there some hidden yet incredibly useful way to automatically refresh the
> library?  0.9.6 is faster on restarting, but I hate to do that every time I
> want to see something I updated in the library.

Erm... obviously I meant "manually refresh the library", not "automatically".
Comment 16 Jean-François Fortin Tam 2006-10-10 02:15:27 UTC
Doesn't rhythmbox use gnomeVFS? If that's the case, wouldn't it be supposed to automatically detect changes almost immediately (as far as I know, it is what it does already).

However, I believe having an option to manually refresh would be a great performance gain in the way that I would not have that library check run needlessly on startup.
Comment 17 Alex Lancaster 2006-10-10 03:39:40 UTC
(In reply to comment #15)

> Erm... obviously I meant "manually refresh the library", not "automatically".

If you know which directory changed, you could just reimport the directory.    (It's a kludgy workaround, but that's what I do if I want to update tags that I've changed in another program and I've switched off library watch).

Comment 18 Alex Lancaster 2006-10-10 03:42:25 UTC
(In reply to comment #16)
> Doesn't rhythmbox use gnomeVFS? If that's the case, wouldn't it be supposed to
> automatically detect changes almost immediately (as far as I know, it is what
> it does already).

Yes, it does if you have library "watch" enabled.  The problem, as I understand it, is that if you are using a gnomevfs source that doesn't support inotify (such as an NFS share) then adding it locks up adding directories to the gam server.

> However, I believe having an option to manually refresh would be a great
> performance gain in the way that I would not have that library check run
> needlessly on startup.

If the file system supports inotify directly (such as the local harddisk) then the check goes relatively fast.

Comment 19 Jean-François Fortin Tam 2006-10-10 14:12:20 UTC
I assume "relatively fast" is a keyphrase here :) because scanning my 8000 songs library necessitates 1 minute 20 seconds for the startup of rhythmbox (about 20-30 seconds without it, if I recall correctly), running 0.9.6 on my local reiserfs partition. It is "relatively" fast, but still really painful for me to wait 1 minute and a half before having a responsive UI.
Comment 20 Alex Lancaster 2006-10-11 10:13:30 UTC
(In reply to comment #19)
> I assume "relatively fast" is a keyphrase here :) because scanning my 8000
> songs library necessitates 1 minute 20 seconds for the startup of rhythmbox
> (about 20-30 seconds without it, if I recall correctly), running 0.9.6 on my
> local reiserfs partition. It is "relatively" fast, but still really painful for
> me to wait 1 minute and a half before having a responsive UI.

I have to admit it was a while ago I checked the start-up with the library watch enabled.  I actually don't use watch at all, but my ~3200 library takes about 3-4 seconds to load completely on an ext3 local partition.

Comment 21 Alex Lancaster 2006-10-11 10:17:45 UTC
(In reply to comment #19)
> I assume "relatively fast" is a keyphrase here :) because scanning my 8000
> songs library necessitates 1 minute 20 seconds for the startup of rhythmbox
> (about 20-30 seconds without it, if I recall correctly)

Bug #360648 comment #6 probably addresses your situation (since your problem isn't a lock-up), Jonathon Matthew suggests that the patch on bug #325215 will probably help.
Comment 22 Jean-François Fortin Tam 2008-02-26 16:35:23 UTC
does gio instead of gnomevfs change anything here?
Comment 23 Jonathan Matthew 2008-08-12 02:29:17 UTC
gio still uses fam when there's nothing better available, so it's probably still susceptible to this problem.
Comment 24 Stephane Gregoire 2010-11-28 09:29:49 UTC
Hi,
Any news on this crash?

I've reported a bug on launchpad : https://bugs.launchpad.net/ubuntu/+source/rhythmbox/+bug/442434 is it the same bug?
Comment 25 Jonathan Matthew 2010-11-28 09:43:40 UTC
I don't know how you decided that your problem resembles this bug.  There is no useful information in your launchpad bug report.
Comment 26 Stephane Gregoire 2010-11-29 06:15:03 UTC
Hi Jonathan,

I think it's an automatic system which when seeing a bug url mark it as bug watch.

I said "I think this bug looks like this one", it only looks like, it was just an hypothesis*.

* I don't found translation of the French word "hypothèse".

Thanks for your work,
Comment 27 André Klapper 2010-11-29 09:30:44 UTC
(In reply to comment #26)
> I think it's an automatic system which when seeing a bug url mark it as bug
> watch.

That is not true, and totally offtopic for this bug report.
Comment 28 GNOME Infrastructure Team 2018-05-24 11:26:25 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/rhythmbox/issues/156.