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

Runtime error when using the client during reconnect #14

Closed
fleaz opened this issue Aug 16, 2018 · 2 comments
Closed

Runtime error when using the client during reconnect #14

fleaz opened this issue Aug 16, 2018 · 2 comments
Labels

Comments

@fleaz
Copy link

fleaz commented Aug 16, 2018

Hi,

I'm using the girc library in one of my projects and just added some code from the girc examples to reconnecting to the IRC server.
This works perfectly fine and when the connection is lost, he reconencts automatically after the given delay. But the problem is, that when a other goroutine tries to call e.g. Cmd.Message() to send something during the time between the connection is lost and girc reconnects, it ends up with a SIGSEGV and crashes. See the attached stacktrace

I'm not sure if this is a library problem of girc or if I should catch this and don't use the client during reconenction.

Please let me know if you need more informations to debug this.

Best regards,
Felix

2018/08/15 22:09:11 Connection to irc.hackint.eu:6667 terminated: timed out waiting for a requested PING response
2018/08/15 22:09:11 Reconnecting to irc.hackint.eu:6667 in 30 seconds...

<other gorouting calls Cmd.Message() at this moment>

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x7c03ff]

goroutine 18 [running]:
github.com/lrstanley/girc.(*ircConn).rate(0x0, 0x15, 0x0)
	/home/fleaz/workspace/go/src/github.com/lrstanley/girc/conn.go:411 +0x2f
github.com/lrstanley/girc.(*Client).Send(0xc42018e000, 0xc420310770)
	/home/fleaz/workspace/go/src/github.com/lrstanley/girc/conn.go:389 +0x17d
github.com/lrstanley/girc.(*Commands).Message(0xc42017a030, 0xc420024a24, 0x6, 0xc4203331c0, 0x5)
	/home/fleaz/workspace/go/src/github.com/lrstanley/girc/commands.go:108 +0xf5
main.channelReceiver()
	/home/fleaz/workspace/go/src/github.com/f-breidenstein/CptHook/irc.go:106 +0xe8
created by main.ircConnection
	/home/fleaz/workspace/go/src/github.com/f-breidenstein/CptHook/irc.go:87 +0x339
@lrstanley
Copy link
Owner

I'm sorry for the delay -- I've been quite busy with IRL issues. Generally speaking, I haven't done too much testing in regards to sending things outside of the main callback event loops (e.g. Add(), AddBg()). This is in fact a bug -- not quite sure how I want to solve it yet though.

@lrstanley
Copy link
Owner

I'm very late to getting this resolved, sorry about that. I see you found a workaround, though let me know if you see any further issues. I was putting off, thinking it was going to be quite a bit of a rewrite to resolve, but looks like it was specifically related to ratelimiting (and thus much easier to fix).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants