Skip to content

ghc-pkg deadlocks on macOS

If I run this script on macOS, after about 15 minutes, a ghc-pkg process will deadlock.

#!/usr/bin/env bash

out=`pwd`/testing-package-db

rm -rf $out

cabal update
cabal install random

mkdir -p $out
ghc-pkg init $out/package.conf.d

while true; do
    ghc-pkg --package-db $HOME/.ghc/x86_64-darwin-8.6.3/package.conf.d dump | ghc-pkg --force --package-db $out/package.conf.d register -
done

Output from sw_vers:

ProductName:    Mac OS X
ProductVersion: 10.12.6
BuildVersion:   16G29

This GHC build comes from the latest nixpkgs-18.09. I have also attached a nix file to build test scripts.

We noticed that if we edited the ghc-pkg binary to link with the threaded RTS, then we could not reproduce the deadlock (after running the test script for 24 hours).

Attached is the output from /usr/bin/sample for the stuck process, and the otool -L ghc-pkg output.

Trac metadata
Trac field Value
Version 8.6.3
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Runtime System
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information