[jboss-jira] [JBoss JIRA] (JGRP-2287) Thread safety issues and race conditions in VERIFY_SUSPECT

Bela Ban (Jira) issues at jboss.org
Wed Jan 9 06:08:00 EST 2019


    [ https://issues.jboss.org/browse/JGRP-2287?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13679729#comment-13679729 ] 

Bela Ban edited comment on JGRP-2287 at 1/9/19 6:07 AM:
--------------------------------------------------------

Re 1: {{DelayQueue}} is synchronized, so why should this be a problem?
Re 2: {{timer}} was set to {{volatile}} by a PR
Re 3: I changed the code slightly, so that adding to the queue and setting {{running}} is done atomically, pluschecking for the empty queue in {{run()}} and setting {{running=false}} is also done atomically.


was (Author: belaban):
Re 1: {{DelayQueue}} is synchronized, so why should this be a problem?
Re 2: {{timer}} was set to {{volatile}} by a PR

> 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.



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list