zenoh
zenoh copied to clipboard
dropping session created with zenoh::init makes other sessions with the same runime unusable [Bug]
Describe the bug
When two instances of session is created from the same runtime and then one of instances is dropped, the other one becomes unable to connect
To reproduce
Use this PR: https://github.com/eclipse-zenoh/zenoh/pull/611 Run test with
cargo test zenoh_session_runtime_init --test session -- --nocapture
Result is
[ ][01a] Creating peer01 session runtime: ["tcp/127.0.1:17447"]
[ ][02a] Creating peer02 session runtime: ["tcp/127.0.1:17447"]
[RI][02a] Creating peer01 session from runtime 1
[RI][02b] Creating peer02 session from runtime 2
[RI][02c] Creating peer01a session from runtime 1
[PS][01b] Subscribing on peer01 session
[PS][02b] Putting on peer02 session. 1000 msgs of 1024 bytes.
[PS][03b] Received 553/1000.
[PS][03b] Received 1000/1000.
[PS][03b] Unsubscribing on peer01 session
[PS][01b] Subscribing on peer01 session
[PS][02b] Putting on peer02 session. 1000 msgs of 100000 bytes.
[PS][03b] Received 907/1000.
[PS][03b] Received 1000/1000.
[PS][03b] Unsubscribing on peer01 session
[RI][02d] Closing peer02a session
[PS][01b] Subscribing on peer01 session
[PS][02b] Putting on peer02 session. 1000 msgs of 1024 bytes.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
[PS][03b] Received 0/1000.
If drop of second session is commented out (line https://github.com/eclipse-zenoh/zenoh/pull/611/files#diff-535d5571c1b372d9e23a72ae9944449c512e46aa82eea002eb0ef0681b66562fR252), result is ok:
[ ][01a] Creating peer01 session runtime: ["tcp/127.0.1:17447"]
[ ][02a] Creating peer02 session runtime: ["tcp/127.0.1:17447"]
[RI][02a] Creating peer01 session from runtime 1
[RI][02b] Creating peer02 session from runtime 2
[RI][02c] Creating peer01a session from runtime 1
[PS][01b] Subscribing on peer01 session
[PS][02b] Putting on peer02 session. 1000 msgs of 1024 bytes.
[PS][03b] Received 646/1000.
[PS][03b] Received 1000/1000.
[PS][03b] Unsubscribing on peer01 session
[PS][01b] Subscribing on peer01 session
[PS][02b] Putting on peer02 session. 1000 msgs of 100000 bytes.
[PS][03b] Received 915/1000.
[PS][03b] Received 1000/1000.
[PS][03b] Unsubscribing on peer01 session
[RI][02d] Closing peer02a session
[PS][01b] Subscribing on peer01 session
[PS][02b] Putting on peer02 session. 1000 msgs of 1024 bytes.
[PS][03b] Received 607/1000.
[PS][03b] Received 1000/1000.
[PS][03b] Unsubscribing on peer01 session
[PS][01b] Subscribing on peer01 session
[PS][02b] Putting on peer02 session. 1000 msgs of 100000 bytes.
[PS][03b] Received 912/1000.
[PS][03b] Received 1000/1000.
[PS][03b] Unsubscribing on peer01 session
test zenoh_session_runtime_init ... ok
System info
Ubuntu 22.02 Mac M2
Proper fix for memory leaks (#695 ) would likely also address this issue.