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

Segv when reading and writing a storm of events #40

Open
chinenual opened this issue Aug 11, 2020 · 1 comment
Open

Segv when reading and writing a storm of events #40

chinenual opened this issue Aug 11, 2020 · 1 comment

Comments

@chinenual
Copy link

chinenual commented Aug 11, 2020

On Macos 10.14.6 (Mojave)
go 1.14.1
gitlab.com/gomidi/portmididrv v0.6.0
portmidi installed via homebrew - version 217_2

This looks very similar to #36 . I tried setting GODEBUG as described there, but don't see anything in the log. I've been successfully using the library for some prototyping, but now get this seg fault whenever my app processes a quick stream of events (each inbound event triggers a corresponding outbound event and soon after the first in the storm, the app crashes). If I break the cycle (process inbound events, but don't immediately send an outbound event in response - or just send a bunch of outbound events), everything works fine. Could there be some problem with attempting to write at same time the read listener is still processing an inbound event?

Help?

[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7fff4d85068b]

runtime stack:
runtime.throw(0x151c3e9, 0x2a)
	/usr/local/go/src/runtime/panic.go:1114 +0x72
runtime.sigpanic()
	/usr/local/go/src/runtime/signal_unix.go:679 +0x46a

goroutine 1789 [syscall]:
runtime.cgocall(0x10025e0, 0xc00070ec88, 0xc00031e300)
	/usr/local/go/src/runtime/cgocall.go:133 +0x5b fp=0xc00070ec58 sp=0xc00070ec20 pc=0x100616b
github.com/rakyll/portmidi._Cfunc_Pm_Write(0x68016b0, 0xc00051ccc8, 0x1, 0x0)
	_cgo_gotypes.go:302 +0x4d fp=0xc00070ec88 sp=0xc00070ec58 pc=0x11d8c4d
github.com/rakyll/portmidi.(*Stream).Write.func1(0xc000052140, 0xc00051ccc8, 0x1, 0x1, 0x1, 0xc00070ed00)
	/Users/tynor/go/pkg/mod/github.com/rakyll/portmidi@v0.0.0-20170620004031-e434d7284291/stream.go:120 +0x73 fp=0xc00070ecc0 sp=0xc00070ec88 pc=0x11da173
github.com/rakyll/portmidi.(*Stream).Write(0xc000052140, 0xc00070ed30, 0x1, 0x1, 0x100fae8, 0x3)
	/Users/tynor/go/pkg/mod/github.com/rakyll/portmidi@v0.0.0-20170620004031-e434d7284291/stream.go:120 +0xc5 fp=0xc00070ed00 sp=0xc00070ecc0 pc=0x11d95c5
github.com/rakyll/portmidi.(*Stream).WriteShort(0xc000052140, 0xbf, 0x73, 0x1c, 0xc00070eda3, 0xc00051ccc3)
	/Users/tynor/go/pkg/mod/github.com/rakyll/portmidi@v0.0.0-20170620004031-e434d7284291/stream.go:131 +0x84 fp=0xc00070ed60 sp=0xc00070ed00 pc=0x11d96a4
gitlab.com/gomidi/portmididrv.(*out).Write(0xc0001b49f0, 0xc00051ccc3, 0x3, 0x3, 0x5cb97d0, 0x0, 0xc00011e340)
	/Users/tynor/go/pkg/mod/gitlab.com/gomidi/portmididrv@v0.6.0/out.go:43 +0x79 fp=0xc00070ede8 sp=0xc00070ed60 pc=0x11db619

@dhowlett99
Copy link

dhowlett99 commented Jul 14, 2022

On MacOs 10.15.7 Catalina
go version go1.17.7 darwin/amd64 and tested on go version go1.18.4 darwin/amd64 same problem
github.com/rakyll/portmidi v0.0.0-20191102002215-74e95e8bc9b1

I have the same problem, I'm working on a DMX lighting controller which uses the Novation Launchpad to send Midi button events to and from my software. I've just implented a lot more flashing of buttons and as chinenual said, as you get busy the app crashes.

Any help much appreciated.


fatal error: unexpected signal during runtime execution
[signal SIGSEGV: segmentation violation code=0x1 addr=0x8 pc=0x7fff3324e1cc]

runtime stack:
runtime.throw({0x4589330, 0x70000b17e588})
        /usr/local/go/src/runtime/panic.go:1198 +0x71
runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:719 +0x396

goroutine 52 [syscall]:
runtime.cgocall(0x4473840, 0xc00008ede8)
        /usr/local/go/src/runtime/cgocall.go:156 +0x5c fp=0xc00008edc0 sp=0xc00008ed88 pc=0x40066fc
github.com/rakyll/portmidi._Cfunc_Pm_WriteSysEx(0x8617fe0, 0x24176, 0xc000c60050)
        _cgo_gotypes.go:309 +0x4c fp=0xc00008ede8 sp=0xc00008edc0 pc=0x44016ac
github.com/rakyll/portmidi.(*Stream).WriteSysExBytes.func1(0xc00008ee48, 0x24176, {0xc000c60050, 0x44d3b80, 0xc00008ee01})
        /Users/derek/project/pkg/mod/github.com/rakyll/portmidi@v0.0.0-20191102002215-74e95e8bc9b1/stream.go:136 +0x69 fp=0xc00008ee20 sp=0xc00008ede8 pc=0x4401f09
github.com/rakyll/portmidi.(*Stream).WriteSysExBytes(0xc000024176, 0xc00008ee88, {0xc000c60050, 0xc0000986c0, 0xc00008eed8})
        /Users/derek/project/pkg/mod/github.com/rakyll/portmidi@v0.0.0-20191102002215-74e95e8bc9b1/stream.go:136 +0x1e fp=0xc00008ee58 sp=0xc00008ee20 pc=0x4401e3e
github.com/rakyll/launchpad/mk3.(*Launchpad).Light(0xc0000a4060, 0x1, 0x0, 0x5f, 0x0, 0x5f)
        /Users/derek/project/pkg/mod/github.com/rakyll/launchpad@v0.1.0/mk3/launchpad.go:107 +0xca fp=0xc00008ee98 sp=0xc00008ee58 pc=0x440294a
github.com/dhowlett99/dmxlights/pkg/common.ListenAndSendToLaunchPad(0x0, 0xc0000a4060, {0xc0000a80f0, 0xa, 0xa})
        /Users/derek/project/src/github.com/dhowlett99/dmxlights/pkg/common/common.go:771 +0x405 fp=0xc00008ef70 sp=0xc00008ee98 pc=0x44059e5
main.main.func3(0x0, 0x0, {0xc0000a80f0, 0x0, 0x0})
        /Users/derek/project/src/github.com/dhowlett99/dmxlights/dmxlights.go:221 +0x29 fp=0xc00008efa8 sp=0xc00008ef70 pc=0x446fb29
main.main·dwrap·3()
        /Users/derek/project/src/github.com/dhowlett99/dmxlights/dmxlights.go:222 +0x3e fp=0xc00008efe0 sp=0xc00008efa8 pc=0x446fabe
runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc00008efe8 sp=0xc00008efe0 pc=0x4066cc1
created by main.main
        /Users/derek/project/src/github.com/dhowlett99/dmxlights/dmxlights.go:220 +0x1725

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