You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I experience a bug when using ASIO_STANDALONE.
When the endpoint is stopped during an active handshake I get the following error in the destructor of the endpoint:
malloc: *** error for object 0x7fea5c0005d0: pointer being freed was not allocated
It seems as if asio deletes the object during the call of stop() and tries to delete it again in the destructor. boost::asio 1.65.1 does not show this behaviour.
I really would prefer using the header-only standalone asio version, since I try to keep my dependencies small for my cross-plattform application. The problem arises when I tried to shut down my endpoint. After a specific time I can not wait any longer and have to stop the endpoint.
I am using the latest version of asio from https://github.com/chriskohlhoff/asio on MacOS Sierra.
To replicate the bug compile this example with ASIO_STANDALONE defined:
#include <chrono>
#include <thread>
#include <websocketpp/config/asio_client.hpp>
#include <websocketpp/client.hpp>
#ifndef ASIO_STANDALONE
namespace asio { using namespace boost::asio; }
#endif
using namespace std;
using WsClient = websocketpp::client<websocketpp::config::asio_tls_client>;
using WsMessage = websocketpp::config::asio_tls_client::message_type ;
using WsContext = shared_ptr<asio::ssl::context> ;
int main(){
WsClient client;
client.init_asio();
auto sslContext = make_shared<asio::ssl::context>( asio::ssl::context::sslv23 );
client.set_tls_init_handler( [sslContext]( auto hdl ){ return sslContext; });
websocketpp::lib::error_code ec;
auto con = client.get_connection( "wss://google.de:8080", ec ); // some uri to wait for
if( ec ) throw runtime_error("can not create connection: "+ec.message() );
client.connect(con);
auto trd = thread( [&](){ client.run(); });
this_thread::sleep_for(.5s); // wait for the handshake to start
client.stop(); // stop before timeout kicks in
trd.join();
return 0;
}
Any help would be greatly appreciated
The text was updated successfully, but these errors were encountered:
Hello,
I experience a bug when using ASIO_STANDALONE.
When the endpoint is stopped during an active handshake I get the following error in the destructor of the endpoint:
It seems as if asio deletes the object during the call of stop() and tries to delete it again in the destructor. boost::asio 1.65.1 does not show this behaviour.
I really would prefer using the header-only standalone asio version, since I try to keep my dependencies small for my cross-plattform application. The problem arises when I tried to shut down my endpoint. After a specific time I can not wait any longer and have to stop the endpoint.
I am using the latest version of asio from https://github.com/chriskohlhoff/asio on MacOS Sierra.
To replicate the bug compile this example with ASIO_STANDALONE defined:
Any help would be greatly appreciated
The text was updated successfully, but these errors were encountered: