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

Reconnect hangs silently #21

Open
bkero opened this issue May 23, 2020 · 2 comments
Open

Reconnect hangs silently #21

bkero opened this issue May 23, 2020 · 2 comments

Comments

@bkero
Copy link

bkero commented May 23, 2020

Whenever my bot disconnects from an IRC network (irc.cat.pdx.edu) due to the following error:

2020/05/23 00:04:06 Error, disconnected: read tcp 192.168.42.50:51854->131.252.208.26:6697: i/o timeout
2020/05/23 00:04:07 Connected to irc.cat.pdx.edu:6697 (131.252.208.26:6697)

it fails to reconnect (I cannot /whois the bot on the network). The bot will remain in this state until I ctrl+Z and kill -9 %1 it. I do this because in this state the bot does not handle SIGTERMs well: it hangs after printing

^C2020-05-23 18:59:42 INFO main main.go:83 Exiting on interrupt```
@bkero
Copy link
Author

bkero commented May 27, 2020

Stracing this process reveals:

[pid 21956] nanosleep({tv_sec=0, tv_nsec=20000}, NULL) = 0
[pid 21956] nanosleep({tv_sec=0, tv_nsec=20000}, NULL) = 0
[pid 21956] nanosleep({tv_sec=0, tv_nsec=20000}, NULL) = 0
[pid 21956] futex(0xd95850, FUTEX_WAIT_PRIVATE, 0, {tv_sec=60, tv_nsec=0}

@mich181189
Copy link

mich181189 commented Jun 5, 2021

Edit: I'm not sure it was stuck here - I suspect someone restarted it before I got to it!


I have hit what I suspect to be this problem a few times. I attached a debugger to try to get some information. Nothing super helpful but I include it here in case it's useful to anyone

`(dlv) gr
Thread 754505 at /usr/lib/go-1.14/src/runtime/sys_linux_amd64.s:568

(dlv) bt
0 0x00000000004674b3 in runtime.futex
at /usr/lib/go-1.14/src/runtime/sys_linux_amd64.s:568
1 0x0000000000431b66 in runtime.futexsleep
at /usr/lib/go-1.14/src/runtime/os_linux.go:45
2 0x000000000040c86f in runtime.notesleep
at /usr/lib/go-1.14/src/runtime/lock_futex.go:151
3 0x000000000043c018 in runtime.stoplockedm
at /usr/lib/go-1.14/src/runtime/proc.go:1977
4 0x000000000043dc86 in runtime.schedule
at /usr/lib/go-1.14/src/runtime/proc.go:2460
5 0x000000000043e05d in runtime.park_m
at /usr/lib/go-1.14/src/runtime/proc.go:2696
6 0x000000000046320b in runtime.mcall
at /usr/lib/go-1.14/src/runtime/asm_amd64.s:318

(dlv) grs
Goroutine 1 - User: /home/mich181189/go/pkg/mod/github.com/thoj/go-ircevent@v0.0.0-20190807115034-8e7ce4b5a1eb/irc.go:238 github.com/thoj/go-ircevent.(*Connection).Loop (0x679ec3) [chan receive 449925h55m32.219338717s]
Goroutine 2 - User: /usr/lib/go-1.14/src/runtime/proc.go:305 runtime.gopark (0x437f50) [force gc (idle) 449919h48m51.544364881s]
Goroutine 3 - User: /usr/lib/go-1.14/src/runtime/proc.go:305 runtime.gopark (0x437f50) [GC sweep wait]
Goroutine 4 - User: /usr/lib/go-1.14/src/runtime/proc.go:305 runtime.gopark (0x437f50) [GC scavenge wait]
Goroutine 5 - User: /usr/lib/go-1.14/src/runtime/proc.go:305 runtime.gopark (0x437f50) [finalizer wait 449925h55m32.252438472s]
Goroutine 11 - User: /usr/lib/go-1.14/src/runtime/proc.go:305 runtime.gopark (0x437f50) [GC worker (idle)]
Goroutine 12 - User: /usr/lib/go-1.14/src/runtime/netpoll.go:203 internal/poll.runtime_pollWait (0x4303c5) [IO wait]
Goroutine 13 - User: /home/mich181189/go/pkg/mod/github.com/thoj/go-ircevent@v0.0.0-20190807115034-8e7ce4b5a1eb/irc.go:166 github.com/thoj/go-ircevent.(*Connection).writeLoop (0x679154) [select]
Goroutine 14 - User: /home/mich181189/go/pkg/mod/github.com/thoj/go-ircevent@v0.0.0-20190807115034-8e7ce4b5a1eb/irc.go:202 github.com/thoj/go-ircevent.(*Connection).pingLoop (0x679616) [select]
Goroutine 18 - User: /usr/lib/go-1.14/src/runtime/sema.go:56 sync.runtime_Semacquire (0x447f42) [semacquire 449925h55m32.252890161s]
Goroutine 19 - User: /usr/lib/go-1.14/src/syscall/asm_linux_amd64.s:50 syscall.Syscall6 (0x4c924a) (thread 754508)
Goroutine 20 - User: /home/mich181189/go/pkg/mod/github.com/spf13/viper@v1.5.0/viper.go:310 github.com/spf13/viper.(*Viper).WatchConfig.func1.1 (0x846556) [select 449925h55m32.252938075s]
Goroutine 27 - User: /usr/lib/go-1.14/src/runtime/sigqueue.go:147 os/signal.signal_recv (0x44c31c) (thread 754507)
Goroutine 28 - User: /usr/lib/go-1.14/src/runtime/proc.go:305 runtime.gopark (0x437f50) [select 449925h55m32.253059364s]
Goroutine 29 - User: /home/mich181189/irccat/main.go:87 main.(*IRCCat).signalHandler (0x8e66a6) [chan receive 449925h55m32.253093355s]
Goroutine 33 - User: /usr/lib/go-1.14/src/runtime/proc.go:305 runtime.gopark (0x437f50) [GC worker (idle)]
Goroutine 44 - User: /usr/lib/go-1.14/src/runtime/netpoll.go:203 internal/poll.runtime_pollWait (0x4303c5) [IO wait]
Goroutine 45 - User: /usr/lib/go-1.14/src/runtime/netpoll.go:203 internal/poll.runtime_pollWait (0x4303c5) [IO wait 449920h7m31.483101114s]
[18 goroutines]
`

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