Skip to content
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

dead lock occur between Subscription and Subscriber #31

Open
wolfjiang opened this issue Sep 25, 2020 · 0 comments
Open

dead lock occur between Subscription and Subscriber #31

wolfjiang opened this issue Sep 25, 2020 · 0 comments
Assignees

Comments

@wolfjiang
Copy link

Subscription.distributeMaxInFlight() lock itself with sync lock, and than access Subscriber.getLookupIntervalSecs() to get sync lock of Subscriber.

another thread Subscriber.lookup() lock itself with sync lock and than access Subscription.checkConnections() to get sync lock of Subscription.

the thread dump as follow:

"nsq-sub-0":
at com.sproutsocial.nsq.Subscriber.getLookupIntervalSecs(Subscriber.java:213)
- waiting to lock <0x00000003efa47af8> (a com.sproutsocial.nsq.Subscriber)
at com.sproutsocial.nsq.Subscription.distributeMaxInFlight(Subscription.java:76)
at com.sproutsocial.nsq.Subscription.setMaxInFlight(Subscription.java:38)
- locked <> 0x00000003efa47ff8(a com.sproutsocial.nsq.Subscription)
at com.sproutsocial.nsq.BackoffHandler.successDuringBackoff(BackoffHandler.java:103)
- locked <0x00000003efa480a0> (a com.sproutsocial.nsq.BackoffHandler)
at com.sproutsocial.nsq.BackoffHandler.accept(BackoffHandler.java:45)
at com.sproutsocial.nsq.SubConnection$3.run(SubConnection.java:178)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
"nsq-sched-1":
at com.sproutsocial.nsq.Subscription.checkConnections(Subscription.java:42)
- waiting to lock <0x00000003efa47ff8> (a com.sproutsocial.nsq.Subscription)
at com.sproutsocial.nsq.Subscriber.lookup(Subscriber.java:112)
- locked <0x00000003efa47af8> (a com.sproutsocial.nsq.Subscriber)
at com.sproutsocial.nsq.Subscriber.access$000(Subscriber.java:27)
at com.sproutsocial.nsq.Subscriber$1.run(Subscriber.java:51)
at com.sproutsocial.nsq.Client$1.run(Client.java:162)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)

subscriber.getLookupIntervalSecs() should not be synchronized?

@blakesmith blakesmith self-assigned this Oct 6, 2022
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

No branches or pull requests

2 participants