Bug 1142538 - [GSS] (6.3.z) Deadlock when CLI is interrupted by long VM pause
Summary: [GSS] (6.3.z) Deadlock when CLI is interrupted by long VM pause
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: JBoss Enterprise Application Platform 6
Classification: JBoss
Component: Other
Version: 6.3.0
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: CR1
: EAP 6.3.3
Assignee: Chao Wang
QA Contact: Pavel Slavicek
eap-docs
URL:
Whiteboard:
Depends On: 1140880
Blocks: 1144598 eap633-payload
TreeView+ depends on / blocked
 
Reported: 2014-09-17 02:06 UTC by James Livingston
Modified: 2019-08-19 12:39 UTC (History)
7 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of: 1140880
Environment:
Last Closed: 2019-08-19 12:39:29 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker XNIO-237 0 Major Closed Do not reuse buffers as locks 2019-03-04 07:27:32 UTC

Description James Livingston 2014-09-17 02:06:55 UTC
+++ This bug was initially created as a clone of Bug #1140880 +++

If a CLI session is open and there is a long OS-level pause, such as from the hypervisor snapshotting a guest VM, it can cause a race between the shudown and read processing.

This was fixed in https://github.com/xnio/xnio/commit/2bdbbf2d2

Comment 2 Ivo Studensky 2014-09-25 13:48:01 UTC
Fixed in XNIO 3.0.11.

Comment 3 JBoss JIRA Server 2014-09-29 06:56:08 UTC
Ivo Studensky <istudens> updated the status of jira XNIO-237 to Reopened

Comment 4 JBoss JIRA Server 2014-10-15 13:10:26 UTC
Ivo Studensky <istudens> updated the status of jira XNIO-237 to Closed

Comment 5 Hynek Mlnarik 2014-10-16 10:38:35 UTC
FailedQA in EAP 6.3.2.CP.CR1.

The following deadlock still exists.


Steps to Reproduce:
1. Prepare a running EAP instance with secured management port - optionally in VM
2. Execute export JAVA_OPTS="-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=y"
3. In the same terminal, execute "bin/jboss-cli.sh --connect --controller=$EAP_IP --user=admin --password=password ':read-resource'"
4. From yet another terminal, execute "jdb -attach localhost:8787"
5. In JDB: 
5.a. Create breakpoint: "stop in org.xnio.channels.FramedMessageChannel.receive(java.nio.ByteBuffer)"
5.b. Resume all threads: "resume"
5.c. [Execute five times] Wait until breakpoint is hit and execute "resume". Either set timeout or be fast so that timeout does not occur first
6. Execute "kill -9 $EAP_PID" - optionally in VM
7. In JDB:
8.a. Remove breakpoint: "clear org.xnio.channels.FramedMessageChannel.receive(java.nio.ByteBuffer)"
8.b. Resume all threads: "resume"
9. Now dump the stack trace of jboss-cli.sh: "kill -3 $JBOSS_CLI_PID"




Found one Java-level deadlock:
=============================
"Remoting "cli-client" read-1":
  waiting to lock monitor 0x00007ff9c829b558 (object 0x0000000783433408, a java.lang.String),
  which is held by "main"
"main":
  waiting to lock monitor 0x00007ff9c8333c48 (object 0x00000007851ae6e0, a java.util.ArrayDeque),
  which is held by "Remoting "cli-client" read-1"

Java stack information for the threads listed above:
===================================================
"Remoting "cli-client" read-1":
        at org.jboss.as.cli.impl.CLIModelControllerClient$ChannelCloseHandler.handleClose(CLIModelControllerClient.java:286)
        - waiting to lock <0x0000000783433408> (a java.lang.String)
        at org.jboss.as.cli.impl.CLIModelControllerClient$ChannelCloseHandler.handleClose(CLIModelControllerClient.java:269)
        at org.jboss.remoting3.spi.SpiUtils.safeHandleClose(SpiUtils.java:54)
        at org.jboss.remoting3.spi.AbstractHandleableCloseable$CloseHandlerTask.run(AbstractHandleableCloseable.java:501)
        at org.jboss.remoting3.spi.AbstractHandleableCloseable.runCloseTask(AbstractHandleableCloseable.java:406)
        at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeComplete(AbstractHandleableCloseable.java:277)
        at org.jboss.remoting3.remote.RemoteConnectionChannel.closeAction(RemoteConnectionChannel.java:532)
        at org.jboss.remoting3.spi.AbstractHandleableCloseable.closeAsync(AbstractHandleableCloseable.java:359)
        at org.jboss.remoting3.remote.RemoteConnectionHandler.closeAllChannels(RemoteConnectionHandler.java:392)
        - locked <0x00000007851ae6e0> (a java.util.ArrayDeque)
        at org.jboss.remoting3.remote.RemoteConnectionHandler.handleConnectionClose(RemoteConnectionHandler.java:109)
        at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:81)
        - locked <0x00000007851ae6e0> (a java.util.ArrayDeque)
        at org.jboss.remoting3.remote.RemoteReadListener.handleEvent(RemoteReadListener.java:45)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
        at org.xnio.ssl.JsseConnectedSslStreamChannel.handleReadable(JsseConnectedSslStreamChannel.java:183)
        at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
        at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
        at org.xnio.nio.NioHandle.run(NioHandle.java:90)
        at org.xnio.nio.WorkerThread.run(WorkerThread.java:198)
"main":
        at org.jboss.remoting3.remote.RemoteConnectionChannel.receiveMessage(RemoteConnectionChannel.java:361)
        - waiting to lock <0x00000007851ae6e0> (a java.util.ArrayDeque)
        at org.jboss.as.protocol.mgmt.FutureManagementChannel$Establishing.connectionOpened(FutureManagementChannel.java:217)
        at org.jboss.as.protocol.ProtocolConnectionManager.connect(ProtocolConnectionManager.java:78)
        - locked <0x0000000784978a00> (a org.jboss.as.protocol.ProtocolConnectionManager)
        at org.jboss.as.protocol.mgmt.FutureManagementChannel$Establishing.getChannel(FutureManagementChannel.java:204)
        at org.jboss.as.cli.impl.CLIModelControllerClient.getOrCreateChannel(CLIModelControllerClient.java:160)
        - locked <0x0000000783433408> (a java.lang.String)
        at org.jboss.as.cli.impl.CLIModelControllerClient$2.getChannel(CLIModelControllerClient.java:120)
        at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:123)
        at org.jboss.as.protocol.mgmt.ManagementChannelHandler.executeRequest(ManagementChannelHandler.java:98)
        at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeRequest(AbstractModelControllerClient.java:236)
        at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:141)
        at org.jboss.as.controller.client.impl.AbstractModelControllerClient.executeForResult(AbstractModelControllerClient.java:127)
        at org.jboss.as.controller.client.impl.AbstractModelControllerClient.execute(AbstractModelControllerClient.java:71)
        at org.jboss.as.cli.impl.CommandContextImpl.tryConnection(CommandContextImpl.java:980)
        at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:841)
        at org.jboss.as.cli.impl.CommandContextImpl.connectController(CommandContextImpl.java:817)
        at org.jboss.as.cli.impl.CliLauncher.initCommandContext(CliLauncher.java:282)
        at org.jboss.as.cli.impl.CliLauncher.main(CliLauncher.java:250)
        at org.jboss.as.cli.CommandLineMain.main(CommandLineMain.java:34)
        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:483)
        at org.jboss.modules.Module.run(Module.java:312)
        at org.jboss.modules.Main.main(Main.java:460)

Comment 6 Ivo Studensky 2014-10-16 12:03:04 UTC
Another issue is that CLI locks on a string literal which is not preferable way.

org.jboss.as.cli.impl.CLIModelControllerClient:
...
private final Object lock = "lock";
...

Comment 9 Hynek Mlnarik 2015-01-19 11:42:35 UTC
Verified in 6.3.3.CP.CR1


Note You need to log in before you can comment on or make changes to this bug.