Solution to DWR deadlock

Source: Internet
Author: User
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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.