-
Notifications
You must be signed in to change notification settings - Fork 71
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
eio_luv: Process.spawn → “Switch hook removed from wrong domain!” #446
Comments
I'll see if I can look into this a little more to make sure it isn't a deeper issue, but I put some debugging statements in the |
What's strange is that the only way for the switch domain ID to be set, as far as I can tell, is through the cancellation context here: Line 96 in e858a8c
0 but when they come back out the other side through remove_hook it has become a different number. I'm wondering if this is some nasty interaction with the callback retention mechanism, shared state and system threads in Luv... in which case perhaps it is another one for #434 ?
|
Can you record it doing that with There are certainly some errors in luv's ctypes bindings (e.g. aantron/luv#144), but it's possible the corruption is elsewhere so it would be good to know for sure. |
As an update I took a quick look at using
Because of adding this in
Without catching that exception, we end up falling through to the
|
That's odd. I'd expect unmasking signals in the Eio thread would cause memory corruption, because libuv installs signal handlers without using the alt stack (https://github.com/libuv/libuv/blob/988f2bfc4defb9a85a536a3e645834c161143ee0/src/unix/signal.c#L228). For example, that's why Lwt programs suffer memory corruption on OCaml 5 when spawning processes (ocsigen/lwt#981). Adding some |
Do you know a (temporary? ugly? slow?) work around for this? (That way I can keep testing other things further while waiting for #435 ) |
This looks wrong (from https://github.com/aantron/luv/blob/master/src/c/helpers.c):
So, luv gets |
This makes it easier to reproduce it:
|
This should now be fixed in Luv |
Thanks! |
Using
Eio_luv.Low_level.Process.spawn
1000s of times, I sometimes (apparently randomly) get:I think I have removed all uses of Domains in the application and I still get it (seems less often though).
(I know
Luv
is going away but reporting in case it is a deeper issue.)The text was updated successfully, but these errors were encountered: