Skip to content
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

Dead lock sometimes occurs when sending and listening in the same process (e.g. in a test case) #53

Open
FrederikP opened this issue Jun 12, 2019 · 0 comments

Comments

@FrederikP
Copy link

The sender and listener are using separate StompClient instances. This is the dead lock info:

Found one Java-level deadlock:
=============================
"vert.x-eventloop-thread-1":
  waiting to lock monitor 0x00007fa184003c98 (object 0x00000007733f9808, a io.vertx.ext.stomp.impl.StompClientConnectionImpl),
  which is held by "main"
"main":
  waiting to lock monitor 0x00007fa184003be8 (object 0x00000007733f8cc0, a io.vertx.core.net.impl.NetSocketImpl),
  which is held by "vert.x-eventloop-thread-1"

Java stack information for the threads listed above:
===================================================
"vert.x-eventloop-thread-1":
        at io.vertx.ext.stomp.impl.StompClientConnectionImpl.handle(StompClientConnectionImpl.java:520)
        - waiting to lock <0x00000007733f9808> (a io.vertx.ext.stomp.impl.StompClientConnectionImpl)
        at io.vertx.ext.stomp.impl.StompClientConnectionImpl.handle(StompClientConnectionImpl.java:40)
        at io.vertx.ext.stomp.impl.FrameParser.handleLine(FrameParser.java:91)
        at io.vertx.ext.stomp.impl.FrameParser$$Lambda$341/803919044.handle(Unknown Source)
        at io.vertx.core.parsetools.impl.RecordParserImpl.handleParsing(RecordParserImpl.java:197)
        at io.vertx.core.parsetools.impl.RecordParserImpl.handle(RecordParserImpl.java:259)
        at io.vertx.ext.stomp.impl.FrameParser.handle(FrameParser.java:221)
        - locked <0x00000007733f98f8> (a io.vertx.ext.stomp.impl.FrameParser)
        at io.vertx.ext.stomp.impl.StompClientConnectionImpl.lambda$new$2(StompClientConnectionImpl.java:107)
        at io.vertx.ext.stomp.impl.StompClientConnectionImpl$$Lambda$342/818696377.handle(Unknown Source)
        at io.vertx.core.net.impl.NetSocketImpl$DataMessageHandler.handle(NetSocketImpl.java:393)
        at io.vertx.core.streams.impl.InboundBuffer.handleEvent(InboundBuffer.java:230)
        at io.vertx.core.streams.impl.InboundBuffer.write(InboundBuffer.java:120)
        at io.vertx.core.net.impl.NetSocketImpl.handleMessage(NetSocketImpl.java:371)
        - locked <0x00000007733f8cc0> (a io.vertx.core.net.impl.NetSocketImpl)
        at io.vertx.core.net.impl.ConnectionBase.handleRead(ConnectionBase.java:390)
        at io.vertx.core.net.impl.VertxHandler$$Lambda$331/9417091.handle(Unknown Source)
        at io.vertx.core.impl.ContextImpl.executeTask(ContextImpl.java:320)
        at io.vertx.core.impl.EventLoopContext.execute(EventLoopContext.java:43)
        at io.vertx.core.impl.ContextImpl.executeFromIO(ContextImpl.java:188)
        at io.vertx.core.net.impl.VertxHandler.channelRead(VertxHandler.java:174)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:579)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:496)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:897)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
"main":
        at io.vertx.core.net.impl.NetSocketImpl.writeMessage(NetSocketImpl.java:113)
        - waiting to lock <0x00000007733f8cc0> (a io.vertx.core.net.impl.NetSocketImpl)
        at io.vertx.core.net.impl.NetSocketImpl.write(NetSocketImpl.java:159)
        at io.vertx.core.net.impl.NetSocketImpl.write(NetSocketImpl.java:137)
        at io.vertx.ext.stomp.impl.StompClientConnectionImpl.send(StompClientConnectionImpl.java:202)
        - locked <0x00000007733f9808> (a io.vertx.ext.stomp.impl.StompClientConnectionImpl)
        at io.vertx.ext.stomp.impl.StompClientConnectionImpl.send(StompClientConnectionImpl.java:233)
        at io.vertx.ext.stomp.impl.StompClientConnectionImpl.send(StompClientConnectionImpl.java:208)
        at com.example.testSimplePubSub(Test.java:105)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:628)
        at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:117)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$7(TestMethodTestDescriptor.java:184)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor$$Lambda$223/124734309.execute(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:180)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:127)
        at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:68)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$150/1043208434.execute(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$149/215219944.invoke(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$148/1243806178.execute(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$154/776700275.accept(Unknown Source)
        at java.util.ArrayList.forEach(ArrayList.java:1257)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$150/1043208434.execute(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$149/215219944.invoke(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$148/1243806178.execute(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService$$Lambda$154/776700275.accept(Unknown Source)
        at java.util.ArrayList.forEach(ArrayList.java:1257)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$150/1043208434.execute(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$149/215219944.invoke(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask$$Lambda$148/1243806178.execute(Unknown Source)
        at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
        at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
        at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
        at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:170)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:154)
        at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:90)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invokeAllTests(JUnitPlatformProvider.java:142)
        at org.apache.maven.surefire.junitplatform.JUnitPlatformProvider.invoke(JUnitPlatformProvider.java:117)
        at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:383)
        at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:344)
        at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:125)
        at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:417)

Found 1 deadlock.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant