[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#1008174: libc6: poll() spuriously returns EINTR



Hi,

On 2022-03-23 18:07, Rémi Denis-Courmont wrote:
> Package: libc6
> Version: 2.34-0experimental3
> Severity: important
> 
> Dear Maintainer,
> 
> In the example below, glibc 2.34 from experimental causes a spurious
> EINTR error in the poll() call from the child thread. It seems that
> thread cancellation causes the poll() to be spuriously interrupted,
> even though the cancellation is explicitly disabled at that time.

Thanks for the example, it's very useful to reproduce and understand the
issue.

> As far as I understand, POSIX allows (or even requires) thread
> cancellation to be essentially like a signal interruption, save for
> ending the thread. But that is *only* from the moment that cancellation
> is effected. Cancellation cannot be effected while it is disabled by
> definition, so the behaviour from glibc seems wrong here.

poll() is a cancellation point. It appears to me that POSIX actually
allows this behaviour for cancellation points:

"The side effects of acting upon a cancellation request while suspended
during a call of a function are the same as the side effects that may be
seen in a single-threaded program when a call to a function is
interrupted by a signal and the given function returns [EINTR]. Any such
side effects occur before any cancellation cleanup handlers are called."

https://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html

> This regression is known to break the test suite from the VLC package.
> Rolling back to 2.33 from unstable solves the problem.

The regression has been introduced by this commit:
https://sourceware.org/git/?p=glibc.git;a=commit;h=26cfbb7162ad364d53d69f6d482f2d87b5950524

Regards,
Aurelien

-- 
Aurelien Jarno                          GPG: 4096R/1DDD8C9B
aurelien@aurel32.net                 http://www.aurel32.net


Reply to: