Closed OPNA2608 closed 2 weeks ago
[ 1][t 1][1729167695.407581090][tests.cpp:229] Run test [name:Test_Client_Simple]
Thread 1 "run_all_tests" received signal SIGSEGV, Segmentation fault.
td::ActorInfo::init (this=0x17cdd10, sched_id=<optimized out>, name=..., this_ptr=..., actor_ptr=<optimized out>,
deleter=<optimized out>, need_context=<optimized out>, need_start_up=<optimized out>)
at /build/source/tdactor/td/actor/impl/ActorInfo.h:41
41 context_ = Scheduler::context()->this_ptr_.lock();
(gdb) bt
#0 td::ActorInfo::init (this=0x17cdd10, sched_id=<optimized out>, name=..., this_ptr=..., actor_ptr=<optimized out>, deleter=<optimized out>, need_context=<optimized out>, need_start_up=<optimized out>) at /build/source/tdactor/td/actor/impl/ActorInfo.h:41
#1 0x00007ffff7a47eed in td::Scheduler::register_actor_impl<td::Scheduler::ServiceActor> (this=this@entry=0x180e8e0, name=..., actor_ptr=actor_ptr@entry=0x180e948, deleter=deleter@entry=td::ActorInfo::Deleter::None, sched_id=0)
at /build/source/tdutils/td/utils/ObjectPool.h:103
#2 0x00007ffff7a4883e in td::Scheduler::register_actor<td::Scheduler::ServiceActor> (sched_id=-1, actor_ptr=0x180e948, name=..., this=0x180e8e0) at /build/source/tdactor/td/actor/impl/Scheduler.h:81
#3 td::Scheduler::init (this=0x180e8e0, id=0, outbound=..., callback=<optimized out>) at /build/source/tdactor/td/actor/impl/Scheduler.cpp:233
#4 0x00007ffff7a422f9 in td::ConcurrentScheduler::ConcurrentScheduler (this=<optimized out>, additional_thread_count=<optimized out>, thread_affinity_mask=<optimized out>) at /build/source/tdactor/td/actor/ConcurrentScheduler.cpp:54
#5 0x00007ffff6975a1c in std::_Construct<td::ConcurrentScheduler, int const&, int> (__p=0x176d480) at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/stl_construct.h:109
#6 std::allocator_traits<std::allocator<void> >::construct<td::ConcurrentScheduler, int const&, int> (__p=0x176d480) at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/alloc_traits.h:661
#7 std::_Sp_counted_ptr_inplace<td::ConcurrentScheduler, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<int const&, int> (__a=..., this=0x176d470)
at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr_base.h:604
#8 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<td::ConcurrentScheduler, std::allocator<void>, int const&, int> (__a=..., __p=<optimized out>, this=<optimized out>)
at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr_base.h:971
#9 std::__shared_ptr<td::ConcurrentScheduler, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, int const&, int> (__tag=..., this=<optimized out>) at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr_base.h:1712
#10 std::shared_ptr<td::ConcurrentScheduler>::shared_ptr<std::allocator<void>, int const&, int> (__tag=..., this=<optimized out>) at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr.h:464
#11 std::make_shared<td::ConcurrentScheduler, int const&, int> () at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr.h:1010
#12 td::MultiImpl::MultiImpl (this=0x17cd470, net_query_stats=std::shared_ptr<td::NetQueryStats> (use count 2, weak count 0) = {...}) at /build/source/td/telegram/Client.cpp:356
#13 0x00007ffff6975ffb in std::_Construct<td::MultiImpl, std::shared_ptr<td::NetQueryStats>&> (__p=0x17cd470) at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/stl_construct.h:119
#14 std::allocator_traits<std::allocator<void> >::construct<td::MultiImpl, std::shared_ptr<td::NetQueryStats>&> (__p=0x17cd470) at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/alloc_traits.h:661
#15 std::_Sp_counted_ptr_inplace<td::MultiImpl, std::allocator<void>, (__gnu_cxx::_Lock_policy)2>::_Sp_counted_ptr_inplace<std::shared_ptr<td::NetQueryStats>&> (__a=..., this=0x17cd460)
at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr_base.h:604
#16 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::__shared_count<td::MultiImpl, std::allocator<void>, std::shared_ptr<td::NetQueryStats>&> (__a=..., __p=<optimized out>, this=<optimized out>)
at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr_base.h:971
#17 std::__shared_ptr<td::MultiImpl, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<void>, std::shared_ptr<td::NetQueryStats>&> (__tag=..., this=<optimized out>)
at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr_base.h:1712
#18 std::shared_ptr<td::MultiImpl>::shared_ptr<std::allocator<void>, std::shared_ptr<td::NetQueryStats>&> (__tag=..., this=<optimized out>) at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr.h:464
#19 std::make_shared<td::MultiImpl, std::shared_ptr<td::NetQueryStats>&> () at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/shared_ptr.h:1010
#20 td::MultiImplPool::get (this=0x7ffff7e35c60 <td::Client::Impl::Impl()::pool>) at /build/source/td/telegram/Client.cpp:449
#21 0x00007ffff69798ba in td::Client::Impl::Impl (this=0x17ce560) at /build/source/td/telegram/Client.cpp:598
#22 0x00007ffff6979f6f in std::make_unique<td::Client::Impl> () at /nix/store/0vsyw5bhwmisszyfd1a0sdnwvnf4qa5a-gcc-13.3.0/include/c++/13.3.0/bits/unique_ptr.h:1070
#23 td::Client::Client (this=this@entry=0x7fffffffa088) at /build/source/td/telegram/Client.cpp:645
#24 0x00000000004e9c86 in Test_Client_Simple::run (this=<optimized out>) at /build/source/test/tdclient.cpp:855
#25 0x0000000000fbc903 in td::Test::step (this=<optimized out>) at /build/source/tdutils/td/utils/tests.h:74
#26 td::Test::run (this=<optimized out>) at /build/source/tdutils/td/utils/tests.h:70
#27 td::Test::step (this=<optimized out>) at /build/source/tdutils/td/utils/tests.h:74
#28 td::TestsRunner::run_all_step (this=this@entry=0x173e820 <td::TestsRunner::get_default()::default_runner>) at /build/source/tdutils/td/utils/tests.cpp:238
#29 0x0000000000fbd158 in td::TestsRunner::run_all (this=this@entry=0x173e820 <td::TestsRunner::get_default()::default_runner>) at /build/source/tdutils/td/utils/tests.cpp:198
#30 0x00000000004380df in main (argc=<optimized out>, argv=0x7fffffffa4d8) at /build/source/test/main.cpp:64
I can reproduce the issue, but I don't think that there is a feasible way to fix it. The native C++ interface is very big and uses std::vector, std::unique_ptr and std::string classes, which must not be exported from DLLs on Windows. Also, multiple issues are expected to appear on macOS and similar systems.
From the other side, using the native interface from a dynamic library is hardly ever needed, because it changes too often and there is no need to support multiple native versions simultaneously anyway.
It would be a better solution to remove the ability to build tdclient
and tdapi
libraries dynamically.
At fe6f2f93e79f6d1ce49c010ec4931b7dc8554538 & 9b6ff58, using Debian & Nix build environments:
Building with
-DBUILD_SHARED_LIBS:BOOL=OFF
makes it pass fine. Can get a proper stack trace tomorrow, but issue is at https://github.com/tdlib/td/blob/fe6f2f93e79f6d1ce49c010ec4931b7dc8554538/test/tdclient.cpp#L855 -> https://github.com/tdlib/td/blob/fe6f2f93e79f6d1ce49c010ec4931b7dc8554538/tdactor/td/actor/impl/ActorInfo.h#L41 withScheduler::context()
returningNULL
.