Segmentation fault in the test suite under GHC 9.2.1
UnkindPartition opened this issue · comments
I pushed the branch ghc-9.2.1, which builds inline-r with GHC 9.2.1.
The inline-r:test:tests
test suite fails with
[nix-shell:~/HaskellR]$ ./inline-r/.stack-work/dist/x86_64-linux-nix/Cabal-3.6.0.0/build/tests/tests -j 1 -p events
Unit tests
events
addInputHandler increases handler count: OK
removeInputHandler decreases handler count: OK
file events (select): Segmentation fault (core dumped)
Interestingly, if I run just that test, it passes:
[nix-shell:~/HaskellR]$ ./inline-r/.stack-work/dist/x86_64-linux-nix/Cabal-3.6.0.0/build/tests/tests -p 'file events'
Unit tests
events
file events (select): OK
So there must be some kind of interaction with the previous tests.
Also reproduced on the CI:
https://github.com/tweag/HaskellR/runs/4762036549?check_suite_focus=true
Looks like it's the interaction with the addInputHandler test that causes this:
[nix-shell:~/HaskellR]$ ./inline-r/.stack-work/dist/x86_64-linux-nix/Cabal-3.6.0.0/build/tests/tests -p '/file events/ || /addInputHandler increases/'
Unit tests
events
addInputHandler increases handler count: OK
file events (select): Segmentation fault (core dumped)
I think what's going on here is that the addInputHandler
test adds an input handler, then de-allocates the handler function (via freeHaskellFunPtr
). Then at some point R decides to call that function, which leads to a segfault.