Closed JoeGruffins closed 1 year ago
Looking into this, probably a race in the test like usual. Unable to hit locally.
These ctx and locks in swapper.Run are really complicated.
This seems unreachable since mainLoop
is not closed until after all the helpers have returned:
https://github.com/decred/dcrdex/blob/884100b7652cc27f9ac64d06e4435e2fcaea8530/server/swap/swap.go#L802-L803
I'm concerned that meterer is also not working as intended: https://github.com/decred/dcrdex/blob/884100b7652cc27f9ac64d06e4435e2fcaea8530/dex/meter/meterer.go#L47-L60
Is <-scheduled.C
receiving here?
https://go.dev/play/p/ZtdWr_L7OlZ
Oh, it seems this is used with the '!scheduled.Stop()'? Why do we do this? the docs suggest using with 'Reset' https://pkg.go.dev/time#NewTimer
Ok, so from this playground it seems if the after function has fired before we do !scheduled.Stop() it does indeed hang https://go.dev/play/p/tZM_m4nWhgj
So if the timer unluckily fires between ctx being done and us checking Stop()
we hang?
https://github.com/decred/dcrdex/actions/runs/3616423483/jobs/6094364116