Open manuel-schiller opened 8 years ago
I seem to have run into a similar issue when spawning many async requests from js ws client: namely a bad this pointer in get_message.
Thread 11 "provablyfair_ga" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff1f28700 (LWP 20369)]
websocketpp::message_buffer::alloc::con_msg_managerwebsocketpp::message_buffer::message
#0
0x00000000004aea9d in websocketpp::connectionwebsocketpp::config::asio::send (
op=websocketpp::frame::opcode::text,
payload="{\"roll\":{\"success\":true,\"nonce\":5,\"roll\":909,\"target\":1998,\"condition_high\":true,\"amount\":1.000000,\"profit\":-1.000000,\"balance\":1000.249200}}",
this=0x7fffe40307b0)
at /home/ebola/Projects/ProvablyFair/libprovablyfair/../../websocketpp/websocketpp/impl/connection_impl.hpp:86
payload="{\"roll\":{\"success\":true,\"nonce\":5,\"roll\":909,\"target\":1998,\"condition_high\":true,\"amount\":1.000000,\"profit\":-1.000000,\"balance\":1000.249200}}",
hdl=error reading variable: access outside bounds of object referenced via synthetic pointer, this=0x7fffec000a00)
at /home/ebola/Projects/ProvablyFair/libprovablyfair/../../websocketpp/websocketpp/impl/endpoint_impl.hpp:168
hdl=std::weak_ptr (count 2, weak 5007) 0x7fffe40307b0,
payload="{\"roll\":{\"success\":true,\"nonce\":5,\"roll\":909,\"target\":1998,\"condition_high\":true,\"amount\":1.000000,\"profit\":-1.000000,\"balance\":1000.249200}}",
op=op@entry=websocketpp::frame::opcode::text)
at /home/ebola/Projects/ProvablyFair/libprovablyfair/../../websocketpp/websocketpp/impl/endpoint_impl.hpp:176
hdl=std::weak_ptr (count 2, weak 5007) 0x7fffe40307b0,
msg="{\"roll\":{\"success\":true,\"nonce\":5,\"roll\":909,\"target\":1998,\"condition_high\":true,\"amount\":1.000000,\"profit\":-1.000000,\"balance\":1000.249200}}")
at /home/ebola/Projects/ProvablyFair/libprovablyfair/src/websock_server.cpp:152
updated to reflect the error on hdl in stack frame 1
The above happens if I create a std::thread backed pool and call send from threads other then the main thread, if I handle all message processing in my on_message handler it has no issues dealing with many async writes.
I'm seeing this issue as well, is there a good workaround?
Likewise encountering this issue. Is send
not thread safe?
I also have similar issues. When I move connection_hdl to a thread pool and try to send there sometimes it crashes doesnt seem to have thread safety.
I modified the websocket++ echo server example to use multiple threads:
I connect using one client which sends many messages asynchronously. Then the server crashes with:
Judging from the websocket++ manual on Thread Safety, what I am doing should be threadsafe:
The client I am using is based on NodeJS:
client.js
start via: