-
Notifications
You must be signed in to change notification settings - Fork 17
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
TcpStream incompatibility: StubbornTcpStream is not Sync #29
Comments
I will look into it either today or tomorrow. Maybe I need to just add a + Sync bounds to the iterator on my end here. |
I created a branch, which I published in the associated PR. would you be able to point to my branch in github from your cargo.toml, and see if it compiles correctly? Additionally, can you please show me the actual code snippet where you are adding StubbornIo, complete with the options? That way I can see if there is anything else that I need to be aware of. Thanks. |
Hi, thank you for working on this! Unfortunately, it didn't fix the issue. Here's the diff of my changes: zeromq/zmq.rs@master...bemyak:zmq.rs:subborn The error is pretty confusing:
|
I am able to reproduce it as well, currently I am not able to find an easy solution to getting it to work, I will continue to investigate. |
I posted a new change that in theory should compile and work, but I want to see if I can avoid the mutex if possible. |
There's one other small incompatibility:
But it's easy to fix now (pass host as String by value), so it's not a big deal. Thank you for the fix! I'll give it a proper testing soon, to see if zmq is able to recover from connection losses. |
I hope it works! With respect to the str reference issue you bring up, that is kind of unavoidable, unless I eaergly perform a clone on the ctor arguments as soon as you call "establish". Id prefer not to do a clone if it isn't really needed, which is why the API is in its current state.
|
Hmm, not sure if I'm doing something wrong, but it seems that stubborn is unable to re-establish a connection. I have a zmq client, which
The connection seems to time-out in 30s after being re-established 🤔 |
This evening I'll clone your project and see what's going on. Thank you for the error logs. |
I don't have the project published, but I'll now try to write a test for stubborn-io to reproduce the problem. |
I was able to reproduce a failure to reconnect using the example weather server + client in the repo. Basically, what I am observing is the ZmqCodec Decoder maintains internal state. When the reconnect occurs after a disconnect, the state of the codec should be reset to There are probably a few ways to handle this, once such way would be, to subscribe to https://github.com/craftytrickster/stubborn-io/blob/main/src/config.rs#L83 , the on_disconnect_callback, and when that is triggered, make sure that the state of the decoder is reset, so that when the TcpConnect is brought back up again, it begins cleanly. |
Thank you for investigating it, @craftytrickster! |
Thanks for help here, published new crate version with the sync change. |
Hi!
I'm trying to replace
TcpStream
withSubbornTcpStream
in zmq.rs here, but I'm getting an error:(dyn Iterator<Item = Duration> + std::marker::Send + 'static) cannot be shared between threads safely
I tried going down the rabbit hole of making it
Sync
, and somehow stumbled upon tokio::ToSocketAddr being opaque, and I'm unable to proceed further.Any advice will be greatly appreciated 🙏
The text was updated successfully, but these errors were encountered: