-
Notifications
You must be signed in to change notification settings - Fork 8
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
Set the output pipe as a non-block fd and catch EAGAIN when we write into it #28
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, I've added some additional suggestions, I think the non-blocking read is worth having as well, the rest is because haesbaert is a pedantic fanatical :-).
@@ -330,10 +330,11 @@ let transmit_fds signals revert tbl fds = | |||
List.fold_left fold signals fds | |||
|
|||
let interrupted fd fds = List.exists (( = ) fd) fds | |||
let buf = Bytes.create 0x1000 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's not a great idea, sorry I might I have failed to express myself before.
I'd pre-allocate this per-domain, on whatever structure you have that holds per-domain data.
If you just use a global one, you're basically concurrently writing to the buf from multiple domains, which is not a great idea, it's likely not a a bug per-se because of the current implementation of Bytes where it just copes, but it's an antipattern on the very least.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was too fast about my last commit, I will fix that and revert as before. Thrme allocation of a small one does not cost too much.
CHANGES: - Set the internal pipe used to interrupt a domain to a non-blocking mode and remove the usage of an atomic which protect how we fill the pipe (@haesbaert, @dinosaure, robur-coop/miou#28) - Expose option to reuse addr/port when we `Miou_unix.bind_and_listen` (@ada2k, @dinosaure, robur-coop/miou#27) - Protect an illegal access to the orphan from a possibly parallel task which does not own the orphan value (@poytypic, @dinosaure, robur-coop/miou#31, robur-coop/miou#32) - Be able to pin a specific domain when we want to launch a parallel task (@dinosaure, robur-coop/miou#34) - Expose the `Miou.Backoff` module which can be useful for users (@dinosaure, robur-coop/miou#35) - Fix or improve (from the maintainance point-of-view) the `Miou.Queue` module and some internal parts of Miou about the usage of atomics (@dinosaure, @polytypic, robur-coop/miou#36, robur-coop/miou#33) - Prefer to require a `finaliser` function for the `events` value and actually close the internal `Unix.pipe` used to interrupt domain than to use `Gc.finaliser` and possibly leak file-descriptors (spotted by @hannesm, @dinosaure, robur-coop/miou#37)
CHANGES: - Set the internal pipe used to interrupt a domain to a non-blocking mode and remove the usage of an atomic which protect how we fill the pipe (@haesbaert, @dinosaure, robur-coop/miou#28) - Expose option to reuse addr/port when we `Miou_unix.bind_and_listen` (@ada2k, @dinosaure, robur-coop/miou#27) - Protect an illegal access to the orphan from a possibly parallel task which does not own the orphan value (@poytypic, @dinosaure, robur-coop/miou#31, robur-coop/miou#32) - Be able to pin a specific domain when we want to launch a parallel task (@dinosaure, robur-coop/miou#34) - Expose the `Miou.Backoff` module which can be useful for users (@dinosaure, robur-coop/miou#35) - Fix or improve (from the maintainance point-of-view) the `Miou.Queue` module and some internal parts of Miou about the usage of atomics (@dinosaure, @polytypic, robur-coop/miou#36, robur-coop/miou#33) - Prefer to require a `finaliser` function for the `events` value and actually close the internal `Unix.pipe` used to interrupt domain than to use `Gc.finaliser` and possibly leak file-descriptors (spotted by @hannesm, @dinosaure, robur-coop/miou#37)
/cc @haesbaert this is my first try to fix the pipe used to interrupt a domain. WDYT?