-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
Fix ppoll eintr #25411
Fix ppoll eintr #25411
Conversation
This complements #21564. |
hmm, I think it would be simpler to just add the |
I agree that some of the However a call to the new helper is self documented and clearly indicates the fact that signals are expected and the interrupted syscall should be retried. I'm not sure to see how each ppoll() call site dealing itself with the automatic retry and with the logic to update the timeout value could be simpler. |
Thinking more about this I think "sd-bus: fix bus_poll() to handle EINTR properly" may be the wrong approach. Indeed we're dealing with library code here and we have no idea how the application linked against the lib handles signals (it might have installed signal handlers and want us to return immediately if we got interrupted for example). Hence automatically retrying syscalls after being interrupted by a signal or hiding the fact that we got interrupted in the middle of the process of WDYT ? |
Most of ppoll(2) users should (and already do) handle EINTR properly in case the system call receives a signal before any requested event occurs. Hence let's introduce a helper that just does that automatically and use the new helper where it makes sense. No functional change.
bus_ppoll() relies on ppoll(2) which can return EINTR when interrupted by a signal. bus_ppoll() should be prepared to handle this case properly by restarting the system call. Hence let's make it call safe_ppoll_usec() instead since it does that automatically for us. This should address one of the cases that lead to the following error, which might occur when shutting down the system: login[1489]: pam_systemd(login:session): Failed to release session: Interrupted system call IOW this patch closes another possible root cause of issue systemd#18817.
e1c8c37
to
56ddbf2
Compare
So I pushed mostly the same version but with the fix addressing Yu's issue. I'm still not convinced that we should add |
Regarding |
→ #25483 |
No description provided.