-
Notifications
You must be signed in to change notification settings - Fork 16
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
Exposing peer-closed events via GHC's event manager #209
Comments
I would prefer that none of Perhaps this is a good time to think of a better home for |
It seems to me this is a good candidate for exposing through |
FWIW, I would also prefer this but I am reluctant to hold up this small change on what is a rather significant change with non-obvious design decisions. Let's consider this orthogonally.
This would be fine by me. |
Sure |
@bgamari how would you like to proceed here? I see that the rebased https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11080/diffs implements the necessary functionality in |
@bgamari it would be great to hear from you, otherwise I'll close as abandoned in two weeks. |
Indeed I believe this should no longer be necessary. Thanks for the ping, @Bodigrim ! |
Some platforms (e.g. Linux via
EPOLLRDHUP
) can provide notifications to socket users when the socket's peer closes the read side of their connection. This information can sometimes be exploited by server applications to abort on-going request handlers when it is known that the client will no longer be able to receive the result.Here we propose to expose such events via GHC's event manager. Specifically, we propose exposing:
from
GHC.Event.Internal.Types
,GHC.Event.Manager
, andGHC.Event
. This can be used with the existingGHC.Event.Manager.registerFd
function to register for peer-closed events.Furthermore, we propose exposing the following via
GHC.Event.Manager
:Attempting to use this operation on a non-supported platform will result in an
unsupportedOperation
exception.Querying backend support
This proposal would break the current property that all IO manager backends support all event types (which currently include only the ubiquitously-supported
evtRead
,evtWrite
, andevtClose
). As exception handling can be expensive, I suggest that we offer a new operation:Implementation
An implementation of this can be found in https://gitlab.haskell.org/ghc/ghc/-/merge_requests/11080; this implementation currently only covers Linux's
EPOLLRDHUP
although we expect that it could also be implemented on KQueue-based platforms. A user can be found in yesodweb/wai#937.The text was updated successfully, but these errors were encountered: