The application in question is a client-server (to be made a multiplayer game) application. I have two threads running. The first thread (networking) immediately sleeps until a later point in the rendering thread which is never reached due to the segmentation fault.
The application was working normally until I made a few changes (made the first thread sleep after initialization till the rendering thread wakes it up). All my other Irrlicht demos are working fine so I am inclined to believe it is a problem with my application. But looking at the gdb and valgrind traces, I am wondering if it may be a bug in Irrlicht. If anyone can confirm whether the issue would be in my code or in Irrlicht, I'll post the required snippets of code.
Note: Even after reverting the made changes through git, I am unable to fix the issue.
I have applied an infinite loop before my createDevice() call and it works fine and hangs. If I place the infinite loop after my createDevice() call, it crashes. The following is the GDB output:
Code: Select all
(gdb) r
Starting program: .../src/client/client
[Thread debugging using libthread_db enabled]
[New Thread 0xb7fe2b70 (LWP 4119)]
Irrlicht Engine version 1.7.1
Linux 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 i686
Creating X window...
Program received signal SIGSEGV, Segmentation fault.
_dl_runtime_resolve () at ../sysdeps/i386/dl-trampoline.S:43
43 ../sysdeps/i386/dl-trampoline.S: No such file or directory.
in ../sysdeps/i386/dl-trampoline.S
(gdb) thread apply all bt
Thread 2 (Thread 0xb7fe2b70 (LWP 4119)):
#0 0x0012d422 in __kernel_vsyscall ()
#1 0x00859ce6 in nanosleep () at ../sysdeps/unix/syscall-template.S:82
#2 0x00859b10 in __sleep (seconds=0) at ../sysdeps/unix/sysv/linux/sleep.c:138
#3 0x08060715 in ileorThread () at .../src/client/main.cpp:114
#4 0x0806234b in boost::detail::thread_data<void (*)()>::run (this=0x809c950) at /usr/include/boost/thread/detail/thread.hpp:56
#5 0x001407c5 in thread_proxy () from /usr/lib/libboost_thread.so.1.40.0
#6 0x0092196e in start_thread (arg=0xb7fe2b70) at pthread_create.c:300
#7 0x0088fa4e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:130
Thread 1 (Thread 0xb7fe36f0 (LWP 4116)):
#0 _dl_runtime_resolve () at ../sysdeps/i386/dl-trampoline.S:43
#1 0x021570e7 in xcb_connect_to_display_with_auth_info () from /usr/lib/libxcb.so.1
#2 0x0215714c in xcb_connect () from /usr/lib/libxcb.so.1
#3 0x0206c103 in _XConnectXCB () from /usr/lib/libX11.so.6
#4 0x02053f0f in XOpenDisplay () from /usr/lib/libX11.so.6
#5 0x004dad86 in irr::CIrrDeviceLinux::createWindow (this=0x809ccf8) at CIrrDeviceLinux.cpp:342
#6 0x004d9e9f in CIrrDeviceLinux (this=0x809ccf8, param=..., __in_chrg=<value optimized out>, __vtt_parm=<value optimized out>) at CIrrDeviceLinux.cpp:109
#7 0x004e6540 in createDeviceEx (params=...) at Irrlicht.cpp:87
#8 0x004e64f7 in createDevice (driverType=irr::video::EDT_OPENGL, windowSize=..., bits=16, fullscreen=false, stencilbuffer=false, vsync=false, res=0x0) at Irrlicht.cpp:62
#9 0x080646a7 in ClientRenderer (this=0xbffff2ec, c=0x809cb20, w=800, h=600) at .../src/client/ClientRenderer.cpp:46
#10 0x080609be in rendering () at .../src/client/main.cpp:164
#11 0x08060b4d in main () at .../src/client/main.cpp:215
(gdb)
Code: Select all
Irrlicht Engine version 1.7.1
Linux 2.6.32-22-generic #36-Ubuntu SMP Thu Jun 3 22:02:19 UTC 2010 i686
Creating X window...
==4754== Invalid read of size 1
==4754== at 0x80824F2: ??? (in /home/mvanga/Programming/ileor/final/src/client/client)
==4754== by 0x606C14B: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==4754== by 0x5F80102: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==4754== by 0x5F67F0E: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==4754== by 0x43ECD85: irr::CIrrDeviceLinux::createWindow() (CIrrDeviceLinux.cpp:342)
==4754== by 0x43EBE9E: irr::CIrrDeviceLinux::CIrrDeviceLinux(irr::SIrrlichtCreationParameters const&) (CIrrDeviceLinux.cpp:109)
==4754== by 0x43F853F: createDeviceEx (Irrlicht.cpp:87)
==4754== by 0x43F84F6: createDevice (Irrlicht.cpp:62)
==4754== by 0x80645AC: ClientRenderer::ClientRenderer(Client*, int, int) (ClientRenderer.cpp:47)
==4754== by 0x80608EF: rendering() (main.cpp:164)
==4754== by 0x8060A7E: main (main.cpp:215)
==4754== Address 0x3 is not stack'd, malloc'd or (recently) free'd
==4754==
==4754==
==4754== Process terminating with default action of signal 11 (SIGSEGV)
==4754== Access not within mapped region at address 0x3
==4754== at 0x80824F2: ??? (in /home/mvanga/Programming/ileor/final/src/client/client)
==4754== by 0x606C14B: xcb_connect (in /usr/lib/libxcb.so.1.1.0)
==4754== by 0x5F80102: _XConnectXCB (in /usr/lib/libX11.so.6.3.0)
==4754== by 0x5F67F0E: XOpenDisplay (in /usr/lib/libX11.so.6.3.0)
==4754== by 0x43ECD85: irr::CIrrDeviceLinux::createWindow() (CIrrDeviceLinux.cpp:342)
==4754== by 0x43EBE9E: irr::CIrrDeviceLinux::CIrrDeviceLinux(irr::SIrrlichtCreationParameters const&) (CIrrDeviceLinux.cpp:109)
==4754== by 0x43F853F: createDeviceEx (Irrlicht.cpp:87)
==4754== by 0x43F84F6: createDevice (Irrlicht.cpp:62)
==4754== by 0x80645AC: ClientRenderer::ClientRenderer(Client*, int, int) (ClientRenderer.cpp:47)
==4754== by 0x80608EF: rendering() (main.cpp:164)
==4754== by 0x8060A7E: main (main.cpp:215)
==4754== If you believe this happened as a result of a stack
==4754== overflow in your program's main thread (unlikely but
==4754== possible), you can try to increase the size of the
==4754== main thread stack using the --main-stacksize= flag.
==4754== The main thread stack size used in this run was 8388608.
==4754==
==4754== HEAP SUMMARY:
==4754== in use at exit: 110,256 bytes in 171 blocks
==4754== total heap usage: 196 allocs, 25 frees, 113,341 bytes allocated
==4754==
==4754== LEAK SUMMARY:
==4754== definitely lost: 0 bytes in 0 blocks
==4754== indirectly lost: 0 bytes in 0 blocks
==4754== possibly lost: 100,607 bytes in 2 blocks
==4754== still reachable: 9,649 bytes in 169 blocks
==4754== suppressed: 0 bytes in 0 blocks
==4754== Rerun with --leak-check=full to see details of leaked memory
==4754==
==4754== For counts of detected and suppressed errors, rerun with: -v
==4754== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 51 from 8)
Killed