Skip to content

Conversation

@abstractdog
Copy link
Contributor

No description provided.

@abstractdog abstractdog changed the title CDPD-21956 TEZ-4277: AsyncDispatcher can hang on serviceStop if the eventhandling thread is in BLOCKED state TEZ-4277: AsyncDispatcher can hang on serviceStop if the eventhandling thread is in BLOCKED state Jan 29, 2021
@abstractdog abstractdog requested a review from jteagles January 29, 2021 16:27
…venthandling thread is in BLOCKED state

Change-Id: I1418c9dc9972d2231d961afd41f306307754cabd
}
stopped = true;
if (eventHandlingThread != null) {
eventHandlingThread.interrupt();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sharing the patch. Overall looks good. Minor comments below.

If you look at eventHandlingThread, it would be making a call to "protected void dispatch(Event event)". This method catches "throwable" and does not reset Thread's interrupt status. So in case, interrupt happened during dispatch, it would be silently gobbled up.

Can you add snippet to catch "InterruptedException" in asyncDispatcher::dispatch(), log that it got interrupted and just reset thread's interrupt status with ("Thread.currentThread().interrupt();"). This would ensure that the next iteration in event handler thread gets a chance to bail out.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks @rbalamohan, makes sense, I added it in a new commit

Copy link
Contributor

@rbalamohan rbalamohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left minor comment in the PR.

Copy link
Contributor

@rbalamohan rbalamohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added minor comment. Rest lgtm. +1

} else {
throw new Exception("No handler for registered for " + type);
}
} catch (InterruptedException ie) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add this within Throwable block (with instance of checks)? Rest lgtm.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, it's done

Copy link
Contributor

@rbalamohan rbalamohan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1

@abstractdog abstractdog merged commit 73bcabd into apache:master Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants