[
https://issues.apache.org/jira/browse/HDDS-14860?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rishabh Patel updated HDDS-14860:
---------------------------------
Description:
[https://github.com/apache/ozone/blob/dc9952e446940b82b277a7e8c9d02239a8417a06/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/ThrottledAsyncChecker.java#L118]
`ThrottledAsyncChecker#schedule` has two preconditions:
# Is a check already in progress
# Was the previous check completed a long time ago
If both of these conditions are satisfied then a new check is scheduled.
However, consider a case where a check was never run or it was run a long time
ago. This situation will satisfy both the preconditions. Now if two threads
call the same schedule method for the same target/volume, there will be a race
condition and/or undefined behavior.
This is because the `checksInProgress` map is updated only towards the end of
the method.
We cannot simply update the checksInProgress at the start of the method as we
need the ListenableFuture available before we update that map.
was:
[https://github.com/apache/ozone/blob/dc9952e446940b82b277a7e8c9d02239a8417a06/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/ThrottledAsyncChecker.java#L118]
`ThrottledAsyncChecker#schedule` has two preconditions:
# Is a check already in progress
# Was the previous check completed a long time ago
If both of these conditions are satisfied then a new check is scheduled.
However, consider a case where a check was never run or it was run a long time
ago. This situation will satisfy both the preconditions. Now if two threads
call the same schedule method for the same target/volume, there will be a race
condition and/or undefined behavior.
This is because the `checksInProgress` map is updated only towards the end of
the method.
> ThrottledAsyncChecker does not schedule checks in a threadsafe manner
> ---------------------------------------------------------------------
>
> Key: HDDS-14860
> URL: https://issues.apache.org/jira/browse/HDDS-14860
> Project: Apache Ozone
> Issue Type: Bug
> Reporter: Rishabh Patel
> Assignee: Rishabh Patel
> Priority: Major
>
> [https://github.com/apache/ozone/blob/dc9952e446940b82b277a7e8c9d02239a8417a06/hadoop-hdds/container-service/src/main/java/org/apache/hadoop/ozone/container/common/volume/ThrottledAsyncChecker.java#L118]
>
> `ThrottledAsyncChecker#schedule` has two preconditions:
> # Is a check already in progress
> # Was the previous check completed a long time ago
> If both of these conditions are satisfied then a new check is scheduled.
> However, consider a case where a check was never run or it was run a long
> time ago. This situation will satisfy both the preconditions. Now if two
> threads call the same schedule method for the same target/volume, there will
> be a race condition and/or undefined behavior.
> This is because the `checksInProgress` map is updated only towards the end of
> the method.
> We cannot simply update the checksInProgress at the start of the method as we
> need the ListenableFuture available before we update that map.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]