layeh / gumble

gumble is a Mumble client implementation in Go (golang)
https://pkg.go.dev/mod/layeh.com/gumble
Mozilla Public License 2.0
173 stars 53 forks source link

Crash when attaching "gumbleutil.AutoBitrate" #19

Closed jcdesimp closed 8 years ago

jcdesimp commented 8 years ago

I get the following errors and a crash if I attempt to connect mumble to a server after attaching the gumbleutil.AutoBitrate to the client:

panic: runtime error: integer divide by zero
[signal 0x8 code=0x7 addr=0x40c7c5d pc=0x40c7c5d]

goroutine 5 [running]:
github.com/layeh/gumble/gumbleutil.glob.func1(0xc82011ea80)
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumbleutil/bitrate.go:14 +0x2d
github.com/layeh/gumble/gumbleutil.Listener.OnConnect(0x43fcdd0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, ...)
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumbleutil/listener.go:26 +0x30
github.com/layeh/gumble/gumbleutil.(*Listener).OnConnect(0x4515b00, 0xc82011ea80)
    <autogenerated>:1 +0xa0
github.com/layeh/gumble/gumble.(*eventMultiplexer).OnConnect(0xc8200c0018, 0xc82011ea80)
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumble/eventmultiplexer.go:55 +0xcc
github.com/layeh/gumble/gumble.(*Client).handleServerSync(0xc8200c0000, 0xc820135560, 0x11c, 0x11c, 0x0, 0x0)
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumble/handlers.go:243 +0x2c5
github.com/layeh/gumble/gumble.(*Client).readRoutine(0xc8200c0000)
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumble/client.go:233 +0x3e2
created by github.com/layeh/gumble/gumble.(*Client).Connect
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumble/client.go:146 +0x725

goroutine 1 [chan receive]:
main.main()

...

goroutine 17 [syscall, locked to thread]:
runtime.goexit()
    /usr/local/go/src/runtime/asm_amd64.s:1721 +0x1

goroutine 6 [select]:
github.com/layeh/gumble/gumble.(*Client).pingRoutine(0xc8200c0000)
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumble/client.go:210 +0x2b4
created by github.com/layeh/gumble/gumble.(*Client).Connect
    /Users/jcdesimp/dev/go/src/github.com/layeh/gumble/gumble/client.go:147 +0x74a
exit status 2

Any particular caveats I should know about regarding setting the AutoBitrate that I may have fallen into here?

client.Attach(gumbleutil.AutoBitrate) is being called before client.Connect()

The crash does not happen if I remove client.Attach(gumbleutil.AutoBitrate)

Thanks!

ghost commented 8 years ago

In order to use gumbleutil.AutoBitrate, there are certain Config fields that must be set. You can either set these yourself, or use the gumble.NewConfig, which initializes these values for you.

jcdesimp commented 8 years ago

@bontibon ah ok, switched to using gumble.NewConfig() and it works. What were the config values that needed to be set?

ghost commented 8 years ago

Config.AudioInterval