On Friday 13 May 2011 11:03:24 Anders Gidenstam wrote:

> Presumably it will also increase the risk of triggering any race condition
> and/or unsynchronized data access bugs that may be lurking in the code.
> There are some known ones (e.g. during the creation of a particle
> system) but there could easily be more.
> 
> In this case you should investigate the arguments and locals in the
> different stack frames to see if you can see something looking bad.

Stack looks quite fine and it does not feel like a race condition to me. It's 
100% reproducable and always in the same place and adding a sleep here and 
there does not change anything. Well everything looks fine except for the big 
picture. There are two threads running. One running OSG rendering stuff and the 
other FG's main loop. The segfault happens when the main loop thread tries to 
access GL information. I know next to nothing about openGL programming but I 
seem to recall that it's not allowed to access the same GL context in different 
threads. So how is this supposed to work?

(gdb) thread apply all bt

Thread 2 (Thread 0x7fffec712700 (LWP 15449)):
#0  0x00007ffff7bcd38c in pthread_cond_wait@@GLIBC_2.3.2 () from 
/lib64/libpthread.so.0
#1  0x00007ffff3a4021d in OpenThreads::Condition::wait(OpenThreads::Mutex*) () 
from /usr/local/lib64/libOpenThreads.so.12
#2  0x00007ffff4dc2d3b in osgViewer::Renderer::ThreadSafeQueue::takeFront() () 
from /usr/local/lib64/libosgViewer.so.76
#3  0x00007ffff4dc3506 in osgViewer::Renderer::draw() () from 
/usr/local/lib64/libosgViewer.so.76
#4  0x00007ffff3de291e in osg::GraphicsContext::runOperations() () from 
/usr/local/lib64/libosg.so.76
#5  0x00007ffff3e3693a in osg::OperationThread::run() () from 
/usr/local/lib64/libosg.so.76
#6  0x00007ffff3de4a88 in osg::GraphicsThread::run() () from 
/usr/local/lib64/libosg.so.76
#7  0x00007ffff3a3fd90 in OpenThreads::ThreadPrivateActions::StartThread(void*) 
() from /usr/local/lib64/libOpenThreads.so.12
#8  0x00007ffff7bc8a3f in start_thread () from /lib64/libpthread.so.0
#9  0x00007ffff328267d in clone () from /lib64/libc.so.6
#10 0x0000000000000000 in ?? ()

Thread 1 (Thread 0x7ffff7fa7760 (LWP 15446)):
#0  glGetString () at glapi_x86-64.S:9877
#1  0x0000000000abe70a in SGIsOpenGLExtensionSupported (extName=0xbe7cda 
"GL_ARB_texture_env_combine") at extensions.cxx:64
#2  0x00000000009687cc in SGCloudLayer::rebuild (this=0x7fffe31785b0) at 
cloud.cxx:389
#3  0x0000000000967d0b in SGCloudLayer::SGCloudLayer (this=0x7fffe31785b0, 
tex_path=...) at cloud.cxx:210
#4  0x00000000004357c4 in fgIdleFunction () at main.cxx:424
#5  0x00000000004a1d8e in fgOSMainLoop () at fg_os_osgviewer.cxx:284
#6  0x0000000000436903 in fgMainInit (argc=1, argv=0x7fffffffdbd8) at 
main.cxx:659
#7  0x0000000000433899 in main (argc=1, argv=0x7fffffffdbd8) at 
bootstrap.cxx:243

Cheers,
Stefan

------------------------------------------------------------------------------
vRanger cuts backup time in half-while increasing security.
With the market-leading solution for virtual backup and recovery, 
you get blazing-fast, flexible, and affordable data protection.
Download your free trial now. 
http://p.sf.net/sfu/quest-d2dcopy1
_______________________________________________
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel

Reply via email to