This repository has been archived by the owner on Sep 27, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing potential race condition on drain shutdown
Drains are sometimes shut down through the API by sending themselves a 'shutdown' message. However, in logplex_drain:stop/2, if the drain process crashes before or after the monitor is set in the call, and before the 'shutdown' message makes it there, the receive will work on '{'DOWN', Ref, process, DrainPid, _}' but the supervisor will restart it because it's transient. During that failure, we think we killed the pid, but we didn't (the crash did), so it restarts and stands alone while we're content at the fact it died once. This patch uses the {shutdown, call} tuple to mean the drain was killed using a gen_server:call demand, which will be reported in the monitor as a reason. This lets us switch based on the reason to make sure the drain was properly shut down.
- Loading branch information