You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There is a data race (according to the Java memory model) in the field readOnlyBearerAuth in class RegistryClient.java. Due to this data race, it is possible that writes on the variable by one thread are not visible to other threads reading the variable in the future. This can happen, for instance, if two threads concurrent execute doPullBearerAuth() and doPushBearerAuth().
Expected behavior:
Threads reading stale or outdated writes on the field readOnlyBearerAuth in class RegistryClient.java
Steps to reproduce:
Consider two threads t1 and t2 and let readOnlyBearerAuth==false. Consider that t1 executes doPullBearerAuth() and concurrently t2 executes doPushBearerAuth(). The following execution can occur:
Environment:
Description of the issue:
There is a data race (according to the Java memory model) in the field
readOnlyBearerAuth
in classRegistryClient.java
. Due to this data race, it is possible that writes on the variable by one thread are not visible to other threads reading the variable in the future. This can happen, for instance, if two threads concurrent executedoPullBearerAuth()
anddoPushBearerAuth()
.Expected behavior:
Threads reading stale or outdated writes on the field
readOnlyBearerAuth
in classRegistryClient.java
Steps to reproduce:
Consider two threads
t1
andt2
and letreadOnlyBearerAuth==false
. Consider that t1 executesdoPullBearerAuth()
and concurrently t2 executesdoPushBearerAuth()
. The following execution can occur:readOnlyBearerAuth
as false in this linereadOnlyBearerAuth
as false (because there is no happens-before relation between the write by t1 and this read and the java memory model does not ensure that the write by t1 is visible to t2)Additional Information:
The problem can be solved by defining
readOnlyBearerAuth
asvolatile
.The text was updated successfully, but these errors were encountered: