haskell / haskell/cabal

Concurrent `cabal new-build` runs cause non-deterministic failures

Open
#4,811 3 comments 0 reactions 0 assignees View on GitHub
cabal-install: v2-build system type: enhancement
Dominant language
Haskell
Stars
1.7k
Forks
750
Avg merge
4d 3h
Merged PRs (30d)
28

Description

When running concurrent new-builds such as:

```
cabal new-build -ghc-options=-fmax-errors=1 &
cabal new-build -ghc-options=-fmax-errors=2
```

I get non-deterministic errors. Consider the below which appears to reference different versions of the same package:

```
[project]/Git.hs:29:71: error:
• Couldn't match type ‘text-1.2.2.2:Data.Text.Internal.Text’
with ‘Text’
NB: ‘Text’
is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.2’
‘text-1.2.2.2:Data.Text.Internal.Text’
is defined in ‘Data.Text.Internal’ in package ‘text-1.2.2.2’
Expected type: Text
Actual type: CommitID
• In the first argument of ‘T.unpack’, namely ‘cid’
In the expression: T.unpack cid
In the second argument of ‘readProcess’, namely
‘["log", "--pretty=%P", "-n1", T.unpack cid]’
```

N.B. `type CommitID = Text`

Contributor guide

Open the contributing guide

Research direction

Begin by reproducing the two concurrent `cabal new-build` commands shown in the issue and capture the resulting type mismatch. Trace how concurrent builds handle package versions and shared build state; done means concurrent runs complete deterministically without the reported conflicting-type failure.

Written by the indexing model from the issue text.

Assessment

Tech stack
haskell
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.