From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5042EC35242 for ; Sat, 8 Feb 2020 20:29:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1DAB821775 for ; Sat, 8 Feb 2020 20:29:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=scylladb-com.20150623.gappssmtp.com header.i=@scylladb-com.20150623.gappssmtp.com header.b="iYbUKNjd" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727471AbgBHU3D (ORCPT ); Sat, 8 Feb 2020 15:29:03 -0500 Received: from mail-wm1-f47.google.com ([209.85.128.47]:35779 "EHLO mail-wm1-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726192AbgBHU3D (ORCPT ); Sat, 8 Feb 2020 15:29:03 -0500 Received: by mail-wm1-f47.google.com with SMTP id b17so6407420wmb.0 for ; Sat, 08 Feb 2020 12:29:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scylladb-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding:content-language; bh=wwSQDOmhsQu+RySLxIyH++gBjbmuFbOVVIozMbVu1nY=; b=iYbUKNjdiY4BobO6pRjvNk+W8yOxJJKpdbF5S3si1kKQyPPZ2nyv+mdSLevVaX25bz ruyD10TMX1lZID7so/KVkCAXQNopPVbUkZbU+9Zi/rsUSeZZoApmga3mdHajPlkcnDwU fkdP+jf17B1x1eDaH5wcnDlMCj5zGqIeN9sERQ2GBTARTQGQzOT5K4OSfSGQf09u7Llo 2+ZK9XYwZE8U1Qbbcin1/jYB7rX5NCjczp/o8JmjS1Njn4ATaDpxTYTd/cCE9/CQU/4o D2ZVZvDvTyO8kOWOyHLh3J5m4GyI3uH3n7gKDBmiElmlAUdZ7dF1+CeS3rWCEoV5V6OE jYXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding :content-language; bh=wwSQDOmhsQu+RySLxIyH++gBjbmuFbOVVIozMbVu1nY=; b=ImyrM/AiLi7xsdcuIdbb5tu1yg3eXhbN7KKmz4cSLOB3ShhXIi0Z3zQOpv6cCodbgF hA9FEZ6Vj2d7OJSlg+0quhzNdBNecOgQGxZLbw1DxGWLXa8J1/z1ao6VN+sJ7+WfrFDh LbWZdYhoQh74tbWQqoB5hbvbk6YtsHLzyQ14l0LWpQ2KuO0W/WVi4f7f+m9DQpSEIlkx njaqM1NjpjSe275K4U38mIpGNTvKemRMSB6h2pHe7jerG8QkzRdHIqE9VVE3geymGnuX NqJa1zlysjTS+XFgbSaZcQ0gpKkGKzKm0mowewhcdCX8MOiDbMA+9PGkn1H+OxUW6qTg 9CAw== X-Gm-Message-State: APjAAAX3VnfcHABA+/wnCMRhQJrcWAoAcpxzr3bkMsg/NHeQR9NdZw+x ZsArNGgGo6wFrcft91TdK6caZVTuBh8= X-Google-Smtp-Source: APXvYqzZ2Cdx5gle0d27lNNILRwQKeK7K4lXth5aXZAy1M8uZqhChula8NLS8OqCb5McJMVu/XCkvw== X-Received: by 2002:a1c:1dd0:: with SMTP id d199mr5551560wmd.42.1581193741143; Sat, 08 Feb 2020 12:29:01 -0800 (PST) Received: from tmp.scylladb.com (bzq-109-67-34-200.red.bezeqint.net. [109.67.34.200]) by smtp.googlemail.com with ESMTPSA id y8sm8356213wma.10.2020.02.08.12.28.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 08 Feb 2020 12:29:00 -0800 (PST) Subject: Re: shutdown not affecting connection? To: Glauber Costa Cc: Pavel Begunkov , io-uring@vger.kernel.org, Jens Axboe References: <9ec6cbf7-0f0b-f777-8507-199e8837df94@scylladb.com> From: Avi Kivity Message-ID: Date: Sat, 8 Feb 2020 22:28:59 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.4.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US Sender: io-uring-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: io-uring@vger.kernel.org On 2/8/20 10:20 PM, Glauber Costa wrote: >> >>> Perhaps you can reduce the >>> problem to a small C reproducer? >>> >> That was my intended next step, yes > s***, I didn't resist and I had to explain to my wife that no, I don't > like io_uring more than I like her. > > But here it is. > > This is a modification of test/connect.c. > I added a pthread comparison example that should achieve the same > sequence of events: > - try to sync connect > - wait a bit > - shutdown > > I added a fixed wait for pthread to make sure that shutdown is not > called before connect. > > For io_uring, the shutdown is configurable with the program argument. > This works just fine if I sleep before shutdown (as I would expect from a race). > This hangs every time if I don't. > > Unless I am missing something I don't think this is the expected behavior I think it is understandable. Since the socket is blocking uring moves the work to a workqueue, and the shutdown() happens before the workqueue has had a chance to process the connection attempt. So we'll have to cancel the sqe. Jens, does the blocking connect doesn't consume a kernel thread while it's waiting for a connection? Or does it just set things up and move on?