-
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
[Bug] Subscriber closes after starting a server #43
Comments
This is not a bug at all: declared elements required state to be held not only locally, but in the Zenoh network as well. This would mean failing to undeclare an element would cause resource leaks in the infrastructure. To avoid this, all Zenoh bindings that can support doing so use destructors. This means that if you don't store your subscribers in some variable, they will instantly be destroyed (regardless of starting a server, which has nothing to do with the issue). In garbage collected languages, delays might appear, but eventual destruction is guaranteed. I'm closing this issue and will open another to ensure @DariusIMP documents this behaviour a bit more to avoid future conditions about this. |
Do you want to say that assigning Subscriber to a variable would resolve this issue? |
Correct |
…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.
…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.
…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.
…sion. (#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 #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()`
…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()`
Describe the bug
I've faced with an issue that zenoh subscribers are getting closed after starting a web-server (tried with spring-boot-tomcat, spring-boot-jetty, pure jetty).
You can use following simple code to reproduce it:
Seems like the issue not at jetty itself as different implementations of servers don't work, but in the way how servers threading lifecycle work.
Here are the logs:
To reproduce
System info
The text was updated successfully, but these errors were encountered: