]
Bela Ban commented on JGRP-2287:
--------------------------------
Re 1: {{DelayQueue}} is synchronized, so why should this be a problem?
Thread safety issues and race conditions in VERIFY_SUSPECT
----------------------------------------------------------
Key: JGRP-2287
URL:
https://issues.jboss.org/browse/JGRP-2287
Project: JGroups
Issue Type: Bug
Affects Versions: 4.0.13
Reporter: Paul Ferraro
Assignee: Bela Ban
Priority: Critical
Fix For: 4.0.16
While addressing JGRP-2286, I noticed a number of thread safety issues and race
conditions in VERIFY_SUSPECT, e.g.
1. "suspects" DelayQueue is accessed concurrently within synchronized block by
most of the code, however, the run() method calls isEmpty(), size(), and most notably,
drainTo(...) without sufficient exclusivity. drainTo is particularly problematic in the
case of concurrent modifications.
2. "timer" Thread is non-volatile, but its reference is set by multiple
threads.
3. The startTimer() method only creates a new thread if Thread.isAlive() returns false.
However, if the thread is just completing (i.e. exiting its loop), this method can return
true, and the verification of suspected members can be delayed until the next suspect
event.