From 1292f8c229a7bf233b84660baea8ee9612515510 Mon Sep 17 00:00:00 2001 From: Raimo Niskanen Date: Thu, 11 Oct 2018 16:47:50 +0200 Subject: Fix hanging gen_tcp send vs close race While a gen_tcp send was in progress with filled buffers and slow receiver a close (from another process) would place the port in a half dead state so the port could not signal back to send, that waited for confirmation. The solution is to after some time (5 s) of waiting for send confirmation set a monitor on the port, which detects if the port becomes half dead due to close from another process. The close pending loop has also been improved to use the linger timeout for waiting, and to set a system timeout (arbitrarily selected 3 min) to not wait forever when the other end reads data s l o w l y (tarpitting, kind of). --- erts/preloaded/ebin/prim_inet.beam | Bin 79028 -> 80628 bytes 1 file changed, 0 insertions(+), 0 deletions(-) (limited to 'erts/preloaded/ebin') diff --git a/erts/preloaded/ebin/prim_inet.beam b/erts/preloaded/ebin/prim_inet.beam index 4a345f8152..e1b695675b 100644 Binary files a/erts/preloaded/ebin/prim_inet.beam and b/erts/preloaded/ebin/prim_inet.beam differ -- cgit v1.2.3