beast icon indicating copy to clipboard operation
beast copied to clipboard

Websocket example

Open Dimitrius-dev opened this issue 1 year ago • 9 comments

Hello, Boost=1.84.0, BOOST_BEAST_VERSION=351 I am using boost/beast websocket TLS async client example link. I noticed my connection disconnects sometimes with stream truncated and eof. What do these errors mean? I checked my internet connection with wireshark and it's fine.

Dimitrius-dev avatar Aug 08 '24 11:08 Dimitrius-dev

Do they happen at the end of stream? error::stream_truncated

ashtum avatar Aug 08 '24 11:08 ashtum

No, i get these errors without calling any shutdown or disconnect function. And it shows when use client for high load traffic (high frequency).

Dimitrius-dev avatar Aug 08 '24 11:08 Dimitrius-dev

Are you sure it’s not the server that dropped the connection? Does this happen with just one specific server?

ashtum avatar Aug 08 '24 11:08 ashtum

Can connection issues occur if multiply connections use load_certificates function?

Dimitrius-dev avatar Aug 26 '24 10:08 Dimitrius-dev

Do you mean load_root_certificates? it calls ssl::context::add_certificate_authority which is not thread safe.

ashtum avatar Aug 26 '24 11:08 ashtum

I made n threads. Every thread has its own asio context, and interact with the same internet resource

Dimitrius-dev avatar Aug 26 '24 11:08 Dimitrius-dev

Do they have their own ssl::context too?

ashtum avatar Aug 26 '24 12:08 ashtum

yes

Dimitrius-dev avatar Aug 26 '24 13:08 Dimitrius-dev

Have you tried reducing your application to a single connection and a single thread to see if the issue still exists? If possible, test one of the existing examples.

ashtum avatar Aug 26 '24 13:08 ashtum