From b7210d6d1ab48c859c7dde0fd9290dae010ddd15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Tue, 18 Apr 2017 16:33:41 +0200 Subject: Get rid of stray messages when killing HTTP/2 request processes --- src/cowboy_http2.erl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cowboy_http2.erl b/src/cowboy_http2.erl index d93a6cd..a280c5f 100644 --- a/src/cowboy_http2.erl +++ b/src/cowboy_http2.erl @@ -693,6 +693,9 @@ stream_call_terminate(StreamID, Reason, StreamState) -> stream_terminate_children([], _, Acc) -> Acc; stream_terminate_children([{Pid, StreamID}|Tail], StreamID, Acc) -> + %% We unlink and flush the mailbox to avoid receiving a stray message. + unlink(Pid), + receive {'EXIT', Pid, _} -> ok after 0 -> ok end, exit(Pid, kill), stream_terminate_children(Tail, StreamID, Acc); stream_terminate_children([Child|Tail], StreamID, Acc) -> -- cgit v1.2.3