BelaPlatform / Bela

Bela: core code, IDE and lots of fun!
Other
491 stars 139 forks source link

if scope is running and gShouldStop is set from within `render()`, you may get segfault #387

Open giuliomoro opened 6 years ago

giuliomoro commented 6 years ago

Most likely something going wrong when cleaning up the objects>

Thread 3 "ws_server_task" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb60cc450 (LWP 18936)]
0xb6b3e7ac in ?? () from /lib/arm-linux-gnueabihf/libc.so.6
#0  0xb6b3e7ac in ?? () from /lib/arm-linux-gnueabihf/libc.so.6
#1  0xb6dec5ec in seasocks::Connection::write(void const*, unsigned int, bool) () from /usr/local/lib/libseasocks.so.1.3.2
#2  0xb6dedf90 in seasocks::Connection::sendHybiData(unsigned char const*, unsigned int) () from /usr/local/lib/libseasocks.so.1.3.2
#3  0xb6dede6c in seasocks::Connection::sendHybi(unsigned char, unsigned char const*, unsigned int) () from /usr/local/lib/libseasocks.so.1.3.2
#4  0xb6dedcca in seasocks::Connection::send(unsigned char const*, unsigned int) () from /usr/local/lib/libseasocks.so.1.3.2
#5  0x00032730 in ScopeSendBufferRunnable::run (this=0xa0d7c) at core/scope_ws.cpp:165
#6  0xb6e07d4c in seasocks::Server::execute(std::shared_ptr<seasocks::Server::Runnable>)::{lambda()#1}::operator()() const () from /usr/local/lib/libseasocks.so.1.3.2
#7  0xb6e088e4 in std::_Function_handler<void (), seasocks::Server::execute(std::shared_ptr<seasocks::Server::Runnable>)::{lambda()#1}>::_M_invoke(std::_Any_data const&) () from /usr/local/lib/libseasocks.so.1.3.2
#8  0xb6e098f6 in std::function<void ()>::operator()() const () from /usr/local/lib/libseasocks.so.1.3.2
#9  0xb6e073be in seasocks::Server::runExecutables() () from /usr/local/lib/libseasocks.so.1.3.2
#10 0xb6e070ea in seasocks::Server::processEventQueue() () from /usr/local/lib/libseasocks.so.1.3.2
#11 0xb6e06db4 in seasocks::Server::loop() () from /usr/local/lib/libseasocks.so.1.3.2
#12 0xb6e06d06 in seasocks::Server::serve(char const*, int) () from /usr/local/lib/libseasocks.so.1.3.2
#13 0x000251fc in ws_server_task_func () at core/scope_ws.cpp:154
#14 0x0003778c in AuxTaskNonRT::empty_loop (this=0x88754 <ws_server_task>) at core/AuxTaskNonRT.cpp:134
#15 0x0003741c in AuxTaskNonRT::loop (ptr=0x88754 <ws_server_task>) at core/AuxTaskNonRT.cpp:167
#16 0xb6fbe612 in cobalt_thread_trampoline () from /usr/xenomai/lib/libcobalt.so.2
#17 0xb6f815e8 in start_thread () from /lib/arm-linux-gnueabihf/libpthread.so.0
#18 0xb6b764fa in ?? () from /lib/arm-linux-gnueabihf/libc.so.6
giuliomoro commented 6 years ago

The server should be killed from the destructor with server.terminate() and then the thread joined

See https://github.com/BelaPlatform/Bela/issues/400