-
Patch
-
Resolution: Obsolete
-
Major
-
JBossAS-4.0.3 Final
-
None
The server side of org.jboss.invocation.pooled has multiple synchronization issues.
For example, it relies on the fact, that Thread.interrupt() interrupts IO Operations such as read on network sockets.
This is not the case and causes deadlocks. This has been actually observed with all ServerThreads stuck in
byte ACK = in.readByte();
Another example of a synchronization issue is the fact, that with multiple acceptor threads in PooledInvoker the method
a second evict can be called on a server thread before the first wakeup is called. This causes the wrong socket to be closed.
Another problem is, that the code does not handle spurious wakeups in wait() correctly,
which are allowed by the Java language specification.
Other problems are mentioned by the author in the code.
For that reason I have rewritten the synchronization parts of ServerThreads, putting these parts in two separate classes
Worker (encapsulating the parts corresponding to ServerThread) and Acceptor (corresponding to the network socket accepting threads
in PooledInvoker). The classes ServerThread and PooledInvoker have been modified to use this logic.
The client side is unchanged.
I will attach the sources to this bug report. They contain the files
Acceptor.java
PooledInvoker.java
ServerThread.java
Worker.java
LRUPool.java
PooledInvokerMBean.java
Test.java
in the directory org/jboss/invocation/pooled/server2
The configuration of this invoker works the same way as the old pooled invoker, e.g.:
<?xml version="1.0" encoding="utf-8"?>
<server>
<mbean code="org.jboss.invocation.pooled.server2.PooledInvoker"
name="jboss:service=invoker,type=pooled,socketType=SSL">
<attribute name="NumAcceptThreads">1</attribute>
<attribute name="MaxPoolSize">5</attribute>
<attribute name="ClientMaxPoolSize">5</attribute>
<attribute name="SocketTimeout">0</attribute>
<attribute name="ServerBindAddress">${jboss.bind.address}</attribute>
<attribute name="ServerBindPort">13333</attribute>
<attribute name="ClientConnectAddress">${jboss.bind.address}</attribute>
<attribute name="ClientConnectPort">0</attribute>
<attribute name="EnableTcpNoDelay">true</attribute>
<depends optional-attribute-name="TransactionManagerService">jboss:service=Trans
actionManager</depends>
</mbean>
</server>
If there is interest in integrating this into the JBoss source, I will rework the sources to conform to JBoss coding style.