Recently, DWR has been widely used in a project. However, it will not be long before it can be launched, and frequent crashes may occur.
After multiple troubleshooting (using yourkit), the problem was finally locked to the deadlock and located in the org. directwebremoting. impl. defaultscriptsessionmanager. invalidate method of DWR.
After Google, found the official BUG Tracking: http://getahead.org/bugs/browse/DWR-60
According to the official statement, this bug will be solved in version 2.0.rc4.
So I went to the latest version 2.1, but the nightmare continued...
The deadlock problem still exists, which does not mean any slowdown.
So I tried to adopt Scott Rankin's opinion:
Modify source code
The easist thing I can see to do is to move the for loop at the end of checktimeouts () inside the synchronized block. That way it 'd be guaranteed not to deadlock.
This change made me feel at ease for three days, but the nightmare continues...
The problem has been around for nearly two months, and there is no clue at all...
In the desperate moment, a colleague rummaging folder, suddenly opened tomcat/webapps/.../WEB-INF/lib
A dwr. jar package stays there all over the world, and suddenly it feels like it is flying over. Delete the DWR. jar file immediately.
A week has passed, and two weeks have passed, and I have finally achieved the expected stability.
Cause: There are two DWR. Jar packages in classpath. As a result, DWR will reference the other when busy and there are two instance objects in the context.
When a large number of synchronization is used in DWR, the deadlock is a matter of course.