[ 
https://issues.apache.org/jira/browse/FLINK-21365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17284623#comment-17284623
 ] 

Piotr Nowojski commented on FLINK-21365:
----------------------------------------

Yes, atomic compareAndSwap establishes both read and write happens-before. 
{quote}
compareAndSet and all other read-and-update operations such as getAndIncrement 
have the memory effects of both reading and writing volatile variables.
{quote}
https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/package-summary.html

Additionally:
{quote}
If we have two actions x and y, we write hb(x, y) to indicate that x 
happens-before y.
- If x and y are actions of the same thread and x comes before y in program 
order, then hb(x, y).
(...)
{quote}
https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html#jls-17.4.5

So AFAI-cen-tell there is a chain of happens-before between all updates and the 
final completion.

> Visibility issue in FutureUtils.ResultConjunctFuture.handleCompletedFuture 
> ---------------------------------------------------------------------------
>
>                 Key: FLINK-21365
>                 URL: https://issues.apache.org/jira/browse/FLINK-21365
>             Project: Flink
>          Issue Type: Bug
>          Components: Runtime / Coordination
>    Affects Versions: 1.11.3, 1.12.1
>            Reporter: Roman Khachatryan
>            Assignee: Roman Khachatryan
>            Priority: Major
>             Fix For: 1.11.4, 1.12.2, 1.13.0
>
>
> * FutureUtils.ResultConjunctFuture.handleCompletedFuture can update *results* 
> array from multiple threads
> * The array is declared as volatile but this only means the reference is 
> volatile, not the contents
> * There are no other guards



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to