Skip to content

Intermittent HK2 ServiceLocatorImpl has been shut down #4507

@jansupol

Description

@jansupol

When the reference on ClientRuntime is not kept in the code (such as in the Response), the ClientRuntime can get garbage collected. HK2 ServiceLocator is closed then.

Example:

entity = ClientBuilder.newClient().target().request().get(<some.entity.that.uses.messagebodyworkers>)
entity.read()

entity can be EventInput, InboundEvent, ChunkedInput,...

The following exception can be thrown:

java.lang.IllegalStateException: ServiceLocatorImpl(__HK2_Generated_13,13,1665167146) has been shut down
at org.jvnet.hk2.internal.ServiceLocatorImpl.checkState(ServiceLocatorImpl.java:2383)
at org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetInjecteeDescriptor(ServiceLocatorImpl.java:524)
at org.jvnet.hk2.internal.ServiceLocatorImpl.getInjecteeDescriptor(ServiceLocatorImpl.java:571)
at org.jvnet.hk2.internal.IterableProviderImpl.justInTime(IterableProviderImpl.java:75)
at org.jvnet.hk2.internal.IterableProviderImpl.get(IterableProviderImpl.java:84)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions