! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
XFDESKTOP crashing allocating memory
Status:
RESOLVED: FIXED
Severity:
blocker
Product:
Xfdesktop
Component:
General

Comments

Description Kim 2006-11-11 08:18:53 CET
xfdesktop throws the following error on a Sempron 64 bit FC6 install.

GLib-ERROR **: gmem.c:135: failed to allocate 4294967296 bytes
aborting...

As requested, here is a GDB output:

 gdb
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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 "x86_64-redhat-linux-gnu".
(gdb) quit
[kxk@snotux ~]$ gdb xfdesktop
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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 "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/xfdesktop 
[Thread debugging using libthread_db enabled]
[New Thread 47305245138352 (LWP 29807)]

GLib-ERROR **: gmem.c:135: failed to allocate 4294967296 bytes
aborting...

GLib-ERROR **: gmem.c:135: failed to allocate 4294967296 bytes
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 47305245138352 (LWP 29807)]
0x0000003605a301b5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x0000003605a301b5 in raise () from /lib64/libc.so.6
#1  0x0000003605a31b20 in abort () from /lib64/libc.so.6
#2  0x000000360aa35050 in g_logv () from /lib64/libglib-2.0.so.0
#3  0x000000360aa350d3 in g_log () from /lib64/libglib-2.0.so.0
#4  0x000000360aa33dd9 in g_malloc () from /lib64/libglib-2.0.so.0
#5  0x000000360aa449b9 in g_strndup () from /lib64/libglib-2.0.so.0
#6  0x000000360aa44bcb in g_ascii_strup () from /lib64/libglib-2.0.so.0
#7  0x00002b061c100cc3 in _mcs_channel_new (name=0x430926 "BACKDROP", 
    dpy=0x6550e0) at mcs-channel.c:88
#8  0x00002b061c10260c in mcs_client_add_channel (client=0x66c6a0, 
    channel_name=0x430926 "BACKDROP") at mcs-client.c:125
#9  0x0000000000411415 in settings_init () at settings.c:110
#10 0x0000000000410845 in main (argc=1, argv=0x7fff8e9aa0f8) at main.c:333
(gdb)
Comment 1 Olivier Fourdan editbugs 2006-11-11 09:37:48 CET
Created attachment 868 
Patch to avoid use of GDK_SCREEN()

Might be unrelated, but I think use of GDK_SCREEN() is to be avoided as it's not multi-head safe (search for GDK_MULTIHEAD_SAFE in /usr/include/gtk-2.0/gdk/gdkx.h). I do not know about the version on gtk that is used in FC6 nor what gtk+ patches are applied for FC6, though.

You may want to apply this patch that uses GdkScreen/GdkDisplay functions. Might be worth applying, even if it doesn't fix that bug, it's better not to use GDK_DISPLAY() anyhow IMHO.
Comment 2 Olivier Fourdan editbugs 2006-11-11 09:38:38 CET
(In reply to comment #1)
> Patch to avoid use of GDK_SCREEN()

Read GDK_DISPLAY() here...

Comment 3 Brian J. Tarricone (not reading bugmail) 2006-11-11 09:39:45 CET
Olivier, what does this have to do with this bug?
Comment 4 Olivier Fourdan editbugs 2006-11-11 10:21:34 CET
The crash happens in one of the first calls of xfdesktop, while initiating the mcs channel, ie at the very beginning of xfdesktop. Therefore, I'm exploring anything that could leads to the crash I couldn't explain otherwise.

I've also experienced random crashes when xfdesktop is started w/out a mcs manager running and w/out and settings initiated (read fresh install). I'm trying to help.
Comment 5 Kim 2006-11-11 10:47:05 CET
Tried that patch, same result, gdb output below.

As an aside xfce-setting-show does it as well.

gdb xfdesktop
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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 "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/xfdesktop 
[Thread debugging using libthread_db enabled]
[New Thread 47990731197872 (LWP 20375)]
xfce-mcs-manager-Message: Standard XSETTINGS manager already detected for screen 0

GLib-ERROR **: gmem.c:135: failed to allocate 4294967296 bytes
aborting...

GLib-ERROR **: gmem.c:135: failed to allocate 4294967296 bytes
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 47990731197872 (LWP 20375)]
0x0000003605a301b5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x0000003605a301b5 in raise () from /lib64/libc.so.6
#1  0x0000003605a31b20 in abort () from /lib64/libc.so.6
#2  0x000000360aa35050 in g_logv () from /lib64/libglib-2.0.so.0
#3  0x000000360aa350d3 in g_log () from /lib64/libglib-2.0.so.0
#4  0x000000360aa33dd9 in g_malloc () from /lib64/libglib-2.0.so.0
#5  0x000000360aa449b9 in g_strndup () from /lib64/libglib-2.0.so.0
#6  0x000000360aa44bcb in g_ascii_strup () from /lib64/libglib-2.0.so.0
#7  0x00002ba5b6373cc3 in _mcs_channel_new (name=0x430946 "BACKDROP", 
    dpy=0x6550e0) at mcs-channel.c:88
#8  0x00002ba5b637560c in mcs_client_add_channel (client=0x66ed90, 
    channel_name=0x430946 "BACKDROP") at mcs-client.c:125
#9  0x000000000041140c in settings_init () at settings.c:112
#10 0x0000000000410835 in main (argc=1, argv=0x7ffff4736e28) at main.c:333
(gdb) 
Comment 6 Olivier Fourdan editbugs 2006-11-11 10:59:40 CET
Good to know. Can you run gdb on xfce-setting-show too then?
Also, does the xfce-mcs-manager run? => "ps -ef | grep xfce-mcs-manager"
Comment 7 Kim 2006-11-11 11:13:20 CET
gdb xfce-mcs-manager
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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 "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/xfce-mcs-manager 
[Thread debugging using libthread_db enabled]
[New Thread 47787236229344 (LWP 26981)]
xfce-mcs-manager-Message: Standard XSETTINGS manager already detected for screen 0

GLib-ERROR **: gmem.c:135: failed to allocate 4294967296 bytes
aborting...

Program received signal SIGABRT, Aborted.
[Switching to Thread 47787236229344 (LWP 26981)]
0x0000003605a301b5 in raise () from /lib64/libc.so.6
(gdb) bt
#0  0x0000003605a301b5 in raise () from /lib64/libc.so.6
#1  0x0000003605a31b20 in abort () from /lib64/libc.so.6
#2  0x000000360aa35050 in g_logv () from /lib64/libglib-2.0.so.0
#3  0x000000360aa350d3 in g_log () from /lib64/libglib-2.0.so.0
#4  0x000000360aa33dd9 in g_malloc () from /lib64/libglib-2.0.so.0
#5  0x000000360aa449b9 in g_strndup () from /lib64/libglib-2.0.so.0
#6  0x000000360aa44bcb in g_ascii_strup () from /lib64/libglib-2.0.so.0
#7  0x00002b7654f895d3 in _mcs_channel_new (name=0x2b765a11aa32 "orage", 
    dpy=0x61b5c0) at mcs-channel.c:88
#8  0x00002b7654f8b785 in mcs_manager_add_channel (manager=0x6353d0, 
    channel_name=0x2b765a11aa32 "orage") at mcs-manager.c:190
#9  0x00002b765a118294 in mcs_plugin_init ()
   from /usr/lib/xfce4/mcs-plugins/orage_plugin.so
#10 0x0000000000402fe2 in main (argc=1, argv=0x7fff55b24208)
    at xfce-mcs-manager.c:132
(gdb) 
Comment 8 Kim 2006-11-11 11:13:43 CET
gdb xfce-setting-show
GNU gdb Red Hat Linux (6.5-8.fc6rh)
Copyright (C) 2006 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 "x86_64-redhat-linux-gnu"...Using host libthread_db library "/lib64/libthread_db.so.1".

(gdb) run
Starting program: /usr/bin/xfce-setting-show 
[Thread debugging using libthread_db enabled]
[New Thread 46973410869456 (LWP 26931)]
xfce-mcs-manager-Message: Standard XSETTINGS manager already detected for screen 0

GLib-ERROR **: gmem.c:135: failed to allocate 4294967296 bytes
aborting...

Program exited normally.
(gdb) bt
No stack.
(gdb) quit
Comment 9 Olivier Fourdan editbugs 2006-11-11 14:12:18 CET
Did you try earlier versions? Did it work with, say, beta1 or even Xfce 4.2?
Comment 10 Olivier Fourdan editbugs 2006-11-11 14:37:49 CET
Ok, I think I know what's going on, the problem is with using -1 as string length in g_ascii_strup(). See that post: http://linuxfromscratch.org/pipermail/cross-lfs/2005-November/000209.html

I've committed a fix to libxfce4mcs, can you try?

You can grab a copy of current SVN here:

http://foo-projects.org/~olivier/preview/

You need to rebuild and install this lib, and apps should be fine.
Comment 11 Olivier Fourdan editbugs 2006-11-11 14:38:27 CET
Taking the bug, it's not xfdesktop related.
Comment 12 Brian J. Tarricone (not reading bugmail) 2006-11-11 22:12:45 CET
Thanks Olivier... while using GDK_DISPLAY() isn't really a big deal (because our multihead-use only ever uses one default Display/GdkDisplay), I'm going to replace most of that libX11 code with the equivalent gdk code.
Comment 13 Olivier Fourdan editbugs 2006-11-11 22:25:08 CET
(In reply to comment #12)
> Thanks Olivier... while using GDK_DISPLAY() isn't really a big deal (because
> our multihead-use only ever uses one default Display/GdkDisplay), I'm going to
> replace most of that libX11 code with the equivalent gdk code.
> 

