socket.io-client-cpp
socket.io-client-cpp copied to clipboard
Crashed when delete sio::client
When I delete sio::client, it crashed, the backtrace is following
Thread 29 Crashed: 0 libsystem_kernel.dylib 0x18cbef13c __pthread_kill + 8 1 libsystem_pthread.dylib 0x18cc26cc0 pthread_kill + 288 2 libsystem_c.dylib 0x18cb36a70 abort + 180 3 libc++abi.dylib 0x18cbde6d8 abort_message + 132 4 libc++abi.dylib 0x18cbce7ac demangling_terminate_handler() + 320 5 libobjc.A.dylib 0x18c87b8a4 _objc_terminate() + 160 6 libc++abi.dylib 0x18cbdda9c std::__terminate(void ()()) + 16 7 libc++abi.dylib 0x18cbe0a48 __cxxabiv1::failed_throw(__cxxabiv1::__cxa_exception) + 36 8 libc++abi.dylib 0x18cbe09f4 __cxa_throw + 140 9 libc++.1.dylib 0x18cb606b8 std::__1::__throw_system_error(int, char const*) + 100 10 libc++.1.dylib 0x18cb55318 std::__1::mutex::lock() + 40 11 NDMeeting 0x10598ef38 sio::socket::impl::on_close() + 232 12 NDMeeting 0x105994984 asio::detail::wait_handler<std::__1::__bind<void (sio::socket::impl::)(), sio::socket::impl>>::do_complete(void*, asio::detail::scheduler_operation*, std::__1::error_code const&, unsigned long) + 104 13 NDMeeting 0x105932f20 0x104a24000 + 15789856 14 NDMeeting 0x105932af8 0x104a24000 + 15788792 15 NDMeeting 0x10592b428 0x104a24000 + 15758376 16 NDMeeting 0x10592aa48 sio::client_impl::run_loop() + 28 17 NDMeeting 0x105932484 0x104a24000 + 15787140 18 libsystem_pthread.dylib 0x18cc27034 _pthread_start + 136 19 libsystem_pthread.dylib 0x18cc21e3c thread_start + 8
I added some logs to sio::socket::impl [2023-08-31-16-42-38:903] [218123] (conferencesocketsignalingchannel.cc:116): begin to deallocate ConferenceSocketSignalingChannel [2023-08-31-16-42-38:903] [448279] (sio_socket.cpp:344): on_close: impl::onclose [2023-08-31-16-42-38:903] [448279] (sio_socket.cpp:258): ~impl: debug==== impl::~impl [2023-08-31-16-42-38:903] [401691] (sio_socket.cpp:344): on_close: impl::onclose
conferencesocketsignalingchannel is responsible to delete sio::client()
why is this happening? why sio_socket's on_close is called twice? why sio_socket's on_close is still called event after it's deallocated? and what can I do to avoid this
https://github.com/socketio/socket.io-client-cpp/pull/122/commits/2c76a4f0408d54cbc351375f60554a80cf01c941
I found this answer, and I think this patch can fix my problem This patch is created at 2016, why hasn't it been merged into master?