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

Deadlock #2

Closed
f4th4n opened this issue Jul 31, 2019 · 2 comments
Closed

Deadlock #2

f4th4n opened this issue Jul 31, 2019 · 2 comments
Assignees

Comments

@f4th4n
Copy link
Contributor

f4th4n commented Jul 31, 2019

:try-pd$ go run main.go

test1
test2
test3
fatal error: all goroutines are asleep - deadlock!

goroutine 1 [chan send]:
github.com/kkdai/pubsub.(*Pubsub).Publish(0xc000092c60, 0x4a6140, 0x4e0c80, 0xc000092c50, 0x1, 0x1)
	/home/fathan/work/go/src/github.com/kkdai/pubsub/pubsub.go:77 +0x74
main.main()
	/home/fathan/tmp/try-pd/main.go:35 +0x660
exit status 2

How to fix this?

@kkdai kkdai self-assigned this Aug 1, 2019
@kkdai
Copy link
Owner

kkdai commented Aug 3, 2019

Hi @f4th4n

Thank you for asking, I might make a mistake about my example code.
I have fixed it by df2dc45

The root cause is both c1 and c2 have subscribed topic2, and I publish test3 to topic2 but forget to get from c2.

So next time publish will introduce the channel block.

Hope it help to resolve your question and thank tyou again.

@f4th4n
Copy link
Contributor Author

f4th4n commented Aug 3, 2019

Yes, ty. closed

@f4th4n f4th4n closed this as completed Aug 3, 2019
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