humm, for Xfce 4.6 right?...
Comment 14 Kim 2006-11-11 23:10:32 CET
Hi Olivier,

Tried the svn of libxfce4mcs, and xfdesktop now works fine, but xfce-setting-show still crashes.

Thanks for the help.

Comment 15 Olivier Fourdan editbugs 2006-11-12 07:40:21 CET
Unfortunately, our code is correct, using -1 as length is a documented way of letting the function manage the length iteslf, and works fine on x86_64 (I'm using Ubuntu on an AMD64 system myself)

http://developer.gnome.org/doc/API/2.0/glib/glib-String-Utility-Functions.html#g-ascii-strup

len : 	 length of str in bytes, or -1 if str is nul-terminated.

It means that the problem lies either in you distribution, in the compiler or in the glibc. Did you use any GCC flags?  How are set $CFLAGS and $LDFLAGS  ?

Comment 16 Olivier Fourdan editbugs 2006-11-12 07:46:11 CET
Also, it seems that the backtrace for xfce-setting-show is incomplete. May I ask you rebuild the xfce-mcs-manager module with --enable-debug just like you did with xfdesktop, and redo the backtrace? TIA.
Comment 17 Olivier Fourdan editbugs 2006-11-12 08:37:42 CET
Actually, from your comment #8, I would say that xfce-setting show works, but xfce-mcs-manager dies. That means that it can be either the manager iteself or any of the modules it loads.

Ideally, what you should do is:

From a terminal, run gdb xfce-mcs-manager
From another terminal run xfes-setting show, I think it will kill xfce-mcs-manager where you'll be able to do a backtrace

Comment 18 Olivier Fourdan editbugs 2006-11-12 09:00:06 CET
Note that there are several other use cases of g_ascii_strup/strdown(..., -1) in the code, among different modules. I'll try to change these too. I'm not quite sure we should fix code that's aren't broken, though....
Comment 19 Olivier Fourdan editbugs 2006-11-12 09:43:31 CET
I've updated the following modules:

 - xfwm4
 - xfce-mcs-plugins
 - libxfce4mcs

And uploaded snapshots to http://foo-projects.org/~olivier/preview/

You may update to rev. r23839 and try... Thanks in advance.
Comment 20 Kim 2006-11-13 08:10:38 CET
libxfce4mcs and xfwm build fine, but xfce-mcs-plugins throws the following:

 gcc -DHAVE_CONFIG_H -I. -I. -I../.. -I../.. -I../.. -DLOCALEDIR=\"/usr/share/locale\" -I/usr/include/xfce4 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/atk-1.0 -I/usr/include/cairo -DUSE_XF86VM -I/usr/include/xfce4 -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/atk-1.0 -I/usr/include/cairo -DUSE_XRANDR -fno-strict-aliasing -Werror -Wall -g -O2 -g -Wall -DXFCE_DISABLE_DEPRECATED -MT display_plugin_la-display_plugin.lo -MD -MP -MF .deps/display_plugin_la-display_plugin.Tpo -c display_plugin.c  -fPIC -DPIC -o .libs/display_plugin_la-display_plugin.o
cc1: warnings being treated as errors
display_plugin.c: In function 'confirm_timeout_cb':
display_plugin.c:159: warning: cast from pointer to integer of different size
display_plugin.c:170: warning: cast to pointer from integer of different size
make[3]: *** [display_plugin_la-display_plugin.lo] Error 1
make[3]: Leaving directory `/home/kxk/tmptar/xfce-mcs-plugins-4.3.99.3svn-23839/plugins/display_plugin'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/kxk/tmptar/xfce-mcs-plugins-4.3.99.3svn-23839/plugins'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/kxk/tmptar/xfce-mcs-plugins-4.3.99.3svn-23839'
make: *** [all] Error 2
Comment 21 Olivier Fourdan editbugs 2006-11-13 18:22:56 CET
There is nothing wrong in the code there, so it's gcc that's wrong. Btw, it's just a warning ,the build fails because of -Werror.

Can you try to reconfigure that module without debug (ie --disable-debug) ?
Comment 22 Kim 2006-11-14 19:50:20 CET
Compiles and works fine with the --disable-debug option.

I can now run the settings program.

Still some wierdness with beryl, but thats another story.
Comment 23 Olivier Fourdan editbugs 2006-11-14 20:03:26 CET
Ok, thanks for your time testing it. Would have been more insteresting if you could have test xfwm4 instead of using Beryl... Anyway, closing.

Thanks again.

Bug #2563

Reported by:
Kim
Reported on: 2006-11-11
Last modified on: 2009-07-14

People

Assignee:
Olivier Fourdan
CC List:
1 user

Version

Attachments

Patch to avoid use of GDK_SCREEN() (4.57 KB, patch)
2006-11-11 09:37 CET , Olivier Fourdan
no flags

Additional information