-
Notifications
You must be signed in to change notification settings - Fork 640
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Assert in stream_base::assign under load when using TLS #2380
Comments
Thank you for the great and detailed bug report. |
Thank you for your swift answer. I have not tried clang yet but that's a great idea and i'll try it immediately. |
In order to build with clang I had to update boost to 1.78 on my linux machine (BOOST_BEAST_VERSION -> 322). The issue is reproducible with clang as well. |
Yes, I have reproduced with clang. |
Interestingly enough there seems to be issues with exceptions in coros. I switched to a |
Ok i should've looked at the error codes: |
Ok this is a case of RTFM. Native asio ssl streams require the use of a strand and I didn't use one. I'm extremely sorry for having taken up your time >_<. Using a strand here fixes everything. |
When valuable things are learned, no-one's time is wasted. Happy to help. |
When reading and writing at the same time, occasionally BOOST_ASSERT trips in beast/core/detail/stream_base.hpp:111. The assertion trips when using
boost::base::ssl_stream<boost::beast::tcp_stream>
as sub-layer forboost::beast::websocket::stream
but does not trip when usingboost::beast::tcp_stream
for plaintext websocket.The comment mentions two of the same asynchronous I/O operations being issued. I have confirmed that my code doesn't do that and wrote a test program that will demonstrate the issue.
I have verified this issue with the following versions / compilers / platforms:
gcc 11.2.1
linux64msvc 19.29.30139
win32 / win64I did find issue #2345 in which a similar issue was appearently fixed and the code that is "failing" now is part of the fix for that issue.
The attached test program is not the prettiest but it triggers this issue relatively reliably for me.
The program itself reads messages and discards them and writes messages continously (until it crashes) to a websocket echo server. You can compile it with -DWITHOUT_TLS=1 to disable TLS and see the issue disappearing. The assertion will be triggered by the client code.
A quick overview over what fails (in case you don't want to look at the attached program because it's too large):
With the stream being an aforementioned
boost::beast::websocket::stream<boost::beast::ssl_stream<boost::beast::tcp_stream>>
stream connected to an echo server.main.cpp.txt
Build with gcc:
g++ -std=c++20 main.cpp -o test -lssl -lcrypto
The text was updated successfully, but these errors were encountered: