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

Fix typo in generic_final_minor_update leading to SEGV or missing finalyser calls. #1849

Merged
merged 1 commit into from Jun 20, 2018

Conversation

Projects
None yet
3 participants
@delamonpansie
Copy link
Contributor

delamonpansie commented Jun 19, 2018

Simple test case: SEGV on 4.06.1 and trunk

let alloc_a () =
  let v = Bytes.create 4096 in
  Gc.finalise_last (fun _ -> ()) v;
  v

let alloc_b () =
  let v = Bytes.create 16 in
  Gc.finalise_last (fun _ -> ()) v;
  v

let main () =
  let q = Queue.create () in
  while true do
    let b = alloc_b () in
    Queue.push b q;
    let a = alloc_a () in
    Queue.push a q;

    while (Queue.length q > 0) do
      ignore(Queue.pop q);
    done;
    Thread.yield ()
  done

let _ = main ()
@xavierleroy

This comment has been minimized.

Copy link
Contributor

xavierleroy commented Jun 19, 2018

Oups. @damiendoligez, @bobot: please check and confirm the fix.

@delamonpansie

This comment has been minimized.

Copy link
Contributor Author

delamonpansie commented Jun 20, 2018

Even simpler test case:

let _ =
  while true do
    let a = Bytes.create 4096 in
    Gc.finalise_last (fun _ -> ()) a;

    let b = Bytes.create 16 in
    Gc.finalise_last (fun _ -> ()) b;
  done
@bobot

This comment has been minimized.

Copy link
Contributor

bobot commented Jun 20, 2018

oups indeed, I confirm the fix. Thank you a lot @delamonpansie !

If you are able to create a test case fast enough to run, you could perhaps add it to the testsuite.

(Note to myself improve the comment just on top of the code)

@xavierleroy xavierleroy merged commit 3590ca9 into ocaml:trunk Jun 20, 2018

1 of 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build failed
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@xavierleroy

This comment has been minimized.

Copy link
Contributor

xavierleroy commented Jun 20, 2018

Merged in trunk. I'll add a change entry and cherry-pick to 4.07.

xavierleroy added a commit that referenced this pull request Jun 20, 2018

Fix typo in generic_final_minor_update (#1849)
The typo leads to SEGV or missing finalyser calls.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.