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

Add coarse grained lock around BSP requests to avoid deadlocks #3243

Merged
merged 1 commit into from
Jul 5, 2024

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented Jul 4, 2024

Fixes #3100, which for some reason is happening frequently enough on my laptop to really hamper my productivity. With a version of Mill built from this PR, the problem seems to have gone away.

We don't really have a strong concurrency model for what's meant to happen when multiple Mill commands are being evaluated at once, and trying to come up with one is a complex task that I don't think is worth the effort. Bazel works fine with a coarse-grained lock even for huge codebases and organizations, so this should do for Mill for now.

Pull request: #3243

@lihaoyi lihaoyi requested review from lefou and lolgab July 4, 2024 09:40
@lihaoyi lihaoyi merged commit 2ac2849 into com-lihaoyi:main Jul 5, 2024
38 of 39 checks passed
@lefou lefou added this to the after 0.11.8 milestone Jul 15, 2024
lihaoyi added a commit that referenced this pull request Sep 8, 2024
…ite sandboxing doc page, introduce `RunModule#runner` (#3479)

Also did some misc cleanup: `synchronizedEval` is now unnecessary since
#3243 added a coarse grained
lock around BSP, prettied up the `#threadId` prefixes, remove empty
`.dest/` folders for tidyness

`RunModule#runner` continues the pattern estabilished with
`CoursierModule#defaultResolver`: a convenient way to bundle up the
various tasks related to running a modules code in a way that lets
downstream callers pass things to `run` while being able to override the
default configs (e.g. `forkEnv`, `forkArgs`, etc.) and without the
hassle of wrapping things in `T.task`s. If this pattern works out, it
would serve as a great alternative to the "pass tasks as arguments to
command" pattern we've used in the past. This makes the
`11-module-run-task` example much nicer

Also more CI optimizations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BSP: importing occasionally gets stuck: mill seems deadlocked
2 participants