|
[
Permlink
| « Hide
]
James Strachan added a comment - 12/Jun/07 06:42 AM
Patch applied with thanks!
I'm having some issues where slow performance in the backend database seems to lead to InactivityIOExceptions. My opinion is that the fix for this issue is causing those problems:
Having in mind that the design of the readCheck/writeCheck monitors is that we always should have a command among two readCheck (produced by normal activity or by the response of a KeepAlive injected by the writeCheck between two readChecks if needed), synchronizing on the readChecker variable seems a bad idea: If the chain of transportListener.onCommand() is lasting more than the negociated MaxInactivityDuration, we will end with two readCheck executing one after the other, without a writeCheck between them. The first readCheck success, sets the commandReceived to false, and the second one is always going to fail, as no new command has been processed, nor a writeCheck has been executed since the last readCheck. I don't see the need of synchronizing on the readChecker/writeChecker variables. These are AtomicBooleans and should be safe to access them from different threads (this seemed to be the motivation of the fix). Also, synchronizing the readCheck/writeCheck is actually delaying the execution of the check, and we cannot guarantee anymore the alternating of writeCheck readCheck execution, that is needed for the solution to work. Also, synchronizing that is avoiding this code in readCheck() : synchronized (readChecker) { if (inReceive.get()) { LOG.trace("A receive is in progress"); return; } to be reached: because inReceive is only set during onCommand, and that is synchronized on readChecker also. Furthermore, the right way to do this is returning here when a onCommand is performed at the same time, and not waiting, to not break the sequence of readCheck/writeCheck invocations. In few words, I think that this change breaks the InactivityMonitor, and my opinion is that it should be rolled back. Also in the 4.1 subtask that I opened some time ago. Any comments? After discussing the problem with Rob Davies in the IRC channel, I'm reopening this issue to rollback the synchronization for the readCheck/writeCheck.
tightened up the synchronizations in trunk. Now we only synchronize to avoid 2 concurrent sends going the next transport or to avoid 2 concurrent commands / exceptions from being delivered to the transport listener.
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||