osgearth icon indicating copy to clipboard operation
osgearth copied to clipboard

[MSYS2] osgearth_viewer hangs on exit

Open filnet opened this issue 1 year ago • 3 comments

Hi,

The MSYS2/Mingw64 build of osgearth_viewer hangs on exit when, apparently, destroying the JobArena.

More details (including backtraces) can be found here : https://github.com/msys2/MINGW-packages/issues/12726

filnet avatar Aug 22 '22 13:08 filnet

Most significant result so far is this back trace that shows where the hang occurs:

(gdb) n
osgEarth::Threading::JobArena::~JobArena (this=0x26e01962460, __in_chrg=<optimized out>) at D:/MINGW-packages-mmuetzel/mingw-w64-osgearth/src/osgearth/src/osgEarth/Threading.cpp:538
538     }
(gdb) thread apply all bt

Thread 1 (Thread 3032.0x27fc):
#0  osgEarth::Threading::JobArena::~JobArena (this=0x26e01962460, __in_chrg=<optimized out>) at D:/MINGW-packages-mmuetzel/mingw-w64-osgearth/src/osgearth/src/osgEarth/Threading.cpp:538
#1  0x00007fffd936d0fe in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x26e01962450) at C:/msys64/mingw64/include/c++/12.2.0/bits/shared_ptr_base.h:346
#2  std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x26e01962450) at C:/msys64/mingw64/include/c++/12.2.0/bits/shared_ptr_base.h:317
#3  std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=0x26e0164d6a0, __in_chrg=<optimized out>) at C:/msys64/mingw64/include/c++/12.2.0/bits/shared_ptr_base.h:1071
#4  std::__shared_ptr<osgEarth::Threading::JobArena, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (this=0x26e0164d698, __in_chrg=<optimized out>) at C:/msys64/mingw64/include/c++/12.2.0/bits/shared_ptr_base.h:1524
#5  std::shared_ptr<osgEarth::Threading::JobArena>::~shared_ptr (this=0x26e0164d698, __in_chrg=<optimized out>) at C:/msys64/mingw64/include/c++/12.2.0/bits/shared_ptr.h:175
#6  std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> >::~pair (this=0x26e0164d678, __in_chrg=<optimized out>) at C:/msys64/mingw64/include/c++/12.2.0/bits/stl_pair.h:185
#7  std::__new_allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> >, true> >::destroy<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> > > (__p=0x26e0164d678, this=<optimized out>) at C:/msys64/mingw64/include/c++/12.2.0/bits/new_allocator.h:181
#8  std::allocator_traits<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> >, true> > >::destroy<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> > > (__p=0x26e0164d678, __a=...) at C:/msys64/mingw64/include/c++/12.2.0/bits/alloc_traits.h:535
#9  std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> >, true> > >::_M_deallocate_node (__n=0x26e0164d670, this=<optimized out>) at C:/msys64/mingw64/include/c++/12.2.0/bits/hashtable_policy.h:1984
#10 std::__detail::_Hashtable_alloc<std::allocator<std::__detail::_Hash_node<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> >, true> > >::_M_deallocate_nodes (this=0x7fffd982be00 <osgEarth::Threading::JobArena::_arenas[abi:cxx11]>, __n=0x26e01640420) at C:/msys64/mingw64/include/c++/12.2.0/bits/hashtable_policy.h:2006
#11 std::_Hashtable<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> > >, std::__detail::_Select1st, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<true, false, true> >::clear (this=this@entry=0x7fffd982be00 <osgEarth::Threading::JobArena::_arenas[abi:cxx11]>) at C:/msys64/mingw64/include/c++/12.2.0/bits/hashtable.h:2500
#12 0x00007fffd8f8d4b2 in std::unordered_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<osgEarth::Threading::JobArena>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::shared_ptr<osgEarth::Threading::JobArena> > > >::clear (this=0x7fffd982be00 <osgEarth::Threading::JobArena::_arenas[abi:cxx11]>) at C:/msys64/mingw64/include/c++/12.2.0/bits/unordered_map.h:790
#13 osgEarth::Threading::JobArena::shutdownAll () at D:/MINGW-packages-mmuetzel/mingw-w64-osgearth/src/osgearth/src/osgEarth/Threading.cpp:551
--Type <RET> for more, q to quit, c to continue without paging--c
#14 0x00007fffd92328ac in _execute_onexit_table (table=0x7fffd9828000 <atexit_table>) from C:\msys64\mingw64\bin\libosgEarthd.dll
#15 0x00007fffd8d2114c in _CRT_INIT (hDllHandle=hDllHandle@entry=0x7fffd8d20000, dwReason=dwReason@entry=0, lpreserved=lpreserved@entry=0x1) at C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:130
#16 0x00007fffd8d212e4 in __DllMainCRTStartup (hDllHandle=0x7fffd8d20000, dwReason=0, lpreserved=0x1) at C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtdll.c:195
#17 0x00007ff8a5640277 in ntdll!RtlActivateActivationContextUnsafeFast () from C:\Windows\SYSTEM32\ntdll.dll
#18 0x00007ff8a565486c in ntdll!LdrShutdownProcess () from C:\Windows\SYSTEM32\ntdll.dll
#19 0x00007ff8a565465d in ntdll!RtlExitUserProcess () from C:\Windows\SYSTEM32\ntdll.dll
#20 0x00007ff8a402c66b in KERNEL32!ExitProcess () from C:\Windows\System32\kernel32.dll
#21 0x00007ff8a4b3d14d in msvcrt!_exit () from C:\Windows\System32\msvcrt.dll
#22 0x00007ff8a4b3d7cb in msvcrt!_initterm_e () from C:\Windows\System32\msvcrt.dll
#23 0x00007ff7ed4e14ad in __tmainCRTStartup () at C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:332
#24 0x00007ff7ed4e14e6 in mainCRTStartup () at C:/M/mingw-w64-crt-git/src/mingw-w64/mingw-w64-crt/crt/crtexe.c:206
(gdb) n

filnet avatar Aug 22 '22 13:08 filnet

Issue seems to be specific to MYS2/Mingw64...

filnet avatar Aug 22 '22 16:08 filnet

Possibly related to #1827

gwaldron avatar Aug 22 '22 16:08 gwaldron