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 when writeLoop exits with an error #131

Open
slingamn opened this issue Feb 12, 2021 · 1 comment
Open

deadlock when writeLoop exits with an error #131

slingamn opened this issue Feb 12, 2021 · 1 comment

Comments

@slingamn
Copy link
Contributor

I'm using 8e7ce4b with some debugging printlns added, so the line numbers are slightly off (I'll provide links to the deadlocking calls as they appear in master):

SIGQUIT: quit
PC=0x46ede1 m=0 sigcode=0

goroutine 45 [semacquire, 24 minutes]:
sync.runtime_Semacquire(0xc0003e6010)
        /usr/local/go/src/runtime/sema.go:56 +0x45
sync.(*WaitGroup).Wait(0xc0003e6008)
        /usr/local/go/src/sync/waitgroup.go:130 +0x65
github.com/thoj/go-ircevent.(*Connection).Loop(0xc0003e6000)
        /redacted/vendor/github.com/thoj/go-ircevent/irc.go:245 +0x268
c2/cmd.(*Consumer).Client(0xc0003820f0, 0xc00009c500)
        /redacted/cmd/consumer.go:315 +0x419
created by c2/cmd.(*Consumer).Run
        /redacted/cmd/consumer.go:109 +0xe5

goroutine 107483 [select, 24 minutes]:
github.com/thoj/go-ircevent.(*Connection).RunCallbacks(0xc0003e6000, 0xc0002c0820)
        /redacted/vendor/github.com/thoj/go-ircevent/irc_callback.go:178 +0x565
github.com/thoj/go-ircevent.(*Connection).readLoop(0xc0003e6000)
        /redacted/vendor/github.com/thoj/go-ircevent/irc.go:88 +0x515
created by github.com/thoj/go-ircevent.(*Connection).Connect
        /redacted/vendor/github.com/thoj/go-ircevent/irc.go:487 +0x45e

goroutine 107785 [chan send, 24 minutes]:
github.com/thoj/go-ircevent.(*Connection).SendRaw(...)
        /redacted/vendor/github.com/thoj/go-ircevent/irc.go:346
c2/cmd.(*Consumer).ParseIRCMessage(0xc0003820f0, 0xc0002c0820)
        /redacted/cmd/consumer.go:665 +0x89e
c2/cmd.(*Consumer).Client.func3(0xc0002c0820)
        /redacted/cmd/consumer.go:291 +0x3b
github.com/thoj/go-ircevent.(*Connection).RunCallbacks.func1(0xc0003e6000, 0x0, 0xc0002c54a0, 0xc0003a6d80, 0xc0002c0820)
        /redacted/vendor/github.com/thoj/go-ircevent/irc_callback.go:164 +0x6d
created by github.com/thoj/go-ircevent.(*Connection).RunCallbacks
        /redacted/vendor/github.com/thoj/go-ircevent/irc_callback.go:162 +0x45e

Here are the deadlocking calls in master:

irc.Wait()

select {

irc.pwrite <- message + "\r\n"

From my debugging prints, it appears that writeLoop is exiting with an error here:

return

and then there's no consumer for attempts to send to (*Connection).pwrite, which blocks our callback from executing, which in turn blocks readLoop from completing.

Thanks for your time!

@slingamn
Copy link
Contributor Author

Here's a somewhat artificial, but illustrative, test case that reproduces reliably on my system against master:

https://gist.github.com/slingamn/ecafe727b0e2d35f0a04a627436c68ac

@slingamn slingamn mentioned this issue Apr 19, 2021
8 tasks
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

1 participant