Skip to content

Run at most one BSP server per build client - #6905

Merged
lihaoyi merged 1 commit into
com-lihaoyi:mainfrom
alexarchambault:no-concurrent-bsp-servers
Mar 5, 2026
Merged

lihaoyi merged 1 commit into
com-lihaoyi:mainfrom
alexarchambault:no-concurrent-bsp-servers

Conversation

@alexarchambault

@alexarchambault alexarchambault commented Mar 5, 2026 •

Copy link
Copy Markdown
Collaborator

This makes Mill run at most one BSP server per build client type in a given project. This identifies build clients with their "display name" in the build initialize request, and ensures only one build server for this display name runs at a time.

If two build servers run at a time for build clients with the same display name, it is likely the first one is a zombie that's not needed anymore. Yet, it keeps watching the build sources, and tries to re-compile the build every time its sources change. Build servers hinder each other in such a scenario, so this PR makes this more unlikely, by having the second build server kill the first one upon startup.

Knowing if a build server already runs is handled the same way as locking when running tasks, except we also put the display name in the lock file name and its accompanying "active" info file name, and we default to killing the other Mill process here, rather than waiting for it to release the lock.

The build client display name is taken into account here, so that users can still have a Mill BSP server running for IntelliJ and another one running for VSCode.

And kill previously running BSP server if needed
@lihaoyi
lihaoyi merged commit 1d8a71b into com-lihaoyi:main Mar 5, 2026
68 of 69 checks passed
@lefou lefou added this to the 1.1.3 milestone Mar 6, 2026
@lefou

lefou commented Mar 6, 2026

Copy link
Copy Markdown
Member

This is only relevant to instances sharing the same BSP_OUTPUT_DIR, right?

@alexarchambault

Copy link
Copy Markdown
Collaborator Author

This is only relevant to instances sharing the same BSP_OUTPUT_DIR, right?

Yes, the lock files for this live under the output directory that ended up being picked (.bsp/out by default here)

@alexarchambault
alexarchambault deleted the no-concurrent-bsp-servers branch March 9, 2026 15:44
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.

3 participants