Bug 46990 - Synchronize target can be changed midway
Summary: Synchronize target can be changed midway
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Catalina (show other bugs)
Version: unspecified
Hardware: PC Windows XP
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2009-04-07 18:52 UTC by Sebb
Modified: 2009-08-05 03:40 UTC (History)
1 user (show)

Fix broken synchronization (19.90 KB, patch)
2009-04-07 18:52 UTC, Sebb
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.