Skip to content
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

SIGSEGV on OCaml 5 due to missing SA_ONSTACK #981

Closed
talex5 opened this issue Feb 3, 2023 · 2 comments · Fixed by #993
Closed

SIGSEGV on OCaml 5 due to missing SA_ONSTACK #981

talex5 opened this issue Feb 3, 2023 · 2 comments · Fixed by #993

Comments

@talex5
Copy link
Contributor

talex5 commented Feb 3, 2023

ocaml/ocaml#11497 says:

First commit makes sure that signal handlers are run on the alternate signal stack. This is required since fiber stacks are generally too small to run signal handlers on.

Test case:

open Lwt.Infix

let main () =
  for _ = 1 to 10000 do
    match Lwt_unix.fork () with
    | 0 -> Unix._exit 1
    | _child -> ()
  done

let main () =
  Lwt_main.run begin
    Lwt.pause () >>= fun () ->
    main ();
    Lwt.return_unit
  end

let () =
  Effect.Deep.match_with main ()
    { retc = ignore;
      exnc = raise;
      effc = (fun _ -> None);
    };
  Gc.full_major ()

Crashes with various errors, e.g.

$ ./_build/default/bin/main.exe 
corrupted size vs. prev_size
fish: “./_build/default/bin/main.exe” terminated by signal SIGABRT (Abort)

(originally reported as ocaml-multicore/lwt_eio#15)

@talex5
Copy link
Contributor Author

talex5 commented Apr 13, 2023

Are you able to reproduce this? I've seen it on multiple machines.

@raphael-proust
Copy link
Collaborator

I haven't tried reproducing yet. I'm planning on spending some time on Lwt in not too long to get a release through but I don't know when exactly yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants