bnb-chain / go-sdk

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

goroutine reveal &&

ares0x opened this issue · comments

commented

Hi, go-sdk contributer, I have a problem with the increasing number of goroutines and websocket disconnection when I use goroutine to call the RPC client concurrently
err:websocket client is dialing or stopped, can't send any request

`panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x10 pc=0xbb8fce]

goroutine 1623 [running]:
github.com/gorilla/websocket.(*Conn).WriteMessage(0x0, 0x8, 0xc000984000, 0x2, 0x2, 0xc001305ef8, 0xc0010e7400)
D:/code/go/GoDep/coinutils/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:742 +0x3e
github.com/binance-chain/go-sdk/client/rpc.(*WSClient).writeRoutine(0xc000c7cf00)
D:/code/go/GoDep/coinutils/pkg/mod/github.com/binance-chain/go-sdk@v1.2.2/client/rpc/ws_client.go:795 +0x6c2
created by github.com/binance-chain/go-sdk/client/rpc.(*WSClient).startReadWriteRoutines
D:/code/go/GoDep/coinutils/pkg/mod/github.com/binance-chain/go-sdk@v1.2.2/client/rpc/ws_client.go:731 +0x68
panic: runtime error: invalid memory address or nil pointer dereference
[signal 0xc0000005 code=0x0 addr=0x0 pc=0xbbae47]

goroutine 1622 [running]:
github.com/gorilla/websocket.(*Conn).SetPongHandler(0x0, 0xc00014b730)
D:/code/go/GoDep/coinutils/pkg/mod/github.com/gorilla/websocket@v1.4.0/conn.go:1124 +0x27
github.com/binance-chain/go-sdk/client/rpc.(*WSClient).readRoutine(0xc000c7cf00)
D:/code/go/GoDep/coinutils/pkg/mod/github.com/binance-chain/go-sdk@v1.2.2/client/rpc/ws_client.go:807 +0x9d
created by github.com/binance-chain/go-sdk/client/rpc.(*WSClient).startReadWriteRoutines
D:/code/go/GoDep/coinutils/pkg/mod/github.com/binance-chain/go-sdk@v1.2.2/client/rpc/ws_client.go:730 +0x46
`

commented

Solved

hello @ares0x
How did you solve it?