JBoss hangs in database queries

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP)

Issue

  • JBoss is unresponsive with many threads hanging in socket reads from database queries, for example:
"http-127.0.0.1-8080-1" daemon prio=10 tid=0x00007f60bc02b800 nid=0xb83 runnable [0x00007f60a52e7000]
   java.lang.Thread.State: RUNNABLE
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at com.microsoft.sqlserver.jdbc.TDSChannel.read(IOBuffer.java:1782)
	at com.microsoft.sqlserver.jdbc.TDSReader.readPacket(IOBuffer.java:4838)
	- locked <0x000000074ca9e9a8> (a com.microsoft.sqlserver.jdbc.TDSReader)
	at com.microsoft.sqlserver.jdbc.TDSCommand.startResponse(IOBuffer.java:6150)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(SQLServerPreparedStatement.java:402)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(SQLServerPreparedStatement.java:350)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:5696)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:1715)
	- locked <0x00000007592fc208> (a java.lang.Object)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(SQLServerStatement.java:180)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(SQLServerStatement.java:155)
	at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:285)
	at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:342)

Resolution

  • Address any database side issues
  • Set a <query-timeout> on the impacted datasource to limit the duration of a database query becoming unresponsive. That timeout is 15 minutes by default.

Root Cause

  • Database side issues are delaying responses to JBoss queries

Diagnostic Steps

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.