users@jersey.java.net

[Jersey] o.j.hk2.internal.ServiceLocatorImpl blocking

From: Andras Szerdahelyi <andras.szerdahelyi_at_gmail.com>
Date: Fri, 26 Jul 2013 16:01:55 +0200

Hello list,

while working on a Jersey container implementation for Netty 4 i noticed all threads of my Netty executor group ( running the Jersey handler i implemented ) are very often blocked on one of two methods in hk2's org.jvnet.hk2.internal.ServiceLocatorImpl ( resolveContext, internalGetDescriptor ) that both synchronise on the same lock.

Has anyone experienced anything similar ?
Here are the two stack traces i'm getting



Stacks at 03:51:49 PM (uptime 7m 46s)


defaultEventExecutorGroup-4-15 [BLOCKED] CPU time: 12s
org.jvnet.hk2.internal.ServiceLocatorImpl.internalGetDescriptor(Injectee, Type, String, Unqualified, Annotation[])
org.jvnet.hk2.internal.ServiceLocatorImpl.getService(Type, Annotation[])
org.jvnet.hk2.internal.IterableProviderImpl.get()
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.getMethodRouter(ContainerRequest)
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.access$400(MethodSelectingRouter, ContainerRequest)
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter$4.apply(ContainerRequest)
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.apply(ContainerRequest)
org.glassfish.jersey.server.internal.routing.RoutingStage._apply(ContainerRequest, Router)<4 recursive calls>
org.glassfish.jersey.server.internal.routing.RoutingStage.apply(ContainerRequest)
org.glassfish.jersey.server.internal.routing.RoutingStage.apply(Object)
org.glassfish.jersey.process.internal.Stages.process(Object, Stage, Ref)
org.glassfish.jersey.server.ServerRuntime$1.run()
org.glassfish.jersey.internal.Errors$1.call()<2 recursive calls>
org.glassfish.jersey.internal.Errors.process(Callable, boolean)
org.glassfish.jersey.internal.Errors.process(Producer, boolean)
org.glassfish.jersey.internal.Errors.process(Runnable)
org.glassfish.jersey.process.internal.RequestScope.runInScope(Runnable)
org.glassfish.jersey.server.ServerRuntime.process(ContainerRequest)
org.glassfish.jersey.server.ApplicationHandler.handle(ContainerRequest)
andras.jersey.JerseyNettyHandler.channelRead0(ChannelHandlerContext, FullHttpRequest)
andras.jersey.JerseyNettyHandler.channelRead0(ChannelHandlerContext, Object)
io.netty.channel.SimpleChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(Object)
io.netty.channel.DefaultChannelHandlerContext.access$800(DefaultChannelHandlerContext, Object)
io.netty.channel.DefaultChannelHandlerContext$9.run()
io.netty.util.concurrent.DefaultEventExecutor.run()
io.netty.util.concurrent.SingleThreadEventExecutor$2.run()
java.lang.Thread.run()



Stacks at 03:51:49 PM (uptime 7m 46s)


defaultEventExecutorGroup-4-16 [BLOCKED] CPU time: 12s
org.jvnet.hk2.internal.ServiceLocatorImpl.resolveContext(Class)
org.jvnet.hk2.internal.Utilities.createService(ActiveDescriptor, Injectee, ServiceLocatorImpl, ServiceHandle, Class)
org.jvnet.hk2.internal.ServiceLocatorImpl.getService(Type, Annotation[])
org.jvnet.hk2.internal.IterableProviderImpl.get()
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.getMethodRouter(ContainerRequest)
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.access$400(MethodSelectingRouter, ContainerRequest)
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter$4.apply(ContainerRequest)
org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.apply(ContainerRequest)
org.glassfish.jersey.server.internal.routing.RoutingStage._apply(ContainerRequest, Router)<4 recursive calls>
org.glassfish.jersey.server.internal.routing.RoutingStage.apply(ContainerRequest)
org.glassfish.jersey.server.internal.routing.RoutingStage.apply(Object)
org.glassfish.jersey.process.internal.Stages.process(Object, Stage, Ref)
org.glassfish.jersey.server.ServerRuntime$1.run()
org.glassfish.jersey.internal.Errors$1.call()<2 recursive calls>
org.glassfish.jersey.internal.Errors.process(Callable, boolean)
org.glassfish.jersey.internal.Errors.process(Producer, boolean)
org.glassfish.jersey.internal.Errors.process(Runnable)
org.glassfish.jersey.process.internal.RequestScope.runInScope(Runnable)
org.glassfish.jersey.server.ServerRuntime.process(ContainerRequest)
org.glassfish.jersey.server.ApplicationHandler.handle(ContainerRequest)
andras.jersey.JerseyNettyHandler.channelRead0(ChannelHandlerContext, FullHttpRequest)
andras.jersey.JerseyNettyHandler.channelRead0(ChannelHandlerContext, Object)
io.netty.channel.SimpleChannelInboundHandler.channelRead(ChannelHandlerContext, Object)
io.netty.channel.DefaultChannelHandlerContext.invokeChannelRead(Object)
io.netty.channel.DefaultChannelHandlerContext.access$800(DefaultChannelHandlerContext, Object)
io.netty.channel.DefaultChannelHandlerContext$9.run()
io.netty.util.concurrent.DefaultEventExecutor.run()
io.netty.util.concurrent.SingleThreadEventExecutor$2.run()
java.lang.Thread.run()



All suggestions are greatly appreciated!


thanks,
Andras