Apache OpenOffice (AOO) Bugzilla – Issue 123001
OS/2 sys 3170 when application exits
Last modified: 2014-02-10 09:30:46 UTC
A stack exception is raised on most exits. vcl layer is already closed. stack is corrupted.
This issue is related to two different bugs: 1) in pthread emulation, destroy of mutex leaves it in wrong state, fixed in ports svn at netlabs.org; 2) threads are killed before dll unloading (affects SAL3 cache thread). Bug #2 has been difficult to discover. SAL3 starts a thread for cache monitoring using at dll loading using global constructor. Then it declares a function as __attribute__(destructor) to call it on unloading. But when the main process exits with exit(), the runtime in the end calls DosExit and then unloads dlls. But DosExit kills all running threads, so the destructor function does not find the running thread. The solution is to declare such function in atexit.
Using atexit() make the function to be called from exit() handling before calling DosExit, thus the thread is still alive.
"ydario" committed SVN revision 1539964 into trunk: i123001 - force destructor to be called before libc calls DosExit().
"ydario" committed SVN revision 1539965 into trunk: i123001 - force destructor to be called before libc calls DosExit().
The same tecnique is not necessary with alloc_arena, alloc_global and locale since they do not start threads and calling them at unloading time is fine.