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
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 how Runtime should be treated.
In my multi-threaded use of the library:
final RuntimeConfig runtimeConfig =
new RuntimeConfig()
.withNumCoreThreads(ushort(4));
final Runtime runtime = new Runtime(runtimeConfig);
this.channel =
ClientChannel.createTcp(
runtime,
ip,
ushort(port),
ushort(1),
new RetryStrategy(),
DecodeLevel.nothing(),
state -> LOG.warn("State change: {}", state));
this.channel.enable();
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:
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:
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.
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: