[ 
https://issues.apache.org/jira/browse/HDDS-17380?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Ivan Andika updated HDDS-17380:
-------------------------------
    Description: 
*[P1] Scanner shutdown can deadlock during volume failure.*

AbstractBackgroundContainerScanner.java holds the scanner monitor while joining 
its worker. Meanwhile, the worker calls a synchronized shutdown method when it 
detects a failed volume:

 
{code:java}
Shutdown thread                    Scanner worker
Holds scanner monitor
                                   Detects failed volume
Waits for worker via join()
                                   Waits for scanner monitor{code}
 

Reproduced this using the actual scanner classes: the shutdown thread was 
{{WAITING}} in {{{}Thread.join(){}}}, and the worker was {{BLOCKED}} on its 
monitor.

The remedy is to signal shutdown under synchronization, then release the 
monitor before joining. {*}The subclass’s synchronized shutdown methods must 
also be considered{*}; moving {{join()}} outside synchronization only in the 
base class is insufficient.

  was:
*[P1] Scanner shutdown can deadlock during volume failure.*

AbstractBackgroundContainerScanner.java holds the scanner monitor while joining 
its worker. Meanwhile, the worker calls a synchronized shutdown method when it 
detects a failed volume:

{{Shutdown thread                    Scanner worker
Holds scanner monitor
                                   Detects failed volume
Waits for worker via join()
                                   Waits for scanner monitor}}

I reproduced this using the actual scanner classes: the shutdown thread was 
{{WAITING}} in {{{}Thread.join(){}}}, and the worker was {{BLOCKED}} on its 
monitor.

The remedy is to signal shutdown under synchronization, then release the 
monitor before joining. {*}The subclass’s synchronized shutdown methods must 
also be considered{*}; moving {{join()}} outside synchronization only in the 
base class is insufficient.


> Scanner shutdown can deadlock during volume failure
> ---------------------------------------------------
>
>                 Key: HDDS-17380
>                 URL: https://issues.apache.org/jira/browse/HDDS-17380
>             Project: Apache Ozone
>          Issue Type: Bug
>            Reporter: Ivan Andika
>            Assignee: Ivan Andika
>            Priority: Major
>
> *[P1] Scanner shutdown can deadlock during volume failure.*
> AbstractBackgroundContainerScanner.java holds the scanner monitor while 
> joining its worker. Meanwhile, the worker calls a synchronized shutdown 
> method when it detects a failed volume:
>  
> {code:java}
> Shutdown thread                    Scanner worker
> Holds scanner monitor
>                                    Detects failed volume
> Waits for worker via join()
>                                    Waits for scanner monitor{code}
>  
> Reproduced this using the actual scanner classes: the shutdown thread was 
> {{WAITING}} in {{{}Thread.join(){}}}, and the worker was {{BLOCKED}} on its 
> monitor.
> The remedy is to signal shutdown under synchronization, then release the 
> monitor before joining. {*}The subclass’s synchronized shutdown methods must 
> also be considered{*}; moving {{join()}} outside synchronization only in the 
> base class is insufficient.



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to