From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp49.i.mail.ru (smtp49.i.mail.ru [94.100.177.109]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D9D4C469719 for ; Tue, 10 Mar 2020 17:25:24 +0300 (MSK) From: "Timur Safin" Date: Tue, 10 Mar 2020 17:25:22 +0300 Message-ID: <045901d5f6e7$bc2d47a0$3487d6e0$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Content-Language: ru Sender: t.safin@corp.mail.ru Subject: [Tarantool-patches] [PATCH] Work-around WSL assert when SO_LINGER is set on unix sockets List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: tarantool-patches@dev.tarantool.org, Vladislav Shpilevoy , Kirill Yukhin Using SO_LINGER over unix sockets makes no much sense, though it's harmless on Linux. The problem is, it breaks majority of=20 tests under Windows/WSL with assertion, because setsockopt() would return EINVAL in that case under WSL. This is known WSL issue and reported here=20 https://github.com/microsoft/WSL/issues/3992 So we filter out SO_LINGER if evio_setsockopt_server is being called with AF_UNIX family. =20 Branch: = https://github.com/tarantool/tarantool/tree/tsafin/gh-4659-wsl-no-linger-= assert =20 --- src/lib/core/evio.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/lib/core/evio.c b/src/lib/core/evio.c index 2152c15e6..06aa11ce4 100644 --- a/src/lib/core/evio.c +++ b/src/lib/core/evio.c @@ -140,13 +140,16 @@ evio_setsockopt_server(int fd, int family, int = type) &on, sizeof(on))) return -1; =20 - /* Send all buffered messages on socket before take - * control out from close(2) or shutdown(2). */ - struct linger linger =3D { 0, 0 }; + if (family !=3D AF_UNIX) { + /* Send all buffered messages on socket before + * take control out from close(2) or shutdown(2). */ + struct linger linger =3D { 0, 0 }; + + if (sio_setsockopt(fd, SOL_SOCKET, SO_LINGER, + &linger, sizeof(linger))) + return -1; + } =20 - if (sio_setsockopt(fd, SOL_SOCKET, SO_LINGER, - &linger, sizeof(linger))) - return -1; if (type =3D=3D SOCK_STREAM && family !=3D AF_UNIX && evio_setsockopt_keepalive(fd) !=3D 0) return -1; --=20 2.20.1