ghc-iserv BUS error / SIGSEGV on Darwin with GHC 9.6 / 9.8
Describe the bug
Testing //tests/haskell_module/dep-narrowing-th:Test on amd64 Darwin using GHC 9.6 crashes ghc-iserv with a BUS error when using a GHC from nixpkgs, and with a SIGSEGV error using a GHC bindist.
nixpkgs GHC 9.6.2:
ERROR: /Users/runner/work/rules_haskell/rules_haskell/rules_haskell_tests/tests/haskell_module/dep-narrowing-th/BUILD.bazel:88:16: HaskellBuildObject @//tests/haskell_module/dep-narrowing-th:lib @//tests/haskell_module/dep-narrowing-th:TestModule2 failed: (Exit 1): ghc_wrapper failed: error executing command (from target //tests/haskell_module/dep-narrowing-th:lib)
(cd /private/var/tmp/_bazel_runner/6f93c0710d32c05eb86fd5414239ece6/sandbox/processwrapper-sandbox/3795/execroot/rules_haskell_tests && \
exec env - \
LANG=C.UTF-8 \
MUST_EXTRACT_ABI=true \
PATH=/nix/store/f0hpls21prmic0kg5b4yz5wgg1jdradr-posix-toolchain/bin:/nix/store/f0hpls21prmic0kg5b4yz5wgg1jdradr-posix-toolchain/bin \
RULES_HASKELL_DOCDIR_PATH=/nix/store/slndd05yb65viiv9g7b05fb9y38rj0kq-ghc-9.6.2/lib/ghc-9.6.2/lib/../../../../qpzm6rba12ifz005ksjx302vyrzri7rq-ghc-9.6.2-doc/share/doc/ghc/html/libraries/base-4.18.0.0 \
RULES_HASKELL_GHC_PATH=external/rules_haskell_ghc_nixpkgs/bin/ghc \
RULES_HASKELL_GHC_PKG_PATH=external/rules_haskell_ghc_nixpkgs/bin/ghc-pkg \
RULES_HASKELL_LIBDIR_PATH=/nix/store/slndd05yb65viiv9g7b05fb9y38rj0kq-ghc-9.6.2/lib/ghc-9.6.2/lib \
bazel-out/darwin-opt-exec-C7777A24/bin/external/rules_haskell/haskell/ghc_wrapper bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/compile_flags_lib_tests_haskell_module_dep-narrowing-th_TestModule2_HaskellBuildObjectProf bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/extra_args_lib_tests_haskell_module_dep-narrowing-th_TestModule2_HaskellBuildObjectProf bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/show_iface_lib_tests_haskell_module_dep-narrowing-th_TestModule2 bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/testsZShaskellZUmoduleZSdep-narrowing-thZSlib/_iface/TestModule2.p_abi bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/interfaces_lib_tests_haskell_module_dep-narrowing-th_TestModule2 bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/unused_lib_tests_haskell_module_dep-narrowing-th_TestModule2)
# Configuration: b90e686f7362f222f0a77fdd18c7cd52adae6ac6c043bbfd99dd47bb206c3ee8
# Execution platform: @rules_nixpkgs_core//platforms:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
tests/haskell_module/dep-narrowing-th/TestModule2.hs:1:1: error: [GHC-87897]
Exception when trying to run compile-time code:
ghc-iserv terminated (-10)
Code: runIO foo >> return []
|
1 | {-# LANGUAGE TemplateHaskell #-}
| ^
INFO: Elapsed time: 245.147s, Critical Path: 237.20s
INFO: 2913 processes: 972 remote cache hit, 1752 internal, 6 local, 183 processwrapper-sandbox.
FAILED: Build did NOT complete successfully
FAILED: Build did NOT complete successfully
INFO: Streaming build results to:
See https://app.buildbuddy.io/invocation/f4ab2875-0a9b-4a5d-9084-c5ec51714377
GHC 9.6.2 bindist
$ bazel test --config macos-bindist -c dbg //tests/haskell_module/dep-narrowing-th:Test
Starting local Bazel server and connecting to it...
DEBUG: /private/var/tmp/_bazel_claudio/424cbf2491690099f756cdd833c2ed97/external/rules_haskell/haskell/private/versions.bzl:134:14: WARNING: Current Bazel version is 6.4.0- (
@non-git); expected at most 6.3.2
INFO: Analyzed target //tests/haskell_module/dep-narrowing-th:Test (86 packages loaded, 11741 targets configured).
INFO: Found 1 test target...
ERROR: /Users/claudio/rules_haskell/rules_haskell_tests/tests/haskell_module/dep-narrowing-th/BUILD.bazel:88:16: HaskellBuildObject @//tests/haskell_module/dep-narrowing-th:l
ib @//tests/haskell_module/dep-narrowing-th:TestModule failed: (Exit 1): ghc_wrapper failed: error executing command (from target //tests/haskell_module/dep-narrowing-th:lib)
bazel-out/darwin-opt-exec-2B5CBBC6/bin/external/rules_haskell/haskell/ghc_wrapper ... (remaining 6 arguments skipped)
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
ghc-9.6.2: ghc-iserv terminated (-11)
To Reproduce
-
nix-shell --pure --argstr ghcVersion 9.6.2 --arg docTools false -
cd rules_haskell_tests -
bazel test --config macos-bindist -c dbg //tests/haskell_module/dep-narrowing-th:Test
or
-
bazel test --config macos-nixpkgs -c dbg //tests/haskell_module/dep-narrowing-th:Test
Expected behavior The test should run successfully.
Environment
- OS name + version: amd64 Darwin (macos-11 on Github)
- Bazel version: 6.2.0 / 6.4.0
- Version of the rules: 60e7a0d2d34c10a1d610639e69667ac838b6ee5c
Still happens with GHC 9.6.5
Still happens on GHC 9.8.2 using bazel 6.5.0, but for this CI run only the nixpkgs CI job failed, the bindist one was successful:
ERROR: /Users/runner/work/rules_haskell/rules_haskell/rules_haskell_tests/tests/haskell_module/dep-narrowing-th/BUILD.bazel:88:16: HaskellBuildObject @//tests/haskell_module/dep-narrowing-th:lib @//tests/haskell_module/dep-narrowing-th:TestModule2 failed: (Exit 1): ghc_wrapper failed: error executing command (from target //tests/haskell_module/dep-narrowing-th:lib)
(cd /private/var/tmp/_bazel_runner/6f93c0710d32c05eb86fd5414239ece6/sandbox/processwrapper-sandbox/3011/execroot/rules_haskell_tests && \
exec env - \
LANG=C.UTF-8 \
MUST_EXTRACT_ABI=true \
PATH=/nix/store/2y8c6r6ligay2nqgq7lkrvs6ab6kbkhf-posix-toolchain/bin:/nix/store/2y8c6r6ligay2nqgq7lkrvs6ab6kbkhf-posix-toolchain/bin \
RULES_HASKELL_DOCDIR_PATH=/nix/store/isafdhwkb7lasa8abs51i9zvh6cj6hnn-ghc-9.8.2/lib/ghc-9.8.2/lib/../../../../7b9f59k9qn8vmrz0bk85q0ddvrmv91k8-ghc-9.8.2-doc/share/doc/ghc/html/libraries/base-4.19.1.0-inplace \
RULES_HASKELL_GHC_PATH=external/rules_haskell_ghc_nixpkgs/bin/ghc \
RULES_HASKELL_GHC_PKG_PATH=external/rules_haskell_ghc_nixpkgs/bin/ghc-pkg \
RULES_HASKELL_LIBDIR_PATH=/nix/store/isafdhwkb7lasa8abs51i9zvh6cj6hnn-ghc-9.8.2/lib/ghc-9.8.2/lib \
bazel-out/darwin-opt-exec-C7777A24/bin/external/rules_haskell/haskell/ghc_wrapper bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/compile_flags_lib_tests_haskell_module_dep-narrowing-th_TestModule2_HaskellBuildObjectProf bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/extra_args_lib_tests_haskell_module_dep-narrowing-th_TestModule2_HaskellBuildObjectProf bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/show_iface_lib_tests_haskell_module_dep-narrowing-th_TestModule2 bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/testsZShaskellZUmoduleZSdep-narrowing-thZSlib/_iface/TestModule2.p_abi bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/interfaces_lib_tests_haskell_module_dep-narrowing-th_TestModule2 bazel-out/darwin-dbg/bin/tests/haskell_module/dep-narrowing-th/unused_lib_tests_haskell_module_dep-narrowing-th_TestModule2)
# Configuration: 0aae392cfd9a7c739059689f8bb6b8807a984a51ff2c8a4746063fe4e6731918
# Execution platform: @rules_nixpkgs_core//platforms:host
Use --sandbox_debug to see verbose messages from the sandbox and retain the sandbox build root for debugging
tests/haskell_module/dep-narrowing-th/TestModule2.hs:1:1: error: [GHC-87897]
Exception when trying to run compile-time code:
External interpreter terminated (-10)
Code: runIO foo >> return []
|
1 | {-# LANGUAGE TemplateHaskell #-}
| ^
INFO: Elapsed time: 35.953s, Critical Path: 13.70s
https://app.buildbuddy.io/invocation/4f1497dd-af5e-4b88-883b-1e5b6a93b24f