-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Missing EINTR handling on macOS for opendir/readdir/closedir syscalls #47584
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
|
|
@janvorli any thoghts here? I guess worst case, it is unnecessary code. My only thought (waves hands) that if EINTR is actually a bug here, then who knows if it would just continue to return EINTR, and we would hang. |
It seems that opendir can return EINTR on macOS as far as I can tell from https://opensource.apple.com/source/Libc/Libc-1439.40.11/gen/FreeBSD/opendir.c.auto.html. It internally calls fstatfs which can return EINTR according to its documentation. Overall, it seems to me it would be safe to handle it at opendir / readdir and eat it at closedir. |
@janvorli I dug a bit into the macos source code and the , and via: I'll send a PR with the fixes. |
Description
It seems that under certain conditions, the
opendir
,readdir
,closedir
can seterrno
toEINTR
.These 3 syscalls are the only ones I can see not handling EINTR:
runtime/src/libraries/Native/Unix/System.Native/pal_io.c
Line 474 in e98fb61
Note: it is not documented in the man pages, but it seems to be a problem in practice.
Configuration
Mono 2020-02, macOS, x64. Not specific to this.
Regression?
Only started happening with macOS Big Sur.
Other information
See this gist for an exception being bubbled on mono which is using the same source as dotnet/runtime.
The text was updated successfully, but these errors were encountered: