boostorg / boostorg/beast

websocket_client_async_ssl_system_executor sample exits before connecting

Open
#2,002 10 comments 0 reactions 1 assignee Claimed by @madmongo1 View on GitHub
Bug
Dominant language
C++
Stars
4.8k
Forks
694
Avg merge
12h 48m
Merged PRs (30d)
1

Description

### Boost 1.73 BOOST_BEAST_VERSION 290

### Steps necessary to reproduce the problem

Compile and run the Debug x86 configuration in the attached sample with visual studio 2019. This is the same sample as in the boost/beast deployment. Debug x86 has the command line arguments inserted.
[websocket_client_async_ssl_system_executor.zip](https://github.com/boostorg/beast/files/4852848/websocket_client_async_ssl_system_executor.zip)

The issue with the sample is the code line 258:
net::system_executor().context().join();

Contrary to the comment in the code this does not wait until the system_executor runs out of work but actively invokes scheduler_.work_finished(); which decrements the outstanding_work_ count and stops the scheduler_, resulting in the websocket session ending prematurely.

As I am using the websocket_client_async_ssl_system_executor sample as the basis of my own work how one can wait on the system_executor?

Thanks
Markus

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.