-
Notifications
You must be signed in to change notification settings - Fork 22
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
Java runtime reference #125
Comments
Hi @delawr0190. This is the expected behavior, although I think we should have an explicit warning about holding onto a reference to runtime until you're done here: https://docs.stepfunc.io/rodbus/1.3.1/guide/docs/api/runtime#examples We kind of hint about how the garbage collection interacts with this in the shutdown section, but I think calling it out explicitly for Java/C# in the section above would be better. https://docs.stepfunc.io/rodbus/1.3.1/guide/docs/api/runtime#shutdown |
Leaving this open until the next release so we can update docs. |
Assuming I'm using the java library correctly, I believe there's either a missing
Runtime
reference hold or the documentation may need to be updated to reflect howRuntime
should be treated.In my multi-threaded use of the library:
A separate scheduled executor periodically initiates reads from the channel.
With nothing holding the runtime reference, the gc seems to prune it, calling
finalize()
, which shuts down the Runtime and "SHUTDOWN" exceptions start to get thrown.To fix this, holding the reference to
Runtime
on the class keeps the gc from deleting it, which keeps things going.Couldn't find reference to this anywhere, so wanted to share. Unsure if intended or not.
The text was updated successfully, but these errors were encountered: