Closed kerbyhughes closed 4 years ago
cc @keitwb for a look!
@cory-signalfx I just enabled CircleCI to run for forked PRs -- it was off before which is why the tests didn't run. I ran them locally though and everything seems good to go.
Oh, thank you!
Changes:
bufferDataMessage
: Function now returns if context is cancelled while waiting for receive onc.dataChBuffer
bufferExpirationMessages
: Function now returns if context is cancelled while waiting for receive onc.expirationChBuffer
readNextMessage
: Function now returns if context is cancelled while blocked trying to send error toc.readErrCh
, which may no longer have a receiver afterfunc (c *wsConn) Run()
returns.While using the signalflow client we noticed a resource leak in our application.
Inspection with
pprof.Lookup("goroutine")
stack traces indicated that goroutines spawned by theComputation
andwsConn
functions were running indefinitely even though the client context was being cancelled withfunc (c *Client) Close()
. This also prevented the associated data structures from being garbage collected.Sample stack traces:
In all three cases, the context
Done()
channel was not being checked in some branches where the goroutine was blocked on sending or receiving from another channel.