Azure / go-amqp

AMQP 1.0 client library for Go.
https://github.com/Azure/go-amqp
MIT License
104 stars 56 forks source link

Fix race on Session/Sender/Receiver Close #270

Closed jhendrixMSFT closed 1 year ago

jhendrixMSFT commented 1 year ago

If Close() exits due to cancellation/timeout and the mux is still running, subsequent calls to Close() will read from doneErr which will race with the mux. Record closing state while synchronizing with the mux and cache the value so subsequent calls return the same value.

Example: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=2668077&view=logs&j=12f1170f-54f2-53f3-20dd-22fc7dff55f9&t=bd05475d-acb5-5619-3ccb-c46842dbc997