/deadlock.go Secret
Last active
February 21, 2021 04:27
ircevent deadlock
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/tls" | |
"fmt" | |
"time" | |
"github.com/thoj/go-ircevent" | |
) | |
const serverssl = "testnet.oragono.io:6697" | |
func main() { | |
stamp := time.Now().UnixNano() % int64(time.Second) | |
nick := fmt.Sprintf("deadlock-%d", stamp) | |
channel := fmt.Sprintf("#ircevent-%d", stamp) | |
irccon := irc.IRC(nick, "IRCTestSSL") | |
irccon.Debug = true | |
irccon.UseTLS = true | |
irccon.TLSConfig = &tls.Config{InsecureSkipVerify: true} | |
irccon.AddCallback("001", func(e *irc.Event) { irccon.Join(channel) }) | |
irccon.AddCallback("366", func(e *irc.Event) { | |
// simulate being disconnected in the middle of a callback: | |
// send a raw QUIT command, outside of irccon.Quit(), which will | |
// cause the server to disconnect us: | |
irccon.SendRaw("QUIT") | |
// fill up the local send queue: | |
for i := 0; i < 10; i++ { | |
irccon.Privmsg(channel, "hi") | |
} | |
// give the server time to disconnect us: | |
time.Sleep(1 * time.Second) | |
// fill up the send queue again: | |
for i := 0; i < 20; i++ { | |
irccon.Privmsg(channel, "hi") | |
} | |
}) | |
err := irccon.Connect(serverssl) | |
if err != nil { | |
fmt.Printf("Err %s", err) | |
return | |
} | |
irccon.Loop() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SIGQUIT: quit | |
PC=0x46daa1 m=0 sigcode=0 | |
goroutine 0 [idle]: | |
runtime.futex(0x782a70, 0x80, 0x0, 0x0, 0x7ffc00000000, 0x7ffc12bb1918, 0x7ffc12b86868, 0x1, 0x7ffc12b86878, 0x40da9f, ...) | |
runtime/sys_linux_amd64.s:579 +0x21 | |
runtime.futexsleep(0x782a70, 0x0, 0xffffffffffffffff) | |
runtime/os_linux.go:44 +0x46 | |
runtime.notesleep(0x782a70) | |
runtime/lock_futex.go:159 +0x9f | |
runtime.mPark() | |
runtime/proc.go:1340 +0x39 | |
runtime.stopm() | |
runtime/proc.go:2257 +0x92 | |
runtime.findrunnable(0xc000026000, 0x0) | |
runtime/proc.go:2916 +0x72e | |
runtime.schedule() | |
runtime/proc.go:3125 +0x2d7 | |
runtime.park_m(0xc000001b00) | |
runtime/proc.go:3274 +0x9d | |
runtime.mcall(0x0) | |
runtime/asm_amd64.s:327 +0x5b | |
goroutine 1 [semacquire]: | |
sync.runtime_Semacquire(0xc000132010) | |
runtime/sema.go:56 +0x45 | |
sync.(*WaitGroup).Wait(0xc000132008) | |
sync/waitgroup.go:130 +0x65 | |
github.com/thoj/go-ircevent.(*Connection).Loop(0xc000132000) | |
github.com/thoj/go-ircevent/irc.go:242 +0x273 | |
main.main() | |
command-line-arguments/simple.go:43 +0x3fd | |
goroutine 19 [select]: | |
github.com/thoj/go-ircevent.(*Connection).RunCallbacks(0xc000132000, 0xc0001d23c0) | |
github.com/thoj/go-ircevent/irc_callback.go:178 +0x53f | |
github.com/thoj/go-ircevent.(*Connection).readLoop(0xc000132000) | |
github.com/thoj/go-ircevent/irc.go:88 +0x4f8 | |
created by github.com/thoj/go-ircevent.(*Connection).Connect | |
github.com/thoj/go-ircevent/irc.go:484 +0x45e | |
goroutine 36 [chan send]: | |
github.com/thoj/go-ircevent.(*Connection).Privmsg(...) | |
github.com/thoj/go-ircevent/irc.go:310 | |
main.main.func2(0xc0001d23c0) | |
command-line-arguments/simple.go:35 +0x2ad | |
github.com/thoj/go-ircevent.(*Connection).RunCallbacks.func1(0xc000132000, 0x0, 0xc0001a1a40, 0xc0000241c0, 0xc0001d23c0) | |
github.com/thoj/go-ircevent/irc_callback.go:164 +0x6a | |
created by github.com/thoj/go-ircevent.(*Connection).RunCallbacks | |
github.com/thoj/go-ircevent/irc_callback.go:162 +0x45e |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment