Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Timur Safin" <tsafin@tarantool.org>
To: tarantool-patches@dev.tarantool.org,
	Vladislav Shpilevoy <v.shpilevoy@tarantool.org>,
	Kirill Yukhin <kyukhin@tarantool.org>
Subject: [Tarantool-patches] [PATCH] Work-around WSL assert when SO_LINGER is set on unix sockets
Date: Tue, 10 Mar 2020 17:25:22 +0300	[thread overview]
Message-ID: <045901d5f6e7$bc2d47a0$3487d6e0$@tarantool.org> (raw)

Using SO_LINGER over unix sockets makes no much sense, though
it's harmless on Linux. The problem is, it breaks majority of 
tests under Windows/WSL with assertion, because setsockopt()
would return EINVAL in that case under WSL.

This is known WSL issue and reported here 
https://github.com/microsoft/WSL/issues/3992

So we filter out SO_LINGER if evio_setsockopt_server is being
called with AF_UNIX family.
 
Branch: https://github.com/tarantool/tarantool/tree/tsafin/gh-4659-wsl-no-linger-assert

 
---
 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;
 
-	/* Send all buffered messages on socket before take
-	 * control out from close(2) or shutdown(2). */
-	struct linger linger = { 0, 0 };
+	if (family != AF_UNIX) {
+		/* Send all buffered messages on socket before
+		 * take control out from close(2) or shutdown(2). */
+		struct linger linger = { 0, 0 };
+
+		if (sio_setsockopt(fd, SOL_SOCKET, SO_LINGER,
+				&linger, sizeof(linger)))
+			return -1;
+	}
 
-	if (sio_setsockopt(fd, SOL_SOCKET, SO_LINGER,
-		       &linger, sizeof(linger)))
-		return -1;
 	if (type == SOCK_STREAM && family != AF_UNIX &&
 	    evio_setsockopt_keepalive(fd) != 0)
 		return -1;
-- 
2.20.1

             reply	other threads:[~2020-03-10 14:25 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-10 14:25 Timur Safin [this message]
2020-03-11  0:30 ` Vladislav Shpilevoy
2020-03-11 10:43   ` Timur Safin
2020-03-11 10:53     ` Cyrill Gorcunov
2020-03-11 23:32     ` Vladislav Shpilevoy
2020-03-12  8:39       ` Timur Safin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='045901d5f6e7$bc2d47a0$3487d6e0$@tarantool.org' \
    --to=tsafin@tarantool.org \
    --cc=kyukhin@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] Work-around WSL assert when SO_LINGER is set on unix sockets' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox