GNOME Bugzilla – Bug 332071
eog crash in eog-collection-item.c:310
Last modified: 2006-04-01 00:34:37 UTC
Steps to reproduce: 1. Run eog 2. 3. Stack trace: Intermittent crash. Looks like a probable race condition in threaded code ? home /usr/src/sources/gnome/eog-2.13.91% gdb eog GNU gdb 6.4 Copyright 2005 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) r ~/mozilla.svg Starting program: /usr/bin/eog ~/mozilla.svg [Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 26498)] Instantiate job with id 1. [New Thread 32769 (LWP 26502)] [New Thread 16386 (LWP 26503)] Starting thread with id 0. eog-image_load.c load success: 1 n_images: 22/22 1 /home/mitch/.registry (-1/-1) 2 /home/mitch/GNOME-Matrix2.png (-1/-1) 3 /home/mitch/alert_rt.jpg (-1/-1) 4 /home/mitch/b1.png (-1/-1) 5 /home/mitch/b2.png (-1/-1) 6 /home/mitch/camel.png (-1/-1) 7 /home/mitch/cbl.png (-1/-1) 8 /home/mitch/cbr.png (-1/-1) 9 /home/mitch/chevron.gif (-1/-1) 10 /home/mitch/chevron2.gif (-1/-1) 11 /home/mitch/cmt_flat90hw.gif (-1/-1) 12 /home/mitch/dscf0001.jpg (-1/-1) 13 /home/mitch/dscf0002.jpg (-1/-1) 14 /home/mitch/fax.tiff (-1/-1) 15 /home/mitch/gray.png (-1/-1) 16 /home/mitch/intel.gif (-1/-1) 17 /home/mitch/license.pnm (-1/-1) 18 /home/mitch/linux_logo2_vsmall.gif (-1/-1) 19 /home/mitch/mozilla.svg (59/59) 20 /home/mitch/mydoc.gif (-1/-1) 21 /home/mitch/new.png (-1/-1) 22 /home/mitch/tick_green.gif (-1/-1) EogWindow.c: eog_window_open No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting setting window size: 615/450 Instantiate job with id 2. [New Thread 32771 (LWP 26504)] Instantiate job with id 3. Instantiate job with id 4. Instantiate job with id 5. Instantiate job with id 6. Instantiate job with id 7. Instantiate job with id 8. Instantiate job with id 9. Instantiate job with id 10. Instantiate job with id 11. Instantiate job with id 12. Instantiate job with id 13. Instantiate job with id 14. Instantiate job with id 15. Instantiate job with id 16. Instantiate job with id 17. Instantiate job with id 18. Instantiate job with id 19. Instantiate job with id 20. Instantiate job with id 21. Instantiate job with id 22. Instantiate job with id 23. Show exif data Job 001: disposing ... Job 001: disposing end Starting thread with id 1. Job 002: disposing ... Job 002: disposing end Job 003: disposing ... Job 003: disposing end Job 004: disposing ... Job 004: disposing end Job 005: disposing ... Job 005: disposing end Job 006: disposing ... Job 006: disposing end Job 007: disposing ... Job 007: disposing end Job 008: disposing ... Job 008: disposing end Job 009: disposing ... Job 009: disposing end Job 010: disposing ... Job 010: disposing end Job 011: disposing ... Job 011: disposing end Job 012: disposing ... Job 012: disposing end Job 013: disposing ... Job 013: disposing end Job 014: disposing ... Job 014: disposing end Job 015: disposing ... Job 015: disposing end Job 016: disposing ... Job 016: disposing end Job 017: disposing ... Job 017: disposing end Job 018: disposing ... Job 018: disposing end Job 019: disposing ... Job 019: disposing end Job 020: disposing ... Job 020: disposing end Job 021: disposing ... Job 021: disposing end Job 022: disposing ... Job 022: disposing end Job 023: disposing ... Job 023: disposing end Instantiate job with id 24. Instantiate job with id 25. Instantiate job with id 26. Instantiate job with id 27. Program received signal SIGSEGV, Segmentation fault.
+ Trace 66379
Thread 16386 (LWP 26503)
$1 = (EogCollectionItemPrivate *) 0x0 (gdb) Other information:
Is this bug reproducible on every time you run EOG? Did you try to open different images on different locations? This indeed seems to be a very specifid race condition in threaded code.
I can reproduce it quite easily. Not exactly every second or third run but surely every day. I've just put a check to bounce out of the code if priv is NULL so we don't attempt to dereference it. I guess if we're sure it should be filled in in proper operation, then maybe we should lock the critical section when we set/reset the priv member and the spin on the mutex before we try to dereference the priv structure.
What i can't understand is why, as you can see from above when i start the eog command with *one* file, it stat's my home dir for all possible files and starts 22+ jobs ? I'm requesting to display 1 image !! Also why is this file 1 /home/mitch/.registry (-1/-1) assumed to be a image as part of the 22 candidate image files it finds ?? Or am i reading the verbose output wrong ?
Hi Mitch, these are the threads to load thumbnails of the images from the same directory. This is a known performance bug and will be fixed soon. About the ".registry" being considered as an image, this is probably the cause of this bug. EOG is trying to load a thumbnail from a non-image file. What is the mime-type of this .registry? I still can't reproduce this bug with EOG 2.13.92.
Created attachment 60472 [details] My .registry Hi Lucas, how do i tell what eog thinks is the *mime type* of my .registry file. the file(1) command thinks it's a PCX image !! though 'cat -v' clearly shows it's a registry file... laptop ~% file .registry .registry: PCX ver. 2.5 image data laptop ~% strings .registry HKLM HKCU HKCU\Software\LinuxLoader\div3 HKCU\Software\LinuxLoader\div3\BitRate HKCU\Software\LinuxLoader\div3\KeyFrames HKCU\Software\LinuxLoader\div3\Crispness HKCU\SOFTWARE\Microsoft\Scrunch\CPU Clock Speed HKCU\SOFTWARE\Microsoft\Scrunch\Video\Resolution HKCU\SOFTWARE\Microsoft\Scrunch\Video\BitRate HKCU\SOFTWARE\Microsoft\Scrunch\Post Process Mode
Hi Lucas, whatever changes you made in .92 of eog now made it worse. Looks we're stuck on a mutex/condvar now. If i eog an image it hangs (no window comes up ever). If i gdb the process and Ctrl-C it and show the stack here is where i am... home ~% gdb eog GNU gdb 6.4 Copyright 2005 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) r x.pnm Starting program: /usr/bin/eog x.pnm [Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 26927)] [New Thread 32769 (LWP 26931)] [New Thread 16386 (LWP 26932)] Program received signal SIGINT, Interrupt.
+ Trace 66690
Thread 16386 (LWP 26932)
I take the last comment 6 back. The 'hang' problem happens even with .91. It seems to loop forever when loading a relatively large pnm file. Try opening this file http://hasbox.com/x.pnm.gz with eog (gunzip it first). Imagemagick's 'display' and 'gimp' both load it instantaneously.
I think i figured this out Lucas. This *is* a race condition, but not in your thread code. Essentially files are being removed from under eog whilst it is loading thumbnails. I put some more debugging in job_thumb_finished() to print out the status, and also in eog_collection_item_load() to print the job and the file it is attempting to load and this is what i get: % gdb eog GNU gdb 6.4 Copyright 2005 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) r ~/b1.png Starting program: /usr/src/sources/gnome/eog-2.14.0/shell/eog ~/b1.png [Thread debugging using libthread_db enabled] [New Thread 16384 (LWP 27287)] [New Thread 32769 (LWP 27290)] [New Thread 16386 (LWP 27291)] No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting No profile, not correcting start job job=0x828e500, file=/home/mitch/.face [New Thread 32771 (LWP 27292)] start job job=0x828e4d0, file=/home/mitch/.registry start job job=0x828e560, file=/home/mitch/NATURE-AFlower_1024x768.png start job job=0x828e6b0, file=/home/mitch/SunRay170.jpg start job job=0x828e650, file=/home/mitch/b1.png start job job=0x828e5d0, file=/home/mitch/bill.png start job job=0x828e4a0, file=/home/mitch/blank.xpm start job job=0x828c760, file=/home/mitch/half.xpm start job job=0x8289ad0, file=/home/mitch/header_gradient_top.gif start job job=0x828e610, file=/home/mitch/img1.jpg start job job=0x828e4c0, file=/home/mitch/l.jpg start job job=0x828c7c0, file=/home/mitch/license.gif start job job=0x828e550, file=/home/mitch/linux_logo2_vsmall.gif start job job=0x8290910, file=/home/mitch/mydoc.gif start job job=0x8290950, file=/home/mitch/mydoc.xpm start job job=0x8290990, file=/home/mitch/p1.pnm start job job=0x82909d0, file=/home/mitch/sfx4100.png start job job=0x8290a30, file=/home/mitch/skype.jpg start job job=0x8290a70, file=/home/mitch/sr.jpg start job job=0x8290ab0, file=/home/mitch/sr.svg start job job=0x8290b10, file=/home/mitch/test.jpg start job job=0x8290b50, file=/home/mitch/test2.jpg start job job=0x8290b90, file=/home/mitch/test3.jpg start job job=0x8290bd0, file=/home/mitch/tick_green.gif start job job=0x8290c30, file=/home/mitch/x.xpm success job=0x828e500 status=1 success job=0x828e560 status=1 success job=0x828e6b0 status=1 success job=0x828e650 status=1 fail job=0x828e4d0 status=0 success job=0x828e4a0 status=1 success job=0x828c760 status=1 success job=0x8289ad0 status=1 success job=0x828e610 status=1 success job=0x828e4c0 status=1 success job=0x828e5d0 status=1 success job=0x828e550 status=1 success job=0x8290910 status=1 success job=0x8290950 status=1 success job=0x8290990 status=1 success job=0x82909d0 status=1 success job=0x8290a30 status=1 success job=0x828c7c0 status=1 success job=0x8290a70 status=1 success job=0x8290b10 status=1 success job=0x8290ab0 status=1 success job=0x8290b50 status=1 success job=0x8290b90 status=1 success job=0x8290bd0 status=1 success job=0x8290c30 status=1 start job job=0x8270510, file=/home/mitch/.fonts.cache-1.TMP-nv0Wlt (eog:27291): GLib-WARNING **: GError set over the top of a previous GError or uninitialized memory. This indicates a bug in someone's code. You must ensure an error is NULL before it's set. The overwriting error message was: MTime or mime type not available start job job=0x82d2bd0, file=/home/mitch/.fonts.cache-1.LCK start job job=0x826bb50, file=/home/mitch/.fonts.cache-1.NEW start job job=0x8273cb0, file=/home/mitch/.fonts.cache-1 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 32771 (LWP 27292)] job_thumb_create (job=0x82d2bd0, data=0x82575c8, error=0x826fef0) at eog-collection-item.c:311 311 image = priv->image; (gdb) No matter how may times i run it, i always note that the jobid it crashes in in job_thumb_create() is ALWAYS the jobid (0x82d2bd0) of one of the TEMPORARY files that gets created to rebuild the font cache (in this case /home/mitch/.fonts.cache-1.LCK). Note after eog crashes/finishes, the temporary files no longer exist ! So essentially the crash is since the file it is trying to generate a thumbnail gets removed under it's feet !!
Futhermore i did a printf in eog_collection_item_destroy() under 'if (priv) {' statement and reran. success job=0x8290a50 status=1 start job job=0x82703b0, file=/home/mitch/.fonts.cache-1.TMP-s0CZ4R DESTROY /home/mitch/.fonts.cache-1.TMP-s0CZ4R start job job=0x826bb40, file=/home/mitch/.fonts.cache-1.LCK DESTROY /home/mitch/.fonts.cache-1.LCK start job job=0x8274d70, file=/home/mitch/.fonts.cache-1.NEW DESTROY /home/mitch/.fonts.cache-1.NEW start job job=0x8292570, file=/home/mitch/.fonts.cache-1 Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 32771 (LWP 27627)] job_thumb_create (job=0x82703b0, data=0x80ebb98, error=0x82a0548) at eog-collection-item.c:312 312 image = priv->image; (gdb) Surprise, surprise ! my DESTROY statement is being printed, and that block does 'g_free (priv)' for the for the 3 temporary font cache files whilst we subsequently try to dereference it in job_thumb_create(). So. In effect i'm verifying the need to retest priv vefore dereferencing in job_thumb_create(). I've add this check static void job_thumb_create (EogJob *job, gpointer data, GError **error) { EogCollectionItemPrivate *priv; EogImage *image; GdkPixbuf *pixbuf; GnomeVFSURI *uri; priv = EOG_COLLECTION_ITEM (data)->priv; + if (!priv) + return; image = priv->image; This works perfectly 100% of the time now !!! Please verify and apply to your tree.
This seems to be same bug as bug #336050 that is fixed now. Closing as duplicate. Feel free to reopen the bug if the problem persists someway. *** This bug has been marked as a duplicate of 336050 ***