activateJoysticks -> *** glibc detected ***

You discovered a bug in the engine, and you are sure that it is not a problem of your code? Just post it in here. Please read the bug posting guidelines first.
Post Reply
MickeyKnox
Posts: 58
Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe

activateJoysticks -> *** glibc detected ***

Post by MickeyKnox »

Activating Joysticks leads to some trouble, when quitting.

I added the following two lines to the first tutorial, right before the main loop:

Code: Select all

irr::core::array< irr::SJoystickInfo > joystickInfos;
device->activateJoysticks(joystickInfos);
It seems to work, i did not witnessed any strange behavior so far as long as the application is
running, but when quitting (by clicking on the x), i get lots of stuff, that doesn't look good:
Quit message received.
*** glibc detected *** ./01.HelloWorld: free(): invalid next size (fast): 0x08333788 ***
======= Backtrace: =========
/lib/tls/i686/cmov/libc.so.6[0xb7c00a85]
/lib/tls/i686/cmov/libc.so.6(cfree+0x90)[0xb7c044f0]
/usr/lib/libstdc++.so.6(_ZdlPv+0x21)[0xb7dcbb11]
./01.HelloWorld[0x8054c53]
./01.HelloWorld[0x8053b29]
./01.HelloWorld[0x8054bfe]
./01.HelloWorld[0x80520f6]
./01.HelloWorld[0x804c331]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0)[0xb7bab450]
./01.HelloWorld(__gxx_personality_v0+0x31d)[0x804be01]
======= Memory map: ========
08048000-08315000 r-xp 00000000 08:08 40173583 /home/ingmar/my/projects/irrlicht-1.5/bin/Linux/01.HelloWorld
08315000-08319000 rw-p 002cc000 08:08 40173583 /home/ingmar/my/projects/irrlicht-1.5/bin/Linux/01.HelloWorld
08319000-0982b000 rw-p 08319000 00:00 0 [heap]
b6c00000-b6c21000 rw-p b6c00000 00:00 0
b6c21000-b6d00000 ---p b6c21000 00:00 0
b6d7a000-b6ea8000 rw-p b6d7a000 00:00 0
b6ea8000-b6eac000 r-xp 00000000 08:06 768377 /usr/lib/libXfixes.so.3.1.0
b6eac000-b6ead000 rw-p 00003000 08:06 768377 /usr/lib/libXfixes.so.3.1.0
b6ff1000-b7056000 rw-p b6ff1000 00:00 0
b7056000-b705a000 r-xp 00000000 08:06 768371 /usr/lib/libXdmcp.so.6.0.0
b705a000-b705b000 rw-p 00003000 08:06 768371 /usr/lib/libXdmcp.so.6.0.0
b705b000-b7072000 r-xp 00000000 08:06 768033 /usr/lib/libxcb.so.1.0.0
b7072000-b7073000 rw-p 00016000 08:06 768033 /usr/lib/libxcb.so.1.0.0
b7073000-b7074000 rw-p b7073000 00:00 0
b7074000-b7075000 r-xp 00000000 08:06 768264 /usr/lib/libxcb-xlib.so.0.0.0
b7075000-b7076000 rw-p 00000000 08:06 768264 /usr/lib/libxcb-xlib.so.0.0.0
b7076000-b7078000 r-xp 00000000 08:06 768360 /usr/lib/libXau.so.6.0.0
b7078000-b7079000 rw-p 00001000 08:06 768360 /usr/lib/libXau.so.6.0.0
b7079000-b707b000 r-xp 00000000 08:06 1110320 /lib/tls/i686/cmov/libdl-2.7.so
b707b000-b707d000 rw-p 00001000 08:06 1110320 /lib/tls/i686/cmov/libdl-2.7.so
b707d000-b707e000 r-xp 00000000 08:06 771796 /usr/lib/libnvidia-tls.so.169.12
b707e000-b707f000 rw-p 00000000 08:06 771796 /usr/lib/libnvidia-tls.so.169.12
b707f000-b7b53000 r-xp 00000000 08:06 769121 /usr/lib/libGLcore.so.169.12
b7b53000-b7b8f000 rwxp 00ad3000 08:06 769121 /usr/lib/libGLcore.so.169.12
b7b8f000-b7b94000 rwxp b7b8f000 00:00 0
b7b94000-b7b95000 rw-p b7b94000 00:00 0
b7b95000-b7cde000 r-xp 00000000 08:06 1110317 /lib/tls/i686/cmov/libc-2.7.so
b7cde000-b7cdf000 r--p 00149000 08:06 1110317 /lib/tls/i686/cmov/libc-2.7.so
b7cdf000-b7ce1000 rw-p 0014a000 08:06 1110317 /lib/tls/i686/cmov/libc-2.7.so
b7ce1000-b7ce4000 rw-p b7ce1000 00:00 0
b7ce4000-b7cee000 r-xp 00000000 08:06 620163 /lib/libgcc_s.so.1
b7cee000-b7cef000 rw-p 0000a000 08:06 620163 /lib/libgcc_s.so.1
b7cef000-b7d12000 r-xp 00000000 08:06 1110321 /lib/tls/i686/cmov/libm-2.7.so
b7d12000-b7d14000 rw-p 00023000 08:06 1110321 /lib/tls/i686/cmov/libm-2.7.so
b7d14000-b7dfc000 r-xp 00000000 08:06 768198 /usr/lib/libstdc++.so.6.0.9
b7dfc000-b7dff000 r--p 000e8000 08:06 768198 /usr/lib/libstdc++.so.6.0.9
b7dff000-b7e01000 rw-p 000eb000 08:06 768198 /usr/lib/libstdc++.so.6.0.9
b7e01000-b7e07000 rw-p b7e01000 00:00 0
b7e07000-b7eeb000 r-xp 00000000 08:06 769532 /usr/lib/libX11.so.6.2.0
b7eeb000-b7eee000 rw-p 000e4000 08:06 769532 /usr/lib/libX11.so.6.2.0
b7eee000-b7efb000 r-xp 00000000 08:06 768375 /usr/lib/libXext.so.6.4.0
b7efb000-b7efc000 rw-p 0000d000 08:06 768375 /usr/lib/libXext.so.6.4.0
b7efc000-b7efd000 rw-p b7efc000 00:00 0
b7efd000-b7f01000 r-xp 00000000 08:06 768411 /usr/lib/libXxf86vm.so.1.0.0
b7f01000-b7f02000 rw-p 00003000 08:06 768411 /usr/lib/libXxf86vm.so.1.0.0
b7f02000-b7f8a000 r-xp 00000000 08:06 767861 /usr/lib/libGL.so.169.12
b7f8a000-b7fa5000 rwxp 00087000 08:06 767861 /usr/lib/libGL.so.169.12
b7fa5000-b7fa6000 rwxp b7fa5000 00:00 0
b7fa9000-b7fb0000 r-xp 00000000 08:06 767275 /usr/lib/libXrender.so.1.3.0
b7fb0000-b7fb1000 rw-p 00007000 08:06 767275 /usr/lib/libXrender.so.1.3.0
b7fb1000-b7fb9000 r-xp 00000000 08:06 767423 /usr/lib/libXcursor.so.1.0.2
b7fb9000-b7fba000 rw-p 00007000 08:06 767423 /usr/lib/libXcursor.so.1.0.2
b7fba000-b7fbb000 rw-p b7fba000 00:00 0
b7fbb000-b7fbd000 rwxp 00000000 00:0e 1084 /dev/zero
b7fbd000-b7fbf000 rw-p b7fbd000 00:00 0
b7fbf000-b7fc0000 r-xp b7fbf000 00:00 0 [vdso]
b7fc0000-b7fda000 r-xp 00000000 08:06 1079160 /lib/ld-2.7.so
b7fda000-b7fdc000 rw-p 00019000 08:06 1079160 /lib/ld-2.7.so
bff9c000-bffb1000 rwxp bffeb000 00:00 0 [stack]
Aborted
My OS is Ubuntu 8.04
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

Hmm, quickly reviewed the code and didn't find anything. I'll try to valgrind the joystick example tomorrow. Did you have a joystick attached, or did you check without?
MickeyKnox
Posts: 58
Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe

Post by MickeyKnox »

I have a joystick attached, and it is detected properly.
Here is the output before quitting, which shows the detected joystick:
Irrlicht Engine version 1.5
Linux 2.6.24-24-generic #1 SMP Thu Feb 19 08:00:07 UTC 2009 i686
Creating X window...
Visual chosen: : 33
Loaded mesh: ../../media/sydney.md2
Loaded texture: /home/ingmar/my/projects/irrlicht-1.5/media/sydney.bmp
Found joystick 0, 9 axes, 9 buttons 'Logitech WingMan Interceptor [WMCOM]'
MickeyKnox
Posts: 58
Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe

Post by MickeyKnox »

hm.. interestingly. I just tried it without the joystick and the problem didn't occured.
Actually, the joystick is physically connected, but i didn't load the modules necessary
to use it. These are joydev, analog and adi (in this order). Right before loading adi i checked
and it still worked (but the joystick wasn't detected).
MickeyKnox
Posts: 58
Joined: Tue Apr 10, 2007 7:49 pm
Location: Karlsruhe

Post by MickeyKnox »

I created a segmentation fault, and i'm pretty sure, this has to do with activateJoystick.
A few (strange) steps are necessary, to reproduce it:
Create a directory in the same directory where the irrlicht-1.5 directory is.
Copy the contents (or at least the Makefile and main.cpp) of the TerrainRendering Tutorial
to that directoy.
Change the paths to the textures properly, eg "../../media/*" to "../irrlicht-1.5/media/*".
Comment out the help text.
Insert the following lines after the out commented help text:

Code: Select all

	irr::core::array< irr::SJoystickInfo > joystickInfos;
	device->activateJoysticks(joystickInfos);

	video::ITexture* texture = driver->getTexture("../irrlicht-1.5/media/particlewhite.bmp");
diff main.cpp ../irrlicht-1.5/examples/12.TerrainRendering/main.cpp
132c132
< env->addImage(driver->getTexture("../irrlicht-1.5/media/irrlichtlogo2.png"),
---
> env->addImage(driver->getTexture("../../media/irrlichtlogo2.png"),
136,137c136,137
< env->getSkin()->setFont(env->getFont("../irrlicht-1.5/media/fontlucida.png"));
< /*
---
> env->getSkin()->setFont(env->getFont("../../media/fontlucida.png"));
>
142,146d141
< */
< irr::core::array< irr::SJoystickInfo > joystickInfos;
< device->activateJoysticks(joystickInfos);
<
< video::ITexture* texture = driver->getTexture("../irrlicht-1.5/media/particlewhite.bmp");
178c173
< "../irrlicht-1.5/media/terrain-heightmap.bmp",
---
> "../../media/terrain-heightmap.bmp",
193c188
< driver->getTexture("../irrlicht-1.5/media/terrain-texture.jpg"));
---
> driver->getTexture("../../media/terrain-texture.jpg"));
195c190
< driver->getTexture("../irrlicht-1.5/media/detailmap3.jpg"));
---
> driver->getTexture("../../media/detailmap3.jpg"));
245,251c240,246
< driver->getTexture("../irrlicht-1.5/media/irrlicht2_up.jpg"),
< driver->getTexture("../irrlicht-1.5/media/irrlicht2_dn.jpg"),
< driver->getTexture("../irrlicht-1.5/media/irrlicht2_lf.jpg"),
< driver->getTexture("../irrlicht-1.5/media/irrlicht2_rt.jpg"),
< driver->getTexture("../irrlicht-1.5/media/irrlicht2_ft.jpg"),
< driver->getTexture("../irrlicht-1.5/media/irrlicht2_bk.jpg"));
< scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("../irrlicht-1.5/media/skydome.jpg"),16,8,0.95f,2.0f);
---
> driver->getTexture("../../media/irrlicht2_up.jpg"),
> driver->getTexture("../../media/irrlicht2_dn.jpg"),
> driver->getTexture("../../media/irrlicht2_lf.jpg"),
> driver->getTexture("../../media/irrlicht2_rt.jpg"),
> driver->getTexture("../../media/irrlicht2_ft.jpg"),
> driver->getTexture("../../media/irrlicht2_bk.jpg"));
> scene::ISceneNode* skydome=smgr->addSkyDomeSceneNode(driver->getTexture("../../media/skydome.jpg"),16,8,0.95f,2.0f);
Omitting any of these steps results in the "*** glibc detected *** ..." posted earlier.
Frankly, i don't believe that changing the directory and the paths, omitting the help text
and loading some texture are responsible for creating a segmentation fault.

But omitting the call to activateJoystick makes everything works perfect (except no
Joystick support). This looks to me like activateJoystick creates a memory leak, that,
in this strange case, leads to a segmentation fault.

I had a look at CIrrDeviceLinux::activateJoysticks and couldn't find anything strange.

Two things to note:
1. If no Joystick is present, calling activateJoystick creates no problems.
2. Everything works fine, while the application is running. I can use the joystick to
control a camera. The problems reported just occure when shutting down.
Post Reply