Bug#288163: eog: incorrectly creates threads when loading images

John Lightsey John Lightsey <john@nixnuts.net>, 288163@bugs.debian.org
Sat, 01 Jan 2005 20:35:19 -0600


Package: eog
Version: 2.8.2-0.1
Severity: important

When viewing a lenghty collection of photos this error invariably
comes up:

GThread-ERROR **: file gthread-posix.c: line 351 (): error 'Cannot
allocate memory' during 'pthread_create'
aborting...

A simple grep over the source tree shows the problem...

john@lightning:~/src/tmp/eog/eog-2.8.2$ grep -nR "g_thread" *
libeog/eog-image.c:258: if (!g_thread_supported ()) {
libeog/eog-image.c:259:         g_thread_init (NULL);
libeog/eog-image.c:272:         thread = g_thread_create
(create_thumbnails, NULL, TRUE, NULL);
libeog/eog-image.c:968:         priv->load_thread = g_thread_create
(real_image_load, img, TRUE, NULL);
shell/eog-window.c:840: data->thread = g_thread_create (save_image_list,
data, TRUE, NULL);
shell/eog-window.c:1112:        data->thread = g_thread_create
(save_as_image_list, data, TRUE, NULL);
shell/eog-window.c:1214:        data->thread = g_thread_create
(save_as_image_list, data, TRUE, NULL);
john@lightning:~/src/tmp/eog/eog-2.8.2$

g_thread_create takes (1) a function to run in the new thread, (2) data
for the function, (3) a boolean value specifying whether the thread is
joinable, (4) a return location for errors.

The resources consumed by threads that are created as joinable are not
freed until g_thread_join is called on those threads.  Obviously, EOG
cannot create joinable threads for each new image without calling
g_thread_join at some point.

By changing the two TRUE parameters in eog-image.c to FALSE I can make
it through a directory full of several hundred images without a crash.
I'm not certain whether the other threads should be created as
un-joinable or if they should be joined at some point.

Thanks for packaging up EOG and looking into this problem.

John

-- System Information:
Debian Release: 3.1
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.9-1-k7
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)

Versions of packages eog depends on:
ii  libart-2.0-2             2.3.16-6        Library of functions for 2D graphi
ii  libatk1.0-0              1.8.0-4         The ATK accessibility toolkit
ii  libbonobo2-0             2.8.0-4         Bonobo CORBA interfaces library
ii  libbonoboui2-0           2.8.0-2         The Bonobo UI library
ii  libc6                    2.3.2.ds1-20    GNU C Library: Shared libraries an
ii  libexif10                0.6.9-4         The EXIF library allows you to par
ii  libgconf2-4              2.8.1-4         GNOME configuration database syste
ii  libglade2-0              1:2.4.1-1       Library to load .glade files at ru
ii  libglib2.0-0             2.4.8-1         The GLib library of C routines
ii  libgnome2-0              2.8.0-6         The GNOME 2 library - runtime file
ii  libgnomecanvas2-0        2.8.0-1         A powerful object-oriented display
ii  libgnomeui-0             2.8.0-3         The GNOME 2 libraries (User Interf
ii  libgnomevfs2-0           2.8.3-7         The GNOME virtual file-system libr
ii  libgtk2.0-0              2.4.14-2        The GTK+ graphical user interface 
ii  libice6                  4.3.0.dfsg.1-10 Inter-Client Exchange library
ii  libjpeg62                6b-9            The Independent JPEG Group's JPEG 
ii  liborbit2                1:2.10.2-1.1    libraries for ORBit2 - a CORBA ORB
ii  libpango1.0-0            1.6.0-3         Layout and rendering of internatio
ii  libpopt0                 1.7-5           lib for parsing cmdline parameters
ii  libsm6                   4.3.0.dfsg.1-10 X Window System Session Management
ii  libx11-6                 4.3.0.dfsg.1-10 X Window System protocol client li
ii  libxml2                  2.6.11-5        GNOME XML library
ii  xlibs                    4.3.0.dfsg.1-10 X Keyboard Extension (XKB) configu
ii  zlib1g                   1:1.2.2-4       compression library - runtime

-- no debconf information