Skip to content

GH-2627: Deadlock on lifecycleMonitor Regression #2629

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -350,18 +350,22 @@ protected void doStop(final Runnable callback, boolean normal) {

@Override
public void childStopped(MessageListenerContainer child, Reason reason) {
synchronized (this.lifecycleMonitor) {
if (this.reason == null || reason.equals(Reason.AUTH)) {
this.reason = reason;
}
if (Reason.AUTH.equals(this.reason)
&& getContainerProperties().isRestartAfterAuthExceptions()
&& this.concurrency == this.stoppedContainers.incrementAndGet()) {
if (this.reason == null || reason.equals(Reason.AUTH)) {
this.reason = reason;
}
if (Reason.AUTH.equals(this.reason)
&& getContainerProperties().isRestartAfterAuthExceptions()
&& this.concurrency == this.stoppedContainers.incrementAndGet()) {

this.reason = null;
this.stoppedContainers.set(0);

this.reason = null;
this.stoppedContainers.set(0);
doStart();
// This has to run on another thread to avoid a deadlock on lifecycleMonitor
AsyncTaskExecutor exec = getContainerProperties().getListenerTaskExecutor();
if (exec == null) {
exec = new SimpleAsyncTaskExecutor(getListenerId() + ".authRestart");
}
exec.execute(() -> start());
}
}

Expand Down