From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id BCE05469719 for ; Mon, 16 Mar 2020 18:32:05 +0300 (MSK) Received: by mail-lf1-f66.google.com with SMTP id b186so14327277lfg.11 for ; Mon, 16 Mar 2020 08:32:05 -0700 (PDT) Date: Mon, 16 Mar 2020 18:32:02 +0300 From: Cyrill Gorcunov Message-ID: <20200316153202.GB27301@uranus> References: <18ca01d5fba7$1c19a2d0$544ce870$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <18ca01d5fba7$1c19a2d0$544ce870$@tarantool.org> Subject: Re: [Tarantool-patches] [PATCH] evio: workaround for wsl1 so_linger assertion List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Timur Safin Cc: Cyrill Gorcunov , Vladislav Shpilevoy , tarantool-patches@dev.tarantool.org On Mon, Mar 16, 2020 at 06:25:22PM +0300, Timur Safin wrote: > SO_LINGER makes no much sense for unix-sockets, and Microsoft WSL > is returning EINVAL if setsockopts called for SO_LINGER over unix > sockets: > > [004] 2020-03-11 18:42:29.592 [29182] main/102/app sio.c:169 !> SystemError setsockopt(SO_LINGER), called on fd 16, aka > [004] 2020-03-11 18:42:29.592 [29182] main/102/app F> can't initialize storage: setsockopt(SO_LINGER), called on fd 16, > [004] 2020-03-11 18:42:29.592 [29182] main/102/app F> can't initialize storage: setsockopt(SO_LINGER), called on fd 16, > > And it's sort of correct here, but the problem is Linux is simply > silently ignoring it, which passes tests. > > After much debates we decided to work-around this case via CMAKE > define. > > NB! In a future (April/May 2020), when WSL2 with full Linux kernel > would be released we should disable this check. > --- > > This patch replaces prior one tsafin/gh-4659-wsl-no-linger-assert because original > approach considered unsafe, and we rather want to workaround it via CMake instead. > > > Branch: https://github.com/tarantool/tarantool/tree/tsafin/wsl1-no-linger-assert > > cmake/os.cmake | 13 +++++++++++++ > src/lib/core/evio.c | 2 ++ > 2 files changed, 15 insertions(+) > > diff --git a/cmake/os.cmake b/cmake/os.cmake > index 0ed554b9b..ee8870d21 100644 > --- a/cmake/os.cmake > +++ b/cmake/os.cmake > @@ -11,6 +11,15 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") > # (see man page for feature_test_macros). > add_definitions("-D_FILE_OFFSET_BITS=64") > find_package_message(PLATFORM "Building for Linux" "${CMAKE_SYSTEM_NAME}") > + > + # There are some subtle differences in Linux kernel calls > + # implementation under WSL1 (which should go away with WSL2 kernel) > + # so for a moment we introduce a way to distinguish Linux and > + # Microsoft/WSL1 > + if (${CMAKE_SYSTEM} MATCHES "Linux-.*-Microsoft") > + add_definitions("-DTARANTOOL_WSL_WORKAROUND_ENABLED=1") > + endif() > + Great! Thanks a huge, Timur! Since you mentioned WSL2 maybe we should name it -DTARANTOOL_WSL_1 ? I don't insist though. Acked-by: Cyrill Gorcunov