Bug 46990

Summary: Synchronize target can be changed midway
Product: Tomcat 6 Reporter: Sebb <sebb>
Component: CatalinaAssignee: Tomcat Developers Mailing List <dev>
Severity: normal CC: rombiama
Priority: P2    
Version: unspecified   
Target Milestone: default   
Hardware: PC   
OS: Windows XP   
Attachments: Fix broken synchronization

Description Sebb 2009-04-07 18:52:10 UTC
Created attachment 23455 [details]
Fix broken synchronization

Various classes synchronize on a variable which is then changed. This will not have the desired effect, as all accesses must use the same lock in order for the synchronisation to work correctly.

The patch adds new final lock objects (which cannot be changed midway).

It also adds some additional synchronization to various get() methods to ensure that reader threads get the correct updates.
Comment 1 Mark Thomas 2009-04-08 09:10:50 UTC
Thanks for the patch. I have applied to trunk and proposed it for 6.0.x. Whilst there aren't any explicit bugs caused by this it may be behind some of the harder to reproduce bugs.
Comment 2 Sebb 2009-04-08 09:15:47 UTC

That's the problem with incomplete or incorrect synchronization - most of the time, things work as expected. It's also really difficult to force the errors to occur...
Comment 3 Mark Thomas 2009-05-02 18:16:09 UTC
This has been applied to 6.0.x and will be included in 6.0.20 onwards.
Comment 4 Rainer Jung 2009-07-01 12:16:51 UTC
Cluster membership sync improvement applied to TC 5.5 as r790321.
Will be part of 5.5.28.
Comment 5 Mark Thomas 2009-08-05 03:40:11 UTC
Removed spam.