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
SessionInfo<'static> use a strong reference to Session. This is can be an issue because it may prevents the session to be closed by not being able to claim ownership of the Arc.
In normal languages with scoped variables, this is not really an issue, but in esoteric script dialects like Python, this is a real issue, see this example of the reworked api:
with zenoh.open(conf) as session:
info = session.info
print(f"zid: {info.zid()}")
The context manager exit method (closing the session) will fail, because the ownership of the session cannot be claimed – yes, even with context manager. del info statement must be explicitly added to make it work. With weak reference into SessionInfo, that would not be an issue.
The text was updated successfully, but these errors were encountered:
I've changed the Python API to use a weak reference to session instead of simply wrapping the rust type, so this is not a problem anymore.
Thank you @OlivierHecart for the idea.
Describe the feature
SessionInfo<'static>
use a strong reference toSession
. This is can be an issue because it may prevents the session to be closed by not being able to claim ownership of theArc
.In normal languages with scoped variables, this is not really an issue, but in esoteric script dialects like Python, this is a real issue, see this example of the reworked api:
The context manager exit method (closing the session) will fail, because the ownership of the session cannot be claimed – yes, even with context manager.
del info
statement must be explicitly added to make it work. With weak reference intoSessionInfo
, that would not be an issue.The text was updated successfully, but these errors were encountered: