Boost logo

Boost Users :

From: Ales Mulej (alesm2015_at_[hidden])
Date: 2022-02-08 10:46:45


Hi All,
I'm writing TLS client/server and my server is continuously crashing in the
async_handshake function. I'm running out of ideas of what I'm doing wrong
or how to solve the issue. I'm using VS 2022 and the latest boost from
github. Tested with 1.78.0 as well. Using OpenSSL 3.0.1.
Code is compiled as x64, /std:c++20. Using a single thread.

Simplified function call:
on_accept:
auto server = boost::make_shared<cserver_session_ws>(std::move(socket),
m_ioc, m_ctx);
server->run();
run:
boost::asio::dispatch(m_ws.get_executor(),
boost::beast::bind_front_handler(&cserver_session_ws::on_run,
shared_from_this()));
on_run:
m_ws.next_layer().async_handshake(boost::asio::ssl::stream_base::server,
boost::beast::bind_front_handler(&cserver_session_ws::on_handshake,
shared_from_this()));

on_handshake function never gets called, due to the crash in
async_handshake function.

m_ws is defined as:
boost::beast::websocket::stream<boost::beast::ssl_stream<boost::beast::tcp_stream>>
m_ws;

Exception call stack:
Unhandled exception thrown: read access violation.
**this** was 0x1.
boost::asio::detail::scheduler::post_immediate_completion(boost::asio::detail::scheduler_operation
...... Line 349
boost::asio::detail::select_reactor::schedule_timer<boost::asio::detail::chrono_time_traits<std::chrono
..... Line 66
boost::asio::detail::deadline_timer_service<boost::asio::detail::chrono_time_traits
..... Line 273
boost::asio::basic_waitable_timer<std::chrono::steady_clock,boost::asio::wait_traits
...... Line 806
boost::asio::detail::completion_handler_async_result<boost::beast::basic_stream
..... Line 485
boost::asio::async_initiate<boost::beast::basic_stream<boost::asio::ip
..... Line 865
.....
Here are only the last few functions from the call stack. I can share the
entire call stack if requested. I would appreciate any help on this as I
can't figure out what caused the crash.

Regards,
A



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net