diodechain / diode_client

Diode client written in GO that runs the Blockquick™ algorithm and a socks server to transmit data through diode ztna network.
https://diode.io/download
Other
66 stars 23 forks source link

WaitGroup is reused before previous Wait has returned #52

Closed sc0Vu closed 3 years ago

sc0Vu commented 3 years ago
[INFO] Diode Client version : v0.4.12-11-g8594f89 06 Oct 2020            
[INFO] Client address       : 0x13ac4c74416ed3f59bd9d7dfca79326819631093 
[INFO] Fleet address        : 0x6000000000000000000000000000000000000000 
[INFO] Connected to host: as2.prenet.diode.io:41046, validating... 
[INFO] Adding host: as1.prenet.diode.io:41046 [2/6] 
[INFO] Network is validated, last valid block: 867496 0x00002313a6ef675a6a205443a7a26beb0d5a281235ddfedf75c690cb0f0723d0 
[INFO] Start socks server 127.0.0.1:1080 
[INFO] Adding host: us2.prenet.diode.io:41046 [3/6] 
[INFO] Resolving BNS: pi-taipei                 server=as2.prenet.diode.io:41046
[EROR] Failed to connectDevice(0x780980bfc0aa56ceb1417e87912e54b759463090): This device is offline - not found 
^C[INFO] 1/5 Stopping socksserver 
[INFO] 2/5 Stopping proxyserver 
[INFO] 3/5 Stopping configserver 
[INFO] 4/5 Cleaning pool 
[INFO] Adding host: eu2.prenet.diode.io:41046 [4/6] 
panic: sync: WaitGroup is reused before previous Wait has returned

goroutine 1 [running]:
sync.(*WaitGroup).Wait(0xc000478160)
    /usr/local/Cellar/go/1.15.2/libexec/src/sync/waitgroup.go:132 +0xae
github.com/diodechain/diode_go_client/rpc.(*DataPool).WaitClients(...)
    /Users/peterlai/diode_go_client/rpc/datapool.go:145
main.(*Diode).Wait(0x4ba6680)
    /Users/peterlai/diode_go_client/cmd/diode/app.go:512 +0x55
main.socksdHandler(0x0, 0x0)
    /Users/peterlai/diode_go_client/cmd/diode/socksd.go:70 +0x7ab
github.com/diodechain/diode_go_client/command.(*Command).Execute(0x4b9f380, 0x0, 0x8)
    /Users/peterlai/diode_go_client/command/command.go:120 +0x2c7
main.RunDiode(...)
    /Users/peterlai/diode_go_client/cmd/diode/diode.go:29
main.main()
    /Users/peterlai/diode_go_client/cmd/diode/diode.go:34 +0x2d
sc0Vu commented 3 years ago

have to check whether goroutines return when user send signal to client

sc0Vu commented 3 years ago

Seems client call Wait() and Add() and Done() in different goroutine, and the go runtime didn't guarantee the execution order of goroutines. The bug happened sometimes.