-
Notifications
You must be signed in to change notification settings - Fork 12
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
Allowing session declarations to stay alive for the lifespan of a session. #96
Allowing session declarations to stay alive for the lifespan of a session. #96
Conversation
@DariusIMP any chance this PR makes it to the 1.0 release? I am mainly interested because of the removal of finalize() overrides in the declaration classes. Although I am worried because the Subscriber class seems to still have it. I have encountered several JVM crashes caused by a SIGSEGV because I have closed a session without undeclaring subscribers first, resulting in the subscribers attempting to undeclare themselves afterwards when they are being garbage collected. I can also create a separate issue for that JVM crash but it seems that this PR should fix the problem (if all declaration classes get rid of the finalize method), as well as provide an easier-to-use API. Because currently I have to wrap the Session with my own class in order to keep track of the closeables. |
@hassomehide Yes, this will be added to the next release |
e54d723
to
66b5dd6
Compare
66b5dd6
to
808a42e
Compare
…alive for the lifespan of a session. Zenoh declarations ran for as long as the Kotlin variable representing them was kept alive. This meant that whenever the user lost track of the variable, it got garbage collected and undeclared in the process. This behavior seems to be counterintuitive for programmers used to garbage collected languages (see eclipse-zenoh#43). Therefore in this PR we provide the following change: we keep track of session declarations in a list inside the session, allowing users to keep running them despite losing their references. When the session is finalized, the associated declarations are undeclared. In case the user needs to close a declaration earlier, they need to keep the variable in order to undeclare it.
808a42e
to
7fe1fdf
Compare
…iately after doing `session.close()`
f4e7366
to
ca1ea92
Compare
…sion. (eclipse-zenoh#96) * feat(background declarations): Allowing session declarations to stay alive for the lifespan of a session. Zenoh declarations ran for as long as the Kotlin variable representing them was kept alive. This meant that whenever the user lost track of the variable, it got garbage collected and undeclared in the process. This behavior seems to be counterintuitive for programmers used to garbage collected languages (see eclipse-zenoh#43). Therefore in this PR we provide the following change: we keep track of session declarations in a list inside the session, allowing users to keep running them despite losing their references. When the session is finalized, the associated declarations are undeclared. In case the user needs to close a declaration earlier, they need to keep the variable in order to undeclare it. * feat(background declarations): closing all session declarations immediately after doing `session.close()`
…sion. (eclipse-zenoh#96) * feat(background declarations): Allowing session declarations to stay alive for the lifespan of a session. Zenoh declarations ran for as long as the Kotlin variable representing them was kept alive. This meant that whenever the user lost track of the variable, it got garbage collected and undeclared in the process. This behavior seems to be counterintuitive for programmers used to garbage collected languages (see eclipse-zenoh#43). Therefore in this PR we provide the following change: we keep track of session declarations in a list inside the session, allowing users to keep running them despite losing their references. When the session is finalized, the associated declarations are undeclared. In case the user needs to close a declaration earlier, they need to keep the variable in order to undeclare it. * feat(background declarations): closing all session declarations immediately after doing `session.close()`
Zenoh declarations ran for as long as the Kotlin variable representing them was kept alive. This meant that whenever the user lost track of the variable, it got garbage collected and undeclared in the process. This behavior seems to be counterintuitive for programmers used to garbage collected languages (see #43).
Therefore in this PR we provide the following change: we keep track of session declarations in a list inside the session, allowing users to keep running them despite losing their references. When the session is finalized, the associated declarations are undeclared. In case the user needs to close a declaration earlier, they need to keep the variable in order to undeclare it.