Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when using nmos-cpp through conan package #339

Open
thomasdethier opened this issue Jun 29, 2023 · 3 comments
Open

Segmentation fault when using nmos-cpp through conan package #339

thomasdethier opened this issue Jun 29, 2023 · 3 comments

Comments

@thomasdethier
Copy link

Hello,

I am currently developping a C++ application using the nmos-cpp conan package. I did a really simple node-implementation just to test that my node is up and can connect to my registry.

When I try to run my application I get a segmentation fault at the node server start (when I call node_server.open().wait();). It seems it comes from cpp-rest.

To quickly check if my code was responsible for this error, I've tried running the nmos-cpp node example present in the official repo with the conan package. I was surprised to also get a segmentation fault. I didn't have the error when running the node implementation example with directly using nmos-cpp source code and not the conan package.

Is the conan package still up to date with the official node implementation ? Is this a known bug ?

If you need more context, I'll be happy to provide any information that should be required.

@dk-macnica
Copy link

dk-macnica commented Oct 24, 2023

Hello,

I'm seeing the same issue in nmos-cpp-node. The weird thing is that this problem is present only under new ubuntu users, it works fine under users which existed for a long time (and under which nmos node has been run before). It looks like some conan package got updated, so when conan downloads it from scratch nmos-cpp-node starts to fail in Debug and freezes in Release mode.

Here is full backtrace of segmentation fault:

#0  0x00005555556d5d2f in boost::asio::detail::op_queue_access::next<boost::asio::detail::scheduler_operation, boost::asio::detail::scheduler_operation> (
    o1=@0x5555567dddf8: 0x2800000000, o2=0x5555569a8440)
    at /home/testuser/.conan/data/boost/1.80.0/_/_/package/a77ca77d437f4354bdec12173c1a0c2b8b7d01f4/include/boost/asio/detail/op_queue.hpp:41
#1  0x00005555556ce453 in boost::asio::detail::op_queue<boost::asio::detail::scheduler_operation>::push (this=0x5555567dddf0, h=0x5555569a8440)
    at /home/testuser/.conan/data/boost/1.80.0/_/_/package/a77ca77d437f4354bdec12173c1a0c2b8b7d01f4/include/boost/asio/detail/op_queue.hpp:110
#2  0x00005555556b78ae in boost::asio::detail::scheduler::post_immediate_completion (this=0x5555567ddd10, op=0x5555569a8440, is_continuation=false)
    at /home/testuser/.conan/data/boost/1.80.0/_/_/package/a77ca77d437f4354bdec12173c1a0c2b8b7d01f4/include/boost/asio/detail/impl/scheduler.ipp:364
#3  0x0000555555db7168 in boost::asio::io_context::initiate_post::operator()<boost::_bi::bind_t<void, void (*)(void*), boost::_bi::list1<boost::_bi::value<void*> > > > (
    this=0x7fffffffce4f, handler=..., self=0x555556794b68 <(anonymous namespace)::initialize_shared_threadpool(unsigned long)::uninit_threadpool+8>)
    at /home/conan/w/BuildSingleReference/.conan/data/boost/1.76.0/_/_/package/a77ca77d437f4354bdec12173c1a0c2b8b7d01f4/include/boost/asio/impl/io_context.hpp:191
#4  0x0000555555db7078 in boost::asio::async_result<boost::_bi::bind_t<void, void (*)(void*), boost::_bi::list1<boost::_bi::value<void*> > >, void ()>::initiate<boost::asio::io_context::initiate_post, boost::_bi::bind_t<void, void (*)(void*), boost::_bi::list1<boost::_bi::value<void*> > >, boost::asio::io_context*>(boost::asio::io_context::initiate_post&&, boost::_bi::bind_t<void, void (*)(void*), boost::_bi::list1<boost::_bi::value<void*> > >&&, boost::asio::io_context*&&) (initiation=..., token=..., 
    args#0=@0x7fffffffce50: 0x555556794b68 <(anonymous namespace)::initialize_shared_threadpool(unsigned long)::uninit_threadpool+8>)
    at /home/conan/w/BuildSingleReference/.conan/data/boost/1.76.0/_/_/package/a77ca77d437f4354bdec12173c1a0c2b8b7d01f4/include/boost/asio/async_result.hpp:152
#5  0x0000555555db7024 in boost::asio::async_initiate<boost::_bi::bind_t<void, void (*)(void*), boost::_bi::list1<boost::_bi::value<void*> > >, void (), boost::asio::io_context::initiate_post, boost::asio::io_context*>(boost::asio::io_context::initiate_post&&, boost::_bi::bind_t<void, void (*)(void*), boost::_bi::list1<boost::_bi::value<void*> > >&, boost::asio::io_context*&&) (initiation=..., token=..., args#0=@0x7fffffffce50: 0x555556794b68 <(anonymous namespace)::initialize_shared_threadpool(unsigned long)::uninit_threadpool+8>)
    at /home/conan/w/BuildSingleReference/.conan/data/boost/1.76.0/_/_/package/a77ca77d437f4354bdec12173c1a0c2b8b7d01f4/include/boost/asio/async_result.hpp:365
#6  0x0000555555db6f60 in boost::asio::io_context::post<boost::_bi::bind_t<void, void (*)(void*), boost::_bi::list1<boost::_bi::value<void*> > > > (
    this=0x555556794b68 <(anonymous namespace)::initialize_shared_threadpool(unsigned long)::uninit_threadpool+8>, handler=...)
    at /home/conan/w/BuildSingleReference/.conan/data/boost/1.76.0/_/_/package/a77ca77d437f4354bdec12173c1a0c2b8b7d01f4/include/boost/asio/impl/io_context.hpp:200
#7  0x0000555555db6b76 in pplx::details::linux_scheduler::schedule (this=0x55555693a190, proc=0x5555556545c1 <pplx::details::_TaskProcHandle::_RunChoreBridge(void*)>, 
    param=0x5555569c1780)
    at /home/conan/w/BuildSingleReference/.conan/data/cpprestsdk/2.10.18/_/_/build/cf242e70f5ea369f0e64dae39424b17c2e0664d7/source_subfolder/Release/src/pplx/pplxlinux.cpp:38
#8  0x00005555556547ab in pplx::details::_TaskCollectionImpl::_ScheduleTask (this=0x55555694ade0, _PTaskHandle=0x5555569c1780, _InliningMode=pplx::details::_NoInline)
    at /home/testuser/.conan/data/cpprestsdk/2.10.18/_/_/package/cf242e70f5ea369f0e64dae39424b17c2e0664d7/include/pplx/pplx.h:146
#9  0x000055555565562f in pplx::details::_Task_impl_base::_ScheduleTask (this=0x55555694ad80, _PTaskHandle=0x5555569c1780, _InliningMode=pplx::details::_NoInline)
    at /home/testuser/.conan/data/cpprestsdk/2.10.18/_/_/package/cf242e70f5ea369f0e64dae39424b17c2e0664d7/include/pplx/pplxtasks.h:1964
#10 0x00005555559f5c21 in pplx::task<unsigned char>::_TaskInitWithFunctor<void, nmos::server::open()::<lambda()> >(const nmos::server::<lambda()> &) (this=0x7fffffffd0d0, 
    _Func=...) at /home/testuser/.conan/data/cpprestsdk/2.10.18/_/_/package/cf242e70f5ea369f0e64dae39424b17c2e0664d7/include/pplx/pplxtasks.h:4155
#11 0x00005555559f5699 in pplx::task<void>::_TaskInitMaybeFunctor<nmos::server::open()::<lambda()> >(nmos::server::<lambda()> &, std::true_type) (this=0x7fffffffd0d0, _Func=...)
    at /home/testuser/.conan/data/cpprestsdk/2.10.18/_/_/package/cf242e70f5ea369f0e64dae39424b17c2e0664d7/include/pplx/pplxtasks.h:4755
#12 0x00005555559f4cab in pplx::task<void>::task<nmos::server::open()::<lambda()> >(nmos::server::<lambda()>, const pplx::task_options &) (this=0x7fffffffd0d0, _Param=..., 
    _TaskOptions=...) at /home/testuser/.conan/data/cpprestsdk/2.10.18/_/_/package/cf242e70f5ea369f0e64dae39424b17c2e0664d7/include/pplx/pplxtasks.h:4408
#13 0x00005555559f4816 in pplx::create_task<nmos::server::open()::<lambda()> >(nmos::server::<lambda()>, pplx::task_options) (_Param=..., _TaskOptions=...)
    at /home/testuser/.conan/data/cpprestsdk/2.10.18/_/_/package/cf242e70f5ea369f0e64dae39424b17c2e0664d7/include/pplx/pplxtasks.h:4886
#14 0x00005555559f3b74 in nmos::server::open (this=0x7fffffffd280) at /home/testuser/nmos-cpp/Development/nmos/server.cpp:12
#15 0x000055555560085f in pplx::open_close_guard<nmos::server>::open_close_guard (this=0x7fffffffd230, t=...) at /home/testuser/nmos-cpp/Development/pplx/pplx_utils.h:255
#16 0x00005555555e5fb9 in main (argc=1, argv=0x7fffffffe3b8) at /home/testuser/nmos-cpp/Development/nmos-cpp-node/main.cpp:143

Temporary fix which worked out for me:
Removed ~/.conan directory under new user and copied ~/.conan from working user. Then after rebuild nmos-cpp-node started working for new ubuntu user.

@garethsb
Copy link
Contributor

garethsb commented Oct 24, 2023

A Conan Center Index maintainer frustratingly removed the recipe requirement that the same Boost minor version is used between nmos-cpp and cpprestsdk. Boost does not keep binary compatibility between minor versions and that is known to cause the issue you are seeing. conan-io/conan-center-index#17096 (comment)

Please confirm the versions and recipe revisions you are using of Conan itself, nmos-cpp, cpprestsdk, Boost and other dependencies.

A possible workaround is to force Conan to build all packages locally, though this significantly reduces the benefit of using Conan.

@garethsb
Copy link
Contributor

garethsb commented Mar 2, 2024

I now recommend adopting Conan 2 which is better able to express the nuances of dependencies. There is also a new conan package nmos-cpp/cci.20240223.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants