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
{{ message }}
Repository navigation
IXWebSocket client creates a lot of threads when connecting to some urls #406
After start() method IXWebSocket creates around 30 threads when connecting to some urls. wss is using.
One of that threads is using to send messages, one for receiving.
How can I force IXWebSocket to use only one thread (like for other urls)?
Compiled with "cmake -DUSE_TLS=1 -DUSE_ZLIB=1 -DUSE_OPEN_SSL=1 .."
Attached screenshots
.
$ ./build/ws/ws connect --help
Connect to a remote server
Usage: ./build/ws/ws connect [OPTIONS] url
Positionals:
url TEXT REQUIRED Connection url
Options:
-h,--help Print this help message and exit
-H TEXT Header
-d Disable Automatic Reconnection
-x Disable per message deflate
-b Send in binary mode
--max_wait UINT Max Wait Time between reconnection retries
--ping_interval INT Interval between sending pings
--subprotocol TEXT Subprotocol
-g Decompress gziped messages
--pidfile TEXT Pid file
--cert-file TEXT:PATH(existing)
Path to the (PEM format) TLS cert file
--key-file TEXT:PATH(existing)
Path to the (PEM format) TLS key file
--ca-file TEXT:PATH(existing)
Path to the (PEM format) ca roots file
--ciphers TEXT A (comma/space/colon) separated list of ciphers to use for TLS
--tls Enable TLS (server only)
--verify_none Disable peer cert verification
I revisited this report against the current threading model. start() owns one connection thread; hostname resolution can temporarily use a resolver worker. Sending/receiving messages does not itself create additional IXWebSocket worker threads. #656 removes the resolver worker entirely for numeric addresses and fixes detached-worker ownership, but that does not establish the cause of this application's post-message thread growth.
The CLI connecting to the same endpoint was reported to work normally earlier in this discussion. Could you provide a minimal current application that reproduces the growth after a message, plus stack traces of the newly created threads? Those stacks are needed to distinguish connection/resolver work from callbacks, application code or TLS-provider threads. See the current threading documentation.
Closing this old report because we do not have a current application reproduction or thread stacks, and the reporter confirmed that the CLI did not show the problem with the same endpoint. We cannot attribute the application thread growth to IXWebSocket from the available evidence. Please reopen with a minimal current reproduction and stacks of the extra threads if it still occurs.
Activity
bsergean commentedon Aug 2, 2022
I don't know what goes wrong with this remote url. Can you connect to it with anothe library ? Maybe it has some SSL problem ?
You could also try an older version of ixwebsocket.
bsergean commentedon Aug 2, 2022
Can you connect to it with the connect ws sub-command ?
Ringflash commentedon Aug 3, 2022
I've tried with another ws library and it doesn't create additional threads for that url.
I've tried v11.0.8 and v10.4.0. Same result. A lot of threads.
Ringflash commentedon Aug 3, 2022
I don't get how to do it. What method should I use?
bsergean commentedon Aug 3, 2022
ws is a command line interface. Build ws like this:
Then:
bsergean commentedon Aug 3, 2022
I tried this remote websocket test server -> https://www.piesocket.com/websocket-tester
bsergean commentedon Aug 4, 2022
Ringflash commentedon Aug 4, 2022
Connected and no problems. Two threads for ws process.
Ubuntu 20.04. App compiled with g++-11
It is public, but I've sent it to your email. And some messages to test with.
It seems that new threads are created not after connection to url but after sending some messages.
nini2009ph commentedon Sep 4, 2022
try adding webSocket.disableAutomaticReconnection();
Ringflash commentedon Sep 17, 2022
Same thing. Didn't help
bsergean commentedon Nov 17, 2026
I revisited this report against the current threading model.
start()owns one connection thread; hostname resolution can temporarily use a resolver worker. Sending/receiving messages does not itself create additional IXWebSocket worker threads. #656 removes the resolver worker entirely for numeric addresses and fixes detached-worker ownership, but that does not establish the cause of this application's post-message thread growth.The CLI connecting to the same endpoint was reported to work normally earlier in this discussion. Could you provide a minimal current application that reproduces the growth after a message, plus stack traces of the newly created threads? Those stacks are needed to distinguish connection/resolver work from callbacks, application code or TLS-provider threads. See the current threading documentation.
bsergean commentedon Nov 17, 2026
Closing this old report because we do not have a current application reproduction or thread stacks, and the reporter confirmed that the CLI did not show the problem with the same endpoint. We cannot attribute the application thread growth to IXWebSocket from the available evidence. Please reopen with a minimal current reproduction and stacks of the extra threads if it still occurs.