From owner-freebsd-net@freebsd.org Wed Jan 18 10:36:57 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A78BECB5395 for ; Wed, 18 Jan 2017 10:36:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 25E4E14E5 for ; Wed, 18 Jan 2017 10:36:56 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id v0IAaoav040302 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 18 Jan 2017 12:36:51 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua v0IAaoav040302 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id v0IAaotf040301; Wed, 18 Jan 2017 12:36:50 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 18 Jan 2017 12:36:50 +0200 From: Konstantin Belousov To: Colin Percival Cc: freebsd-net@freebsd.org Subject: Re: sosend returning ERESTART Message-ID: <20170118103650.GE2349@kib.kiev.ua> References: <01000159aac969e6-b2fc3913-d04e-42d4-befd-402ed0d830bf-000000@email.amazonses.com> <20170117100634.GS2349@kib.kiev.ua> <01000159afddb7ce-064a5d17-4b81-4b2c-a9b4-3ddd2ad2e377-000000@email.amazonses.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <01000159afddb7ce-064a5d17-4b81-4b2c-a9b4-3ddd2ad2e377-000000@email.amazonses.com> User-Agent: Mutt/1.7.2 (2016-11-26) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 18 Jan 2017 10:36:57 -0000 On Wed, Jan 18, 2017 at 04:37:40AM +0000, Colin Percival wrote: > On 01/17/17 02:06, Konstantin Belousov wrote: > > On Tue, Jan 17, 2017 at 04:57:23AM +0000, Colin Percival wrote: > >> I think I've tracked an NFS problem down to sosend returning ERESTART; it > >> looks like it's easy to work around this, but I'm not sure *why* sosend is > >> returning ERESTART... or for that matter *how* since I can't find anywhere > >> in relevant code where that gets returned. > > ERESTART is most likely returned by msleep(9) or similar call down the > > path when unblocked signal is pending with the restart disposition. > > Thanks, looks like that was exactly it -- if the TCP send buffer was full > we would call sbwait, and if a signal arrived it would return ERESTART. > It looks like setting the SB_NOINTR flag will prevent this; I'm testing a > patch right now. > > (Google bait in case anyone else trips over this: FreeBSD 11.0 NFS client > dropping TCP connections under concurrent I/O load.) Note that passing SB_NOINTR unconditionally or even only for mounts with nointr (default) option is wrong. You make the socket operation uninterruptible, process terminate-ability becomes depended on the external factor, the behaviour of the remote system.