Closed gensmusic closed 1 year ago
Thanks for reporting this. I will take a look and see if I can reproduce it.
BTW... thanks for the full code to test! Very helpful.
At first I couldn't reproduce the error, then realized that I was getting some connect failures due to my 1024 socket limit on Linux. I increased that by 2x and got the segfault.
I ran the code through valgrind but didn't see any memory leaks (which was my first guess).
Then ran it through a debugger, and it appears to be crashing in the underlying Paho C client library on a call to a socket close function. Odd. I don't see any hard table limits for 1000 clients in the C code, but it could be something like that.
Unfortunately, we can't throw an async/tokio Rust app at the C guys to debug, so I probably need to write a similar test of >1000 clients in pure C and see if I can cause the same segfault and post an issue to that project.
I'm sure the first question will be... "Who needs 1000 separate clients in an app?!?!"
Oh, I just saw this... https://github.com/eclipse/paho.mqtt.c/issues/1033
So I'm assuming that >1000 clients will specifically not be supported by the C client, but certainly it shouldn't segfault.
With the upgrade to Paho C v1.3.12, this is no longer crashing. Depending on the system and pre-set limits, you may not be able to open that many connections, but at least it's no longer crashing.
I try to create more than 1000 clients and then got
segmentation fault
How to reproduce ?
Use the following code!
Cargo.toml