[Dashing] Crashing when initialising ROS2 from shared object lib

asked 2020-06-14 15:57:34 -0500

bn87 gravatar image

Hi all,

For the context: I'm working on a Unity3d project, which aims to utilize ROS2 functionality to publish some synthetic images via ROS2 network. As for the approach, I have built a simple wrapper, that exposes the call to init ROS2, create publisher, and image-publishing functions. This wrapper is compiled as a shared object library. Inside the Unity3d script, the .so lib will be loaded via DllImport, then the calls to the functions will be triggered according. This approach has been working fine for me with ROS2 crystal. Now, I have to switch to ROS2 dashing. But using the same approach doesn't work anymore, it crashed directly when I tried to call rclcpp::init(). I could get some traces from Unity3d log (unfortunately, this is the only trace that I managed to get). It looks as following:

#0  0x0000000756e890 in funlockfile
#1  0x000000078e4d60 in __nss_passwd_lookup
#2  0x000000060e0bda in getrn
#3  0x000000060e0f10 in lh_insert
#4  0x000000060b67d7 in OBJ_NAME_add
#5  0x0000005ea32e5e in ERR_load_SSL_strings
#6  0x0000000756b827 in __pthread_once_slow
#7  0x0000005ee6b8f9 in CRYPTO_THREAD_run_once
#8  0x0000005ea3307b in OPENSSL_init_ssl
#9  0x0000005e06df6e in asio::ssl::detail::openssl_init_base::instance()
#10 0x0000005df728f4 in _init
#11 0x00000004010733 in _dl_rtld_di_serinfo
#12 0x000000040151ff in _dl_find_dso_for_object
#13 0x000000078e22df in _dl_catch_exception
#14 0x000000040147ca in _dl_find_dso_for_object
#15 0x00000007b6cf96 in (Unknown)
#16 0x000000078e22df in _dl_catch_exception
#17 0x000000078e236f in _dl_catch_error
#18 0x00000007b6d735 in dlerror
#19 0x00000007b6d051 in dlopen
#20 0x000000440bf290 in Poco::SharedLibraryImpl::loadImpl(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, int)
#21 0x000000440bf552 in Poco::SharedLibrary::SharedLibrary(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)
#22 0x00000042924723 in _init
#23 0x00000042924a02 in _init
#24 0x00000042924c1c in rmw_init_options_init
#25 0x00000041915bcf in rcl_init_options_init
#26 0x00000041652927 in rclcpp::InitOptions::InitOptions(rcutils_allocator_t)
#27 0x000000413a10ae in init_ros
#28 0x0000000f895bec in (wrapper managed-to-native) HiResScreenShots_linux:init_ros ()
#29 0x00000040683505 in mono_print_method_from_ip
#30 0x000000407f25c3 in mono_perfcounter_foreach
#31 0x000000407f3470 in mono_runtime_invoke
#32 0x0000000597ce12 in scripting_method_invoke(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingArguments&, ScriptingExceptionPtr*, bool)
#33 0x0000000597b1ea in ScriptingInvocation::Invoke(ScriptingExceptionPtr*, bool)
#34 0x00000005962906 in MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr, ScriptingExceptionPtr*)
#35 0x00000005962a13 in MonoBehaviour::InvokeMethodOrCoroutineChecked(ScriptingMethodPtr, ScriptingObjectPtr)
#36 0x00000005961179 in MonoBehaviour::DelayedStartCall(Object*, void*)
#37 0x000000056d0282 in DelayedCallManager::Update(int)
#38 0x0000000583a58e in ExecutePlayerLoop(NativePlayerLoopSystem*)
#39 0x0000000583a5d1 in ExecutePlayerLoop(NativePlayerLoopSystem*)
#40 0x0000000583aaea in PlayerLoop()
#41 0x000000059d4874 in PlayerMain(int, char**)
#42 0x0000000779cb97 in __libc_start_main
#43 0x00000000400569 in _start

We could observe, that at trace #27 and #28, the wrapper to init_ros is triggered. In then goes along with rcl_init.., rmw_init.., then the problem arises if I'm not mistaken when Poco::sharedLibrary is triggered (Trace #18, #19 showed a dlerror). I'm not sure what exactly caused this issue, and for what purpose Poco::SharedLibrary is triggered here. As I mentioned before, the same approach was working fine for crystal. Something under the hood of dashing has changed. I'm currently struggling at this point. It seems to be dynamic linking problem from dashing, but I'm not sure how to proceed. I would appreciate it very much if someone has a hint for me, what could be the cause, or an idea how to ... (more)

edit retag flag offensive close merge delete