Unity-Technologies / com.unity.webrtc

WebRTC package for Unity
Other
760 stars 198 forks source link

[BUG]: Issues in standalone when going from M92 to M107 #878

Open kcarlson opened 1 year ago

kcarlson commented 1 year ago

Package version

3.0.0-pre.2

Environment

* OS: Ubuntu 20.04.5 LTS
* Unity version: 2021.3.17f1
Working release: 3.0.0-pre.1, fails in 3.0.0-pre.2

Steps To Reproduce

  1. Include and invoke a c++ library which includes a reference to https://www.commonvisionblox.com/en/download-cvb-linux/
  2. Call Cvb::DeviceFactory::Discover

Current Behavior

Crashes in standalone, works fine in editor. Standalone stack:

Caught fatal signal - signo:-1140744496 code:-813736208 errno:32629 addr:0x2
Obtained 27 stack frames.
#0  0x007f7835d74090 in killpg
#1  0x007f78378c04b6 in block_merge_next
#2  0x007f78378c0313 in tlsf_free
#3  0x007f7836ae4301 in DynamicHeapAllocator::Deallocate(void*)
#4  0x007f7836aeaf1e in DualThreadAllocator<DynamicHeapAllocator>::TryDeallocate(void*)
#5  0x007f7836ae512c in MemoryManager::Deallocate(void*, MemLabelId, char const*, int)
#6  0x007f75b670a6fc in std::istreambuf_iterator<char, std::char_traits<char> >::equal(std::istreambuf_iterator<char, std::char_traits<char> > const&) const
#7  0x007f75b66fcbc8 in DevOpenDataStream
#8  0x007f75b66fd973 in GCInitLib
#9  0x007f779d4bdcfe in std::__cxx11::_List_base<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >::_M_clear()
#10 0x007f779d49865f in std::pair<std::_Rb_tree_iterator<unsigned long>, bool> std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>, std::allocator<unsigned long> >::_M_insert_unique<unsigned long const&>(unsigned long const&)
#11 0x007f779d499708 in std::pair<std::_Rb_tree_iterator<unsigned long>, bool> std::_Rb_tree<unsigned long, unsigned long, std::_Identity<unsigned long>, std::less<unsigned long>, std::allocator<unsigned long> >::_M_insert_unique<unsigned long const&>(unsigned long const&)
#12 0x007f779d467d54 in CVFFactoryCreate
#13 0x007f779dcb5887 in std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >* std::_Rb_tree<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >, std::less<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > >::_M_copy<std::_Rb_tree<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >, std::less<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > >::_Alloc_node>(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const*, std::_Rb_tree_node_base*, std::_Rb_tree<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >, std::less<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > >::_Alloc_node&)
#14 0x007f779dcb698a in std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >* std::_Rb_tree<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >, std::less<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > >::_M_copy<std::_Rb_tree<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >, std::less<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > >::_Alloc_node>(std::_Rb_tree_node<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > const*, std::_Rb_tree_node_base*, std::_Rb_tree<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >, std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::_Select1st<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > >, std::less<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > >, std::allocator<std::pair<std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > const, std::__cxx11::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> > > > >::_Alloc_node&)
#15 0x007f779dc9f33c in DODiscoverW
#16 0x007f779dc9f615 in DODiscover
#17 0x007f779ddbbc5c in std::vector<Cvb::V_1_6::Driver::DiscoveryInformation, std::allocator<Cvb::V_1_6::Driver::DiscoveryInformation> > Cvb::V_1_6::DeviceFactory::Discover<long, std::ratio<1l, 1000l> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Cvb::V_1_6::Driver::DiscoverFlags, std::chrono::duration<long, std::ratio<1l, 1000l> > const&)
#18 0x007f779dda9113 in GetDevices
#19 0x00000041ea20e3 in (wrapper managed-to-native) Ocellus.Gigecam.Cvb.CVBLibWrapper:GetDevices (Ocellus.Gigecam.Cvb.DiscoveryInformation[]&,int&)
#20 0x00000041ea1df4 in Ocellus.Gigecam.Discovery.DiscoveryHelperLinux:GetDevices ()
#21 0x00000041ea1ae8 in Ocellus.Gigecam.Discovery.DiscoveryHelper:GetDevice (string,string&,string&)
#22 0x00000041e9e90f in System.Runtime.CompilerServices.AsyncMethodBuilderCore/MoveNextRunner:InvokeMoveNext (object)
#23 0x00000041c97274 in System.Threading.ExecutionContext:Run (System.Threading.ExecutionContext,System.Threading.ContextCallback,object,bool)
#24 0x00000041e9e5e3 in System.Threading.Tasks.AwaitTaskContinuation:RunOrScheduleAction (System.Action,bool,System.Threading.Tasks.Task&)
#25 0x00000041df0b60 in System.Threading.Tasks.Task:FinishContinuations ()
#26 0x00000041df0a00 in System.Threading.Tasks.Task:FinishStageThree ()

Expected Behavior

Standalone should work the same as editor.

This is an extreme edge case, just wondering what changed in that transition? I feel like there is some sort of dependency collision or possibly something related to the C++ ABI

Anything else?

Reverting to 3.0.0-pre.1, unfortunately we want to use render streaming, and only the latest works for us and points to the wrong version. Tried to get it to work with 3.0.0-pre.1 and was getting some issues, figured i'd ask here in case there was anything obvious i've missed. Thanks!

karasusan commented 1 year ago

@kcarlson I'm not familer CVB software. It sounds strange the combination of middleware occurs crash. You mean the crash is not occreed when using 3.0.0-pre.1?

kcarlson commented 1 year ago

Yes, it's an obscure case. It's software for interacting with cameras using GigE Vision standards Correct, I have no issues in standalone when using 3.0.0-pre.1 and as soons as i switch to 3.0.0-pre.2 it only breaks in standalone mode (still works in the editor). Also, if i remove the libwebrtc.so from the standalone, everything works, expect of course webtrc.

karasusan commented 1 year ago

@kcarlson Thank you for sharing details. As you said, I assume something related to the C++ ABI occurs this problem.

kannan-xiao4 commented 1 year ago

memo: WRS-460

doctorpangloss commented 1 year ago

You can try recompiling libwebrtc on your toolchain, the scripts are good.