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

Running with --race raise a panic #323

Closed
boskiv opened this issue Nov 16, 2021 · 1 comment
Closed

Running with --race raise a panic #323

boskiv opened this issue Nov 16, 2021 · 1 comment

Comments

@boskiv
Copy link

boskiv commented Nov 16, 2021

package main

import (
	"fmt"
	"github.com/adshao/go-binance/v2"
	"time"
)

func main() {

	wsDepthHandler := func(event *binance.WsDepthEvent) {
		fmt.Println(event)
	}
	errHandler := func(err error) {
		fmt.Println(err)
	}
	doneC, stopC, err := binance.WsDepthServe("LTCBTC", wsDepthHandler, errHandler)
	if err != nil {
		fmt.Println(err)
		return
	}
	// use stopC to exit
	go func() {
		time.Sleep(5 * time.Second)
		stopC <- struct{}{}
	}()
	// remove this if you do not want to be blocked here
	<-doneC

}

GOROOT=/usr/local/opt/go/libexec #gosetup
GOPATH=/Users/iskiridomov/go #gosetup
/usr/local/opt/go/libexec/bin/go build --race -o /private/var/folders/5g/p7l9qh3532dgqhf9h10v2dp80000gn/T/GoLand/___1go_build_playMutex playMutex #gosetup
/private/var/folders/5g/p7l9qh3532dgqhf9h10v2dp80000gn/T/GoLand/___1go_build_playMutex
objc[41697]: Attempt to use unknown class 0x7ff860363360.
SIGABRT: abort
PC=0x7ff81eb2fdfe m=0 sigcode=0

goroutine 0 [idle]:
runtime: unknown pc 0x7ff81eb2fdfe
stack: frame={sp:0x7ff7bfefe5e8, fp:0x0} stack=[0x7ff7bfe80688,0x7ff7bfeff6f0)
0x00007ff7bfefe4e8:  0x0000000000000002  0x0000000000000002 
0x00007ff7bfefe4f8:  0x000000000214e000  0x000000000214e400 
0x00007ff7bfefe508:  0x000000000000000a  0x00007ff7bfefe570 
0x00007ff7bfefe518:  0x00007ff81e965639  0x0000000000000000 
0x00007ff7bfefe528:  0xf6988000c000100a  0x000000000000ffff 
0x00007ff7bfefe538:  0x0000000000000030  0x0000000000000000 
0x00007ff7bfefe548:  0x000000000000002d  0x000000000000002d 
0x00007ff7bfefe558:  0x0000000000000000  0x000000000214e000 
0x00007ff7bfefe568:  0x00007ff860377000  0x00007ff7bfefe5a0 
0x00007ff7bfefe578:  0x00007ff81e965566  0x00007ff81e96552e 
0x00007ff7bfefe588:  0x000000000000002d  0x0000000000000001 
0x00007ff7bfefe598:  0x00007ff860377000  0x00007ff7bfefe5e0 
0x00007ff7bfefe5a8:  0x00007ff81e981ad6  0x000000000000002c 
0x00007ff7bfefe5b8:  0x000000000000002d  0x0000600003300000 
0x00007ff7bfefe5c8:  0x0000000000000003  0x0000600002c00000 
0x00007ff7bfefe5d8:  0x0000000000000000  0x00007ff7bfefe610 
0x00007ff7bfefe5e8: <0x00007ff81eb31893  0x0000000000000000 
0x00007ff7bfefe5f8:  0x00000020bfefe650  0x0000600002c00000 
0x00007ff7bfefe608:  0x00007ff7bfefe650  0x0000600003300000 
0x00007ff7bfefe618:  0x0000000000000003  0x0000000000000080 
0x00007ff7bfefe628:  0x0000000000000001  0x00007ff7bfefe640 
0x00007ff7bfefe638:  0x00007ff81eb31843  0x00007ff7bfefe680 
0x00007ff7bfefe648:  0x00007ff81e9fdbce  0x0000600002c00080 
0x00007ff7bfefe658:  0x000000000a79c033  0x0000600002c00000 
0x00007ff7bfefe668:  0x00007ffffffffff8  0x00007ff860363360 
0x00007ff7bfefe678:  0x0000000080080001  0x00007ff7bfefe760 
0x00007ff7bfefe688:  0x00007ff81e9fdb5c  0x0000003000000010 
0x00007ff7bfefe698:  0x00007ff7bfefe770  0x00007ff7bfefe6b0 
0x00007ff7bfefe6a8:  0x00007ff8a97353f0  0x00007ff8a9734c38 
0x00007ff7bfefe6b8:  0x00007ff860363360  0x00007ff860363360 
0x00007ff7bfefe6c8:  0x0000000000000001  0x00000000ffffffff 
0x00007ff7bfefe6d8:  0x0000000000000000  0x00007ff8a97351a0 
runtime: unknown pc 0x7ff81eb2fdfe
stack: frame={sp:0x7ff7bfefe5e8, fp:0x0} stack=[0x7ff7bfe80688,0x7ff7bfeff6f0)
0x00007ff7bfefe4e8:  0x0000000000000002  0x0000000000000002 
0x00007ff7bfefe4f8:  0x000000000214e000  0x000000000214e400 
0x00007ff7bfefe508:  0x000000000000000a  0x00007ff7bfefe570 
0x00007ff7bfefe518:  0x00007ff81e965639  0x0000000000000000 
0x00007ff7bfefe528:  0xf6988000c000100a  0x000000000000ffff 
0x00007ff7bfefe538:  0x0000000000000030  0x0000000000000000 
0x00007ff7bfefe548:  0x000000000000002d  0x000000000000002d 
0x00007ff7bfefe558:  0x0000000000000000  0x000000000214e000 
0x00007ff7bfefe568:  0x00007ff860377000  0x00007ff7bfefe5a0 
0x00007ff7bfefe578:  0x00007ff81e965566  0x00007ff81e96552e 
0x00007ff7bfefe588:  0x000000000000002d  0x0000000000000001 
0x00007ff7bfefe598:  0x00007ff860377000  0x00007ff7bfefe5e0 
0x00007ff7bfefe5a8:  0x00007ff81e981ad6  0x000000000000002c 
0x00007ff7bfefe5b8:  0x000000000000002d  0x0000600003300000 
0x00007ff7bfefe5c8:  0x0000000000000003  0x0000600002c00000 
0x00007ff7bfefe5d8:  0x0000000000000000  0x00007ff7bfefe610 
0x00007ff7bfefe5e8: <0x00007ff81eb31893  0x0000000000000000 
0x00007ff7bfefe5f8:  0x00000020bfefe650  0x0000600002c00000 
0x00007ff7bfefe608:  0x00007ff7bfefe650  0x0000600003300000 
0x00007ff7bfefe618:  0x0000000000000003  0x0000000000000080 
0x00007ff7bfefe628:  0x0000000000000001  0x00007ff7bfefe640 
0x00007ff7bfefe638:  0x00007ff81eb31843  0x00007ff7bfefe680 
0x00007ff7bfefe648:  0x00007ff81e9fdbce  0x0000600002c00080 
0x00007ff7bfefe658:  0x000000000a79c033  0x0000600002c00000 
0x00007ff7bfefe668:  0x00007ffffffffff8  0x00007ff860363360 
0x00007ff7bfefe678:  0x0000000080080001  0x00007ff7bfefe760 
0x00007ff7bfefe688:  0x00007ff81e9fdb5c  0x0000003000000010 
0x00007ff7bfefe698:  0x00007ff7bfefe770  0x00007ff7bfefe6b0 
0x00007ff7bfefe6a8:  0x00007ff8a97353f0  0x00007ff8a9734c38 
0x00007ff7bfefe6b8:  0x00007ff860363360  0x00007ff860363360 
0x00007ff7bfefe6c8:  0x0000000000000001  0x00000000ffffffff 
0x00007ff7bfefe6d8:  0x0000000000000000  0x00007ff8a97351a0 

goroutine 6 [syscall]:
runtime.cgocall(0x1001080, 0xc000068ca0)
        /usr/local/opt/go/libexec/src/runtime/cgocall.go:156 +0x6e fp=0xc000068c78 sp=0xc000068c40 pc=0x104420e
net._C2func_getaddrinfo(0xc00001c198, 0x0, 0xc000110fc0, 0xc000010068)
        _cgo_gotypes.go:97 +0x8b fp=0xc000068ca0 sp=0xc000068c78 pc=0x1231d8b
net.cgoLookupIPCNAME.func1({0xc00001c198, 0x13, 0xc00001c168}, 0x0, 0x1664b80)
        /usr/local/opt/go/libexec/src/net/cgo_unix.go:163 +0xb2 fp=0xc000068d10 sp=0xc000068ca0 pc=0x1234452
net.cgoLookupIPCNAME({0x1403f81, 0x3}, {0xc00001c168, 0xc0001361c0})
        /usr/local/opt/go/libexec/src/net/cgo_unix.go:163 +0x26e fp=0xc000068f10 sp=0xc000068d10 pc=0x123394e
net.cgoIPLookup(0x1664b90, {0x1403f81, 0x3}, {0xc00001c168, 0x12})
        /usr/local/opt/go/libexec/src/net/cgo_unix.go:220 +0x67 fp=0xc000068f80 sp=0xc000068f10 pc=0x1234567
net.cgoLookupIP·dwrap·22()
        /usr/local/opt/go/libexec/src/net/cgo_unix.go:230 +0x72 fp=0xc000068fe0 sp=0xc000068f80 pc=0x1234c12
runtime.goexit()
        /usr/local/opt/go/libexec/src/runtime/asm_amd64.s:1581 +0x1 fp=0xc000068fe8 sp=0xc000068fe0 pc=0x10a5ec1
created by net.cgoLookupIP
        /usr/local/opt/go/libexec/src/net/cgo_unix.go:230 +0x1ba

goroutine 1 [select]:
net/http.(*Transport).getConn(0x165fa00, 0xc000136200, {{}, 0x0, {0xc00001a200, 0x5}, {0xc00001c168, 0x17}, 0x1})
        /usr/local/opt/go/libexec/src/net/http/transport.go:1372 +0xa45
net/http.(*Transport).roundTrip(0x165fa00, 0xc00015c000)
        /usr/local/opt/go/libexec/src/net/http/transport.go:581 +0xcdf
net/http.(*Transport).RoundTrip(0xc00015c000, 0x1476d80)
        /usr/local/opt/go/libexec/src/net/http/roundtrip.go:18 +0x37
net/http.send(0xc00015c000, {0x1476d80, 0x165fa00}, {0x0, 0x108c600, 0x0})
        /usr/local/opt/go/libexec/src/net/http/client.go:252 +0x93f
net/http.(*Client).send(0x1664fc0, 0xc00015c000, {0x1406599, 0xe, 0x0})
        /usr/local/opt/go/libexec/src/net/http/client.go:176 +0x158
net/http.(*Client).do(0x1664fc0, 0xc00015c000)
        /usr/local/opt/go/libexec/src/net/http/client.go:725 +0x1087
net/http.(*Client).Do(...)
        /usr/local/opt/go/libexec/src/net/http/client.go:593
nhooyr.io/websocket.handshakeRequest({0x147ce38, 0xc0001361c0}, {0xc000018240, 0x2d}, 0xc00010dbf8, 0xc00002243e, {0xc00001c108, 0x18})
        /Users/iskiridomov/go/pkg/mod/nhooyr.io/[email protected]/dial.go:173 +0x89f
nhooyr.io/websocket.dial({0x147ce38, 0xc0001361c0}, {0xc000018240, 0x2d}, 0x0, {0x0, 0x0})
        /Users/iskiridomov/go/pkg/mod/nhooyr.io/[email protected]/dial.go:101 +0x729
nhooyr.io/websocket.Dial(...)
        /Users/iskiridomov/go/pkg/mod/nhooyr.io/[email protected]/dial.go:63
github.com/adshao/go-binance/v2.glob..func1(0xc000012d00, 0xc00000e150, 0x141c900)
        /Users/iskiridomov/go/pkg/mod/github.com/adshao/go-binance/[email protected]/websocket.go:28 +0xe5
github.com/adshao/go-binance/v2.wsDepthServe({0xc000018240, 0x2d}, 0x141c8f8, 0x141c900)
        /Users/iskiridomov/go/pkg/mod/github.com/adshao/go-binance/[email protected]/websocket_service.go:193 +0x146
github.com/adshao/go-binance/v2.WsDepthServe({0x1404523, 0x6}, 0x1046dd9, 0xc00007e010)
        /Users/iskiridomov/go/pkg/mod/github.com/adshao/go-binance/[email protected]/websocket_service.go:149 +0x12d
main.main()
        /Users/iskiridomov/GolandProjects/playMutex/main.go:17 +0x45

goroutine 4 [select]:
net.(*Resolver).lookupIPAddr(0x1664b80, {0x147cea8, 0xc00011e480}, {0x1403f81, 0x16657a0}, {0xc00001c168, 0x12})
        /usr/local/opt/go/libexec/src/net/lookup.go:302 +0x81c
net.(*Resolver).internetAddrList(0x147cea8, {0x147cea8, 0xc00011e480}, {0x1403f81, 0x3}, {0xc00001c168, 0x17})
        /usr/local/opt/go/libexec/src/net/ipsock.go:288 +0x7c6
net.(*Resolver).resolveAddrList(0x1695278, {0x147cea8, 0xc00011e480}, {0x14040ee, 0x4}, {0x1403f81, 0x3}, {0xc00001c168, 0x17}, {0x0, ...})
        /usr/local/opt/go/libexec/src/net/dial.go:221 +0x556
net.(*Dialer).DialContext(0xc00011e1e0, {0x147ce38, 0xc0001361c0}, {0x1403f81, 0x3}, {0xc00001c168, 0x17})
        /usr/local/opt/go/libexec/src/net/dial.go:406 +0x6e5
net/http.(*Transport).dial(0x165fa00, {0x147ce38, 0xc0001361c0}, {0x1403f81, 0x3}, {0xc00001c168, 0x17})
        /usr/local/opt/go/libexec/src/net/http/transport.go:1166 +0x26a
net/http.(*Transport).dialConn(0x165fa00, {0x147ce38, 0xc0001361c0}, {{}, 0x0, {0xc00001a200, 0x5}, {0xc00001c168, 0x17}, 0x1})
        /usr/local/opt/go/libexec/src/net/http/transport.go:1604 +0xd58
net/http.(*Transport).dialConnFor(0x0, 0xc00013a2c0)
        /usr/local/opt/go/libexec/src/net/http/transport.go:1446 +0x13b
created by net/http.(*Transport).queueForDial
        /usr/local/opt/go/libexec/src/net/http/transport.go:1415 +0x175

goroutine 5 [select]:
net.cgoLookupIP({0x147ce38, 0xc000136280}, {0x1403f81, 0x12}, {0xc00001c168, 0x0})
        /usr/local/opt/go/libexec/src/net/cgo_unix.go:231 +0x289
net.(*Resolver).lookupIP(0x1664b80, {0x147ce38, 0xc000136280}, {0x1403f81, 0x3}, {0xc00001c168, 0x12})
        /usr/local/opt/go/libexec/src/net/lookup_unix.go:97 +0x113
net.glob..func1({0x147ce38, 0xc000136280}, 0xc000012df0, {0x1403f81, 0x3}, {0xc00001c168, 0x12})
        /usr/local/opt/go/libexec/src/net/hook.go:23 +0x89
net.(*Resolver).lookupIPAddr.func1()
        /usr/local/opt/go/libexec/src/net/lookup.go:296 +0x133
internal/singleflight.(*Group).doCall(0x1664b90, 0xc00007c230, {0xc00001c180, 0x16}, 0xc0001362c0)
        /usr/local/opt/go/libexec/src/internal/singleflight/singleflight.go:95 +0x68
created by internal/singleflight.(*Group).DoChan
        /usr/local/opt/go/libexec/src/internal/singleflight/singleflight.go:88 +0x59b

rax    0x2000209
rbx    0x80
rcx    0x7ff7bfefe5e8
rdx    0x0
rdi    0x8
rsi    0x1
rbp    0x7ff7bfefe630
rsp    0x7ff7bfefe5e8
r8     0x600002c00000
r9     0x80
r10    0x0
r11    0x246
r12    0x0
r13    0x0
r14    0x1
r15    0x8
rip    0x7ff81eb2fdfe
rflags 0x246
cs     0x7
fs     0x0
gs     0x0

Process finished with the exit code 2

@xyq-c-cpp
Copy link
Collaborator

No response for a long time, close this issue

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