Re: [osg-users] Debugging example hangs in Cygwin and need some insight into cygwin_osgdb_osg.dll
El Jueves 29 Mayo 2008ES 22:06:09 Brian Keener escribió: Alberto Luaces wrote: This almost seems as if iot has something to do with the actually writing of the osg file when it writes the data and then something not terminating as it should. I think this could be a non-valid example, because osgDB::DynamicLibrary on UNIX (including Cygwin) only loads symbols when needed (it opens them with the RTLD_LAZY specifier), so the OSG's plugin register could realize the mismatch before trying to load any symbols from the DLL. Alberto, I'm not sure I understand. Are you saying that even though the debug messages say that the dll was opened that there are still parts of the dll whcih have not been loaded and that it is within these areas (when they are finally loaded) that the interaction with cygwin causing the hang ultimately makes itself visible? Thus the simple fact of open and closing the dll does nothing that helps us unless we can get to the point of something occurring which causes the parts of the dll we need to be loaded. Not really sure how to ask what I wrote above so I hope you can understand what I am asking. Brian, yes, this is what I meant. To load a dynamic symbol you have first to open the DLL file containing it, and then load it explicitly before use (if you used RTLD_LAZY). The source code at DynamicLibrary.cpp shows this. This can explain why it hangs depending on the data file loaded. I think we could search for the differences between the .osg plugin and the well-behaved others. Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Debugging example hangs in Cygwin and need some insight into cygwin_osgdb_osg.dll
Alberto Luaces wrote: yes, this is what I meant. To load a dynamic symbol you have first to open the DLL file containing it, and then load it explicitly before use (if you used RTLD_LAZY). The source code at DynamicLibrary.cpp shows this. This can explain why it hangs depending on the data file loaded. Good - glad I understand. I think we could search for the differences between the .osg plugin and the well-behaved others. The interesting thing is I have only been able (in Cygwin) to get it to process osg and build a .osg or .ive file. I have been unable to get it to do anything with .gif .bmp .jpg or others like that - I always get the Error no data loaded message and then it terminates cleanly so based on that I cannot swear it would perform cleanly with other type files - it may be as you say that since it never uses a file it quits cleanly but when it does use a file like .osg to .osg or osg to .ive it hangs. Can someone give me an example of osg to gif or jpg or gif to bmp or bmp to gif or something (proper syntax a must) that should work that I can use as a test. Thanks bk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Debugging example hangs in Cygwin and need some insight into cygwin_osgdb_osg.dll
Alberto Luaces wrote: This almost seems as if iot has something to do with the actually writing of the osg file when it writes the data and then something not terminating as it should. I think this could be a non-valid example, because osgDB::DynamicLibrary on UNIX (including Cygwin) only loads symbols when needed (it opens them with the RTLD_LAZY specifier), so the OSG's plugin register could realize the mismatch before trying to load any symbols from the DLL. Alberto, I'm not sure I understand. Are you saying that even though the debug messages say that the dll was opened that there are still parts of the dll whcih have not been loaded and that it is within these areas (when they are finally loaded) that the interaction with cygwin causing the hang ultimately makes itself visible? Thus the simple fact of open and closing the dll does nothing that helps us unless we can get to the point of something occurring which causes the parts of the dll we need to be loaded. Not really sure how to ask what I wrote above so I hope you can understand what I am asking. bk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Debugging example hangs in Cygwin and need some insight into cygwin_osgdb_osg.dll
El Martes 27 Mayo 2008ES 21:44:03 Brian Keener escribió: This almost seems as if iot has something to do with the actually writing of the osg file when it writes the data and then something not terminating as it should. I think this could be a non-valid example, because osgDB::DynamicLibrary on UNIX (including Cygwin) only loads symbols when needed (it opens them with the RTLD_LAZY specifier), so the OSG's plugin register could realize the mismatch before trying to load any symbols from the DLL. Alberto ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Debugging example hangs in Cygwin and need some insight into cygwin_osgdb_osg.dll
Robert Osfield wrote: The bug certainly seems to be a cygwin bug, unless the OSG's handle is being corrupted for some reason. This code works fine on other platforms so I wouldn't expect the later to be an issue. Perhaps you could write a small example that just loadeds the osg plugin, then unloads it all using dlopen/dlclose calls directly rather than using osgDB/osgconv, this would isolate the problem to just standard unix calls. I was going to try that but here is another interesting catch - if I do: osgconvd cow.osg brian.osg (or the equivalent in the debugger) I get the hang as I documented but If I do: osgconvd cow.osg brian.jpg or osgconvd test.jpg brian.cow I simply get a message: Error no data loaded. This almost seems as if iot has something to do with the actually writing of the osg file when it writes the data and then something not terminating as it should. bk ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
Re: [osg-users] Debugging example hangs in Cygwin and need some insight into cygwin_osgdb_osg.dll
HI Brian, Good detective work, looks like you are now much closer to characterising the bug. The bug certainly seems to be a cygwin bug, unless the OSG's handle is being corrupted for some reason. This code works fine on other platforms so I wouldn't expect the later to be an issue. Perhaps you could write a small example that just loadeds the osg plugin, then unloads it all using dlopen/dlclose calls directly rather than using osgDB/osgconv, this would isolate the problem to just standard unix calls. Robert. On Wed, May 21, 2008 at 10:17 PM, Brian Keener [EMAIL PROTECTED] wrote: Hello folks. I just can't seem to leave this alone and now I need a little insight. As has been reported before when trying to use OSG on Cygwin we experience some hangs and I believe this has been confirmed by Alberto Luaces. Working with debug version of the Cygwin Dll and debug version of OSG and then gdb I have acquired some understanding of where the hang is but now need some advice to how to move further. Robert suggested before using a simple test case of osgconv so that is what I have been working with and it seems the hangs are a result of the cygwin_osgdb_osg.dll plugin. From my test cases (and I have not tested all examples ) it seems that if cygwin_osgdb_gif.dll, cygwin_osgdb_jpg.dll, or cygwin_osgdb_rgb.dll for example (these are all I have looked at) are the only dll loaded then there is no hang but if cygwin_osgdb_osg.dll is used I can the hang when this dll is attempted to be closed. My example is using gbd and osgconvd (debug version) as in: OSG_NOTIFY_LEVEL=INFO; export OSG_NOTIFY_LEVEL gdb osgconvd while in gdb I do set args cow.osg brian.osg so I am attempting convert cow.osg to brian.osg I set my breakpoint such that I can see and check the DynamicLibrary.cpp opens and closes and with my Notify set to INFO I can see in this example that cygwin_osgdb_osg.dll gets opened first and then cygwin_osgdb_rgb.dll. When I hit my breakpoint on the close after the data has been written to brian.osg I see it is closing in the same order it opened so it closes cygwin_osgdb_osg.dll first (or would if it didn't hang on the close) and then it would close cygwin_osgdb_rgb.dll. Thinking that maybe this should be handle in a LIFO format I modified the open logic to do an dlList.insert instead of a dlList.push_back and tried again. Now it does successfully close cygwin_osgdb_rgb.dll but again when it get to the close for cygwin_osgdb_osg.dll it hangs. I have traced the hang to the line in dlfcn.cc which is part of Cygwin and I would think something has not closed that cygwin_osgdb_osg.dll needs to have closed before it can since some of the others seem to close properly but I can I find what is left open. GDB dies eventually terminate on it own and below is the last of the stepping from gdb. Looking for additional thoughts bk Closing DynamicLibrary osgPlugins-2.4.0/cygwin_osgdb_osg.dll osgDB::DynamicLibrary::~DynamicLibrary (this=0x110cc470) at /usr/src/OpenSceneGraph/src/osgDB/DynamicLibrary.cpp:69 69 dlclose(_handle); (gdb) s 0x610b3662 in _sigfe_dlclose () at /usr/develop/src/src/src/winsup/cygwin/cygerrno.h:31 31debug_printf (%s:%d val %d, fn, ln, val); (gdb) s dlclose (handle=0x23c9c8) at /usr/develop/src/src/src/winsup/cygwin/dlfcn.cc:141 141 { (gdb) s Breakpoint 7, dlclose (handle=0x610b2c98) at /usr/develop/src/src/src/winsup/cygwin/dlfcn.cc:142 142 int ret = -1; (gdb) s 143 if (handle == GetModuleHandle (NULL) || FreeLibrary ((HMODULE) handle) ) (gdb) print handle $7 = (void *) 0x89a (gdb) s 1175829803 [main] osgconvd 3268 sig_send: wait for sig_complete event failed, si gnal 6, rc 258, Win32 error 0 Program exited with code 03000. (gdb) ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org ___ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org