You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ozone.apache.org by "Stephen O'Donnell (Jira)" <ji...@apache.org> on 2022/04/27 14:51:00 UTC
[jira] [Created] (HDDS-6658) BackgroundPipelineCreator does not always stop quickly
Stephen O'Donnell created HDDS-6658:
---------------------------------------
Summary: BackgroundPipelineCreator does not always stop quickly
Key: HDDS-6658
URL: https://issues.apache.org/jira/browse/HDDS-6658
Project: Apache Ozone
Issue Type: Improvement
Reporter: Stephen O'Donnell
Assignee: Stephen O'Donnell
On my laptop, TestSCMSafeModeManager.testSafeModePipelineExitRule() always takes just over 200 seconds. Checking a few PR runs, it does not seem to be slow on PRs, just locally.
Debugging the code, it seems to hang in the BackgroundPipelineCreator.stop() method, where it is waiting for the tread to join:
{code}
public void stop() {
if (!running.compareAndSet(true, false)) {
LOG.warn("{} is not running, just ignore.", THREAD_NAME);
return;
}
LOG.info("Stopping {}.", THREAD_NAME);
// in case RatisPipelineUtilsThread is sleeping
synchronized (monitor) {
monitor.notifyAll();
}
try {
thread.join(); // ----> Hangs here
} catch (InterruptedException e) {
LOG.warn("Interrupted during join {}.", THREAD_NAME);
Thread.currentThread().interrupt();
}
}
{code}
It is clearly hanging as the background thread did not exit, and I believe it is because `notify()` is being used to try to exit the thread, when it should really be interrupted. There is a chance that notify is called while the thread is not waiting, and if so, it will just fall back into the wait state and not exit until it wakes up again.
--
This message was sent by Atlassian Jira
(v8.20.7#820007)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@ozone.apache.org
For additional commands, e-mail: issues-help@ozone.apache.org