Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ex_bitmap example crashed on Ubuntu 18.04 #1057

Open
haxpor opened this issue May 16, 2019 · 10 comments

Comments

Projects
None yet
2 participants
@haxpor
Copy link

commented May 16, 2019

Based on allegro fe80392 built on Ubuntu 18.04.

Tried to run ex_bitmap example then it immediately crashed with the following log (note I have to set core dump location path, and properly hook up with gdb)

$ gdb -c /tmp/core-ex_bitmap.30668.haxpor-linux.1557977380
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
[New LWP 30668]
[New LWP 30671]
[New LWP 30669]
[New LWP 30674]
[New LWP 30672]
[New LWP 30670]
[New LWP 30673]
[New LWP 30676]
Core was generated by `./ex_bitmap'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007f435b68698d in ?? ()
[Current thread is 1 (LWP 30668)]
(gdb) bt
#0  0x00007f435b68698d in ?? ()
#1  0x0000000000000280 in ?? ()
#2  0x0000000000000000 in ?? ()
(gdb) symbol-file ex_bitmap
Reading symbols from ex_bitmap...done.
(gdb) sharedlibrary
Reading symbols from /home/haxpor/scrap/allegro5/build/lib/liballegro_image.so.5.2...done.
Reading symbols from /home/haxpor/scrap/allegro5/build/lib/liballegro_dialog.so.5.2...done.
Reading symbols from /home/haxpor/scrap/allegro5/build/lib/liballegro.so.5.2...done.
Reading symbols from /lib/x86_64-linux-gnu/libc.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libc-2.27.so...done.
done.
Reading symbols from /usr/local/lib/libpng16.so.16...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libjpeg.so.8...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgtk-x11-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgdk-x11-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libpango-1.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgobject-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libglib-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libpthread.so.0...Reading symbols from /usr/lib/debug/.build-id/28/c6aade70b2d40d1f0f3d0a1a0cad1ab816448f.debug...done.
done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Reading symbols from /lib/x86_64-linux-gnu/libm.so.6...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libm-2.27.so...done.
done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libX11.so.6...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXcursor.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXpm.so.4...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXi.so.6...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXinerama.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXrandr.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libOpenGL.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libGLX.so.0...(no debugging symbols found)...done.
Reading symbols from /lib64/ld-linux-x86-64.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/ld-2.27.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libz.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgmodule-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libpangocairo-1.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXfixes.so.3...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libatk-1.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libcairo.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgio-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libpangoft2-1.0.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libfontconfig.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXrender.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXcomposite.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXdamage.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXext.so.6...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libthai.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libffi.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libpcre.so.3...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libdl.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libdl-2.27.so...done.
done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libGLdispatch.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/libfreetype.so.6...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libpixman-1.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb-shm.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb-render.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/librt.so.1...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/librt-2.27.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libselinux.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libresolv.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libresolv-2.27.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libmount.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libharfbuzz.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libexpat.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libdatrie.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXau.so.6...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXdmcp.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libbz2.so.1.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libblkid.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgraphite2.so.3...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libbsd.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libuuid.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libgail.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libgailutil.so.18...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libatk-bridge.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libdbus-1.so.3...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libatspi.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libsystemd.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/liblzma.so.5...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/liblz4.so.1...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libgcrypt.so.20...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libgpg-error.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/engines/libmurrine.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/gtk-2.0/modules/libcanberra-gtk-module.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libcanberra-gtk.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libcanberra.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/libvorbisfile.so.3...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libtdb.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libltdl.so.7...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/libvorbis.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/local/lib/libogg.so.0...done.
Reading symbols from /lib/x86_64-linux-gnu/libmvec.so.1...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libmvec-2.27.so...done.
done.
Reading symbols from /usr/lib/x86_64-linux-gnu/gtk-2.0/2.10.0/immodules/im-ibus.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libibus-1.0.so.5...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/gio/modules/libgvfsdbus.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/gvfs/libgvfscommon.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libGLX_mesa.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libglapi.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libdrm.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb-glx.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libX11-xcb.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb-dri2.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libXxf86vm.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb-dri3.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb-present.so.0...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxcb-sync.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libxshmfence.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/dri/i965_dri.so...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libdrm_intel.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libdrm_radeon.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libdrm_nouveau.so.2...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libstdc++.so.6...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libgcc_s.so.1...(no debugging symbols found)...done.
Reading symbols from /usr/lib/x86_64-linux-gnu/libpciaccess.so.0...(no debugging symbols found)...done.
Reading symbols from /lib/x86_64-linux-gnu/libnss_compat.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_compat-2.27.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libnss_nis.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_nis-2.27.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libnsl.so.1...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnsl-2.27.so...done.
done.
Reading symbols from /lib/x86_64-linux-gnu/libnss_files.so.2...Reading symbols from /usr/lib/debug//lib/x86_64-linux-gnu/libnss_files-2.27.so...done.
done.
(gdb) bt
#0  0x00007f435b68698d in __GI___libc_free (mem=0x280) at malloc.c:3103
#1  0x00007f43595ccd09 in XFree () at /usr/lib/x86_64-linux-gnu/libX11.so.6
#2  0x00007f435ba7cf27 in xdpy_set_window_title_default (display=display@entry=0x564fedea13e0, title=<optimized out>)
    at /home/haxpor/scrap/allegro5/src/x/xdisplay.c:1184
#3  0x00007f435ba7e850 in xdpy_create_display_locked (system=system@entry=0x564feddedd00, flags=flags@entry=0, w=w@entry=640, h=h@entry=480, adapter=<optimized out>) at /home/haxpor/scrap/allegro5/src/x/xdisplay.c:391
#4  0x00007f435ba7e9e5 in xdpy_create_display (w=640, h=480) at /home/haxpor/scrap/allegro5/src/x/xdisplay.c:614
#5  0x00007f435ba385b5 in al_create_display (w=640, h=480) at /home/haxpor/scrap/allegro5/src/display.c:53
#6  0x0000564fec94d754 in  ()
#7  0x0000000000000000 in  ()
@haxpor

This comment has been minimized.

Copy link
Author

commented May 16, 2019

Update

I got crash log more this time after rebuilding, and satisfied all dependencies except video backend.

The program 'ex_bitmap' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadValue (integer parameter out of range for operation)'.
  (Details: serial 77 error_code 2 request_code 18 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
@haxpor

This comment has been minimized.

Copy link
Author

commented May 16, 2019

Update 2

Found the problem. If such sample makes a call to open_log() (I believe this one will open a new window for logging), then it will crash. I'm able to make such sample runs if I comment out that particular line.

Does this mean running allegro on Linux to show multiple window is not support?

@pedro-w

This comment has been minimized.

Copy link
Contributor

commented May 27, 2019

Does this mean running allegro on Linux to show multiple window is not support?

It should be supported, so I think you may have found a bug.

@pedro-w

This comment has been minimized.

Copy link
Contributor

commented May 29, 2019

I tried to reproduce this on Debian 9 (using gcc to build), and didn't see this error. Does it crash every time for you, or just sometimes?

@pedro-w

This comment has been minimized.

Copy link
Contributor

commented May 30, 2019

Your backtrace puts the problem here:

allegro5/src/x/xdisplay.c

Lines 1168 to 1185 in 14155f9

static void xdpy_set_window_title_default(ALLEGRO_DISPLAY *display, const char *title)
{
ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver();
ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display;
{
Atom WM_NAME = XInternAtom(system->x11display, "WM_NAME", False);
Atom _NET_WM_NAME = XInternAtom(system->x11display, "_NET_WM_NAME", False);
char *list[1] = { (char *) title };
XTextProperty property;
Xutf8TextListToTextProperty(system->x11display, list, 1, XUTF8StringStyle,
&property);
XSetTextProperty(system->x11display, glx->window, &property, WM_NAME);
XSetTextProperty(system->x11display, glx->window, &property, _NET_WM_NAME);
XSetTextProperty(system->x11display, glx->window, &property, XA_WM_NAME);
XFree(property.value);
}

And the XLib request type 18 is ChangeProperty
So my guess is that Xutf8TextListToTextProperty is failing somehow (the return status is never checked!) and therefore property contains junk which causes X errors when we try to set it and a crash when we try to free it.
Could you put your debugger on xdpy_set_window_title_default and see if anything weird is happening (e.g. garbage title)
Also, what locale are you using?

@haxpor

This comment has been minimized.

Copy link
Author

commented May 30, 2019

Hey sorry for late reply @pedro-w , I'll try to debug now and get you more info. Thanks for your time in investigation.

It happens every time for me.

@haxpor

This comment has been minimized.

Copy link
Author

commented May 30, 2019

Ok, seem property's value is NULL after I stepped into that function.

Thread 1 "ex_bitmap" hit Breakpoint 1, xdpy_set_window_title_default (display=0x55555585e010, 
    title=0x7ffff79aa360 <_al_app_name> "ex_bitmap") at /home/haxpor/Data/src/allegro5/src/x/xdisplay.c:1169
1169	{
(gdb) n
[Thread 0x7fffe5db0700 (LWP 1563) exited]
1170	   ALLEGRO_SYSTEM_XGLX *system = (ALLEGRO_SYSTEM_XGLX *)al_get_system_driver();
(gdb) n
1171	   ALLEGRO_DISPLAY_XGLX *glx = (ALLEGRO_DISPLAY_XGLX *)display;
(gdb) n
1174	      Atom WM_NAME = XInternAtom(system->x11display, "WM_NAME", False);
(gdb) n
1175	      Atom _NET_WM_NAME = XInternAtom(system->x11display, "_NET_WM_NAME", False);
(gdb) n
1176	      char *list[1] = { (char *) title };
(gdb) n
1179	      Xutf8TextListToTextProperty(system->x11display, list, 1, XUTF8StringStyle,
(gdb) n
1181	      XSetTextProperty(system->x11display, glx->window, &property, WM_NAME);
(gdb) n
1182	      XSetTextProperty(system->x11display, glx->window, &property, _NET_WM_NAME);
(gdb) n
1183	      XSetTextProperty(system->x11display, glx->window, &property, XA_WM_NAME);
(gdb) info locals
WM_NAME = 39
_NET_WM_NAME = 324
list = {0x7ffff79aa360 <_al_app_name> "ex_bitmap"}
property = {value = 0x0, encoding = 140737344941732, format = -12368, nitems = 140737344458002}
system = 0x5555557ac130
glx = 0x55555585e010
(gdb)

and here is my locale

$ locale
LANG=en_HK.UTF-8
LANGUAGE=en_HK:en
LC_CTYPE="en_HK.UTF-8"
LC_NUMERIC="en_HK.UTF-8"
LC_TIME="en_HK.UTF-8"
LC_COLLATE="en_HK.UTF-8"
LC_MONETARY="en_HK.UTF-8"
LC_MESSAGES="en_HK.UTF-8"
LC_PAPER="en_HK.UTF-8"
LC_NAME="en_HK.UTF-8"
LC_ADDRESS="en_HK.UTF-8"
LC_TELEPHONE="en_HK.UTF-8"
LC_MEASUREMENT="en_HK.UTF-8"
LC_IDENTIFICATION="en_HK.UTF-8"
LC_ALL=
@pedro-w

This comment has been minimized.

Copy link
Contributor

commented May 30, 2019

I still can't reproduce, even setting your locale. Can you change the code so we can have a look at the return code - change line 1179 to

      int retcode = Xutf8TextListToTextProperty(system->x11display, list, 1, XUTF8StringStyle,
         &property);

and step through like before. It's possible that XUTF8StringStyle isn't supported. I am not an expert at this side of things.

There is something similar for SDL http://lists.libsdl.org/pipermail/sdl-libsdl.org/2004-September/045914.html, fixed in 2004 😱

@haxpor

This comment has been minimized.

Copy link
Author

commented May 30, 2019

Thank you for your time! When I have gap of time to test this again, I'll do it.

@pedro-w

This comment has been minimized.

Copy link
Contributor

commented May 30, 2019

Also: can you test ex_menu and ex_drawpixels - the former changes the window title but does not open a log, the latter opens a log but does not change the window title.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.