From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp36.i.mail.ru (smtp36.i.mail.ru [94.100.177.96]) (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 46F26469719 for ; Tue, 17 Mar 2020 01:35:48 +0300 (MSK) References: <005501d5fbb3$7c2895d0$7479c170$@tarantool.org> From: Vladislav Shpilevoy Message-ID: <8b260724-43f4-ea28-44f8-2ed423ea410e@tarantool.org> Date: Mon, 16 Mar 2020 23:35:46 +0100 MIME-Version: 1.0 In-Reply-To: <005501d5fbb3$7c2895d0$7479c170$@tarantool.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [Tarantool-patches] [PATCH v1.1] 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 , Cyrill Gorcunov Cc: tarantool-patches@dev.tarantool.org Hi! Thanks for the patch! Please, keep branch link in each new email thread. On 16/03/2020 17:53, 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. > > Acked-by: Cyrill Gorcunov > --- > 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..c6b19f379 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_WSL1_WORKAROUND_ENABLED=1") > + endif() To be more consistent I would better call it TARGET_OS_WSL1. Since we already have TARGET_OS_LINUX, TARGET_OS_FREEBSD, TARGET_OS_DEBIAN_FREEBSD, TARGET_OS_NETBSD, TARGET_OS_DARWIN. Besides, it would be consistent with other similar examples such as fio_filename(), load_cfg(), make_pipe(), and so on. They use TARGET_OS_* name. > + > elseif (${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") > set(TARGET_OS_FREEBSD 1) > set(TARGET_OS_DEBIAN_FREEBSD 1) > @@ -19,6 +28,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") > add_definitions("-D_FILE_OFFSET_BITS=64") > find_package_message(PLATFORM "Building for Debian/kFreeBSD" > "${CMAKE_SYSTEM_NAME}") > + Please, omit not necessary diff. This and other new empty lines below. > elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") > set(TARGET_OS_FREEBSD 1) > find_package_message(PLATFORM "Building for FreeBSD" "${CMAKE_SYSTEM_NAME}") > @@ -57,9 +67,11 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") > "system libraries is not supported") > endif() > unset(REAL_OPENSSL_ROOT_DIR) > + > elseif (${CMAKE_SYSTEM_NAME} STREQUAL "NetBSD") > set(TARGET_OS_NETBSD 1) > find_package_message(PLATFORM "Building for NetBSD" "${CMAKE_SYSTEM_NAME}") > + > elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") > set(TARGET_OS_DARWIN 1) > > @@ -154,6 +166,7 @@ elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Darwin") > endif() > endif() > endif() > + > else() > message (FATAL_ERROR "Unsupported platform -- ${CMAKE_SYSTEM_NAME}") > endif()