Status: Resolved (View Workflow)
Affects Version/s: 1.0.17.Final, 2.0.1.Final
Fix Version/s: 4.0.0.Final
Steps to Reproduce:
I don't know for sure how to reproduce WAITING state for connection. Maybe this topic will help - https://developer.jboss.org/thread/205784.
We use scoped EJB contexts to connect between wildfly servers and faced the following issue.
Connection to some servers were blocked by firewall, so any connection attempt failed with timeout. It’s value was set to 1 minute.
So, connection hanged for 1 minute at org.jboss.ejb.client.remoting.ConnectionPool#getConnection at IOFutureHelper#get call.
Since this method is synchronized other threads couldn’t connect to other servers as well which caused major performance slowdown on entire platform.
Firewall configuration was incorrect, but anyway we need to make sure that if we add some servers and forget to adjust firewall configuration - it won’t lead to entire platform slowdown.
So, to avoid this issue in future we decreased timeout to 15 seconds and applied patch to jboss-ejb-client 2.0.1 distributive inside wildfly (attached).
The patch removes synchronized methods and creates unique synchronization mutexes based on connection properties.
We also cancel IOFuture in case connection failed to timeout.
The reason for that we had the issue with many blocked threads hanged at AbstractHandleableCloseable#close. The were few exceptions "Operation failed with status WAITING" just before this hang happened.
Stacktrace from jboss 7.2.0 and ejbclient 1.0.17
I don't know for sure that it's effective, because we also applied Service locator pattern in our code to avoid closing of naming contexts at all, but it seems like logical thing to do.