Open glueball opened 4 years ago
Thanks for the feedback, I will investigate, currently I am working on a branch to support futures 0.3, but i will fix this issue on this branch as well. ETA for futures 0.3 is Monday
Follow up on my ETA; apologies I have a hectic work load at the moment, I need another week to stabilize the futures 0.3. new ETA is Jan 20 Kind Regards.
No worries, I completely understand (been there).
By the way, for me is OK if this is fixed in 0.3. So far I'm only testing with the version in crates.io because I'm lazy enough, but plan to use futures 0.3 when I began actually coding my next project, so I'm very interested in your work on that too. Therefore, for me it is Ok if this is fixed in 0.3.
You might want to fix it in 0.2 just in case someone can't upgrade.
This seems to be resolved in the tip of master, when I run the example STAN subscriber and restart the server, I seem to be receiving new messages which are published.
cargo run --example stan_subscribe
Finished dev [unoptimized + debuginfo] target(s) in 0.09s
Running `target/debug/examples/stan_subscribe`
[DEBUG] - Connection id => 6q9JcJmMfRo4mns3h39JZA
[TRACE] - registering with poller
[TRACE] - registering; token=Token(0); interests=Readable | Writable | Error | Hup
[DEBUG] - Connecting STAN Client
[DEBUG] - Subscribing to heartbeat => _HB.6q9JcJmMfRo4mns3h39Je3
[ERROR] - Missed ping interval
[ERROR] - Missed ping interval
[ERROR] - Error pinging NATS server IOError(Os { code: 32, kind: BrokenPipe, message: "Broken pipe" })
[ERROR] - Missed too many pings, reconnect is required.
[TRACE] - registering with poller
[TRACE] - registering; token=Token(1); interests=Readable | Writable | Error | Hup
[TRACE] - deregistering handle with poller
[INFO] - Reconnecting to NATS servers 4 - new version 2
[INFO] - re subscribed to => "_SUB.6q9JcJmMfRo4mns3h39Jiw"
[INFO] - re subscribed to => "_HB.6q9JcJmMfRo4mns3h39Je3"
[DEBUG] - Connection id => 6q9JcJmMfRo4mns3h39Jnp
[DEBUG] - Re-Connecting STAN Client
[DEBUG] - Subscribing to heartbeat => _HB.6q9JcJmMfRo4mns3h39Jsi
[INFO] - << 1 >> got stan message --- StanMessage { subject: "foo", reply_to: None, payload: [98, 97, 114], timestamp: 1582474425907321200, sequence: 2, redelivered: false, ack_inbox: Some("_INBOX.i2HrFfpqpH4XXYhp8VDmcD"), ack_handler: Some(<ack-handler>) }
"bar"
I did notice that if I published messages during the period prior to reconnection though, they seemed to never be received by the subscriber.
Yes, it seems to be working now. I tested using ratsio="0.3.0-alpha.1".
I'll test messages sent during re-connection tomorrow (no more time left today), according to @avatarneil's posts. Just try to make sure that the channel is durable and that NATS is configured with a persistent storage (the docker image defaults to memory).
@mnetship, when do you consider ratsio 0.3 (or maybe call it 1.0 already) will be ready for release?
To reproduce the issue, I've prepared the following example (largely based on the code in the README). Code bellow.
Note: I'm using ratsio "^0.2" from crates.io.
Steps
docker run -it -p 4222:4222 -p 8222:8222 nats-streaming
).The first time, the subscription works, as can be seen in the following debug line:
Pings are not responded to, we may be down.
line, but doesn't seem to make a difference._STAN.sub
.I've noted There's a line that says
1 STAN Reconnecting Subscriptions [1]
(which is correct), but the line below it is different (_SUB.
vs_STAN.sub
).In this run, I did not use a second program to send messages in order to have less output, but doing so shows that the client does receive messages before the disconnection/reconnection, but not after it.
Test code
Full debug output