From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mout.web.de (mout.web.de [212.227.15.3]) by sourceware.org (Postfix) with ESMTPS id 4ED9D3857C48 for ; Sun, 14 Feb 2021 13:17:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4ED9D3857C48 X-UI-Sender-Class: c548c8c5-30a9-4db5-a2e7-cb6cb037b8f9 Received: from [192.168.2.103] ([84.143.151.159]) by smtp.web.de (mrweb001 [213.165.67.108]) with ESMTPSA (Nemesis) id 0MQf77-1lIkZO3CQ9-00U2T1 for ; Sun, 14 Feb 2021 14:17:27 +0100 Subject: Re: (stat(...) == -1 || faccessat(...) == -1) && errno == EINTR ?!?? From: Tobias Bading To: libc-help@sourceware.org References: Message-ID: <000830b6-1cf0-6349-5667-a5af6894ac1b@web.de> Date: Sun, 14 Feb 2021 14:17:26 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable Content-Language: en-US X-Provags-ID: V03:K1:UL4Zp907NdXkL5hUTaF+JLjH99JydQAlzzApwD60Tgfab2WE1Ku VWTZmyHMmv/dqGEXi1fN1DRmTL9iwKEuyZj8LhUoumRaMjx1EeS8KH8tMBqKLlo587jpZ/m ANqnDDxOyALQestLBy+7uC4TSJKU8sudv5zQgKStDkq4ZD6KJe7V/ynDhtwZygnjasgWz51 UFI2ACqJ0Y/fqf4uJbKaQ== X-UI-Out-Filterresults: notjunk:1;V03:K0:jbsSStX7egc=:f59M8kuuQqAXTvLYrIBadU qrHXuOYiAuDjGgBjnPRKgBHrB2Nf7npLqiLf/tZ95SIWeVISg7lwCSnr175HBW4NChJ5CYjHd bgEpLeT/LhAkSlF+1s2Y4gRyXHHOYdWMPborsUg9YFk+iw30zKfx93GDEwVOMNwQp15UPv3PW nWXWGm8lqMs5rNx9bXxvX3DnNiyGQ29jEb7bmfdVlvNWnrwIR/hdSZBSbahAk+5p7z3bCK0qP oBXwIha6ZgfdwDEfuk2YtgUulmVC++fVKW2R7KWkCZqCbevSJeqmLMUDpYQ4C5aw1QzSvGKiS UwWYJYF/8FmW4oISB0Pf96P1owmFY8GFNa0FCvcpqzqRfxlDxL/ZFvN1YtczQS2uYwWsGffnd 3dh2Cgz1hyqV4kdZdsw7gBQjItwdZfY9H2h6CFt0iEbviDBdpqj5rtK70nQIJAD3DcaN+IYqg uPzs+seVUlKv7g0fHkr1TQ4WaIG9eKc7zEjwhzs0N9FCmZBJpK/lA2XQ40IHdUiMPRQXEQZqZ F7nYh9ClGbloPMCJaa6EwDI2D1AUuRdDoS2gJlZHXekGKsS4fj0F7mUSvkY0jDhjfrI0EYHkk aLzZnJSfPRsrd0hpi0c7jcxnXdZg5nlzsbaSjecaTYVbQfwSRbqDOL8k1j1JvlucrmUhjk19p XDhyS7gAEz9S+djvLe7nToKjyZAZes3Q6aY6U6acSRWyays/rz6r9oJBJZHAJKO39PoeiKJOZ Q7GeiGGtvInAYm4Bh435lNfIqmE6/fAYO3sdrtehqEA4Mgc0XvIhT48+46kNjaW96zMSYQmaI PO3KppLF4xuT9XWOAf3Vm0EVuEInh1NrbS3wa1yqIrPiS+Lp+Rp3bfnEi693ILFIt4fkrfjqR dg4MKrcr2ALBGDys5ISQ== X-Spam-Status: No, score=1.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, LOTS_OF_MONEY, MONEY_NOHTML, NICE_REPLY_A, PLING_QUERY, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Level: * X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libc-help@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-help mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Feb 2021 13:17:32 -0000 o/ I ran the test program against different servers and shares in the office. The share on which I encountered the problem first seems to be affected the worst: 50 SIGALRMs per second and the first stat() has no chance. Other shares, some on Windows servers and one on an older GNU/Linux with Samba, seemed not to have this problem at first. But when I removed the teminal output from the SIGALRM handler and increased the SIGALRM rate to 10000 per second, all those other shares produced the error as well sooner or later. Hmm... Tobias On 14.02.21 13:18, Tobias Bading wrote: > Hello again. > > I've been able to reproduce the problem with the attached program. > With SIGALRMs firing 10 times per second, I get maybe a dozen "handler > called" lines before stat() or faccessat() fails with errno EINTR. > When I increase the rate to 50 SIGALRMs per second, the very first > stat() fails in every test run. > > Specifying SA_RESTART in sigaction() has no effect. > > Unfortunately, I don't have any other network shares available at the > moment to test whether only CIFS through VPN is affected, or the > problem would occur with e.g. NFS or CIFS without a VPN as well. > > Tobias > > --- > > On 14.02.21 12:13, Tobias Bading wrote: >> Hi. >> >> A few days ago I encountered strange problems at home while using GNU >> Emacs on GNU/Linux with Windows SMB shares in the office automounted >> through the company's VPN. >> >> Details and my current findings on the Emacs devel mailing list: >> https://lists.gnu.org/archive/html/emacs-devel/2021-02/msg00835.html. >> >> TL;DR: >> Emacs' stat() and faccessat() calls sometimes return -1 and set errno >> to EINTR (according to strace). Most of the time the interruption >> seems to come from a SIGIO, but at least once a SIGCHLD was in the >> mix as well. >> >> The behavior of returning with errno =3D=3D EINTR seems to be new and/o= r >> some kind of bug, because otherwise Emacs would handle that case with >> TEMP_FAILURE_RETRY() or something to that effect, right? I've used >> pretty much the same Emacs in the office (on an older GNU/Linux >> release) for ages with the same Windows SMB shares and never had this >> problem. >> >> The GNU/Linux man pages of stat() and faccessat() don't mention EINTR >> at all, and neither does POSIX >> (https://pubs.opengroup.org/onlinepubs/9699919799/). >> >> So I guess the one million dollar question is this: >> Are stat() and faccessat() permitted to return -1 with errno =3D=3D >> EINTR, or does that violate the POSIX (or some other) spec? >> >> I'll probably write a small test program next to check if I can >> reproduce this problem outside of Emacs, maybe with a simple SIGALRM >> and an endless loop of stat()/faccessat() calls. If that reproduces >> the problem it would be nice to know whether using SA_RESTART in >> sigaction() has any effect. >> >> Any ideas are very welcome... :) >> >> Tobias >> >> PS: I'm running Ubuntu focal (20.04.2 LTS, amd64), which currently >> uses libc-bin 2.31-0ubuntu9.2, kernel linux-image-5.4.0-64-generic >> and openconnect 8.05-1 to access the VPN. >> >