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

Fix destroyOnExit default forwarding, make destroy recursive by default #359

Merged
merged 24 commits into from
Feb 18, 2025

Conversation

lihaoyi
Copy link
Member

@lihaoyi lihaoyi commented Feb 18, 2025

  • Previously a bunch of bincompat forwarders were incorrectly setting destroyOnExit = false when the default is true, this makes them consistently pass destroyOnExit = false when an explicit value is not provided
  • os.proc.call was forgetting to forward shutdownGracePeriod and destroyOnExit to the underlying os.proc.spawn
  • SubProcess#destroy was not destroying descendent processes. While this has always been the default, it has always been confusing, and often resulted in leaking orphan processes. This PR makes it recursively destroy child processes by default, unless passed recursive = false. destroyOnExit and on timeout now is always recursive

Dropping Scala-Native support for now due to:

os.native[2.12.17].test.nativeLink scala.scalanative.linker.LinkingException: Unreachable symbols found after classloading run. It can happen when using dependencies not cross-compiled for Scala Native or not yet ported JDK definitions.

Will open an issue to figure it out asynchronously

@lihaoyi lihaoyi changed the title Fix destroyOnExit default forwarding Fix destroyOnExit default forwarding, make destroy recursive by default Feb 18, 2025
@lihaoyi lihaoyi merged commit ff52a8b into main Feb 18, 2025
8 checks passed
@lihaoyi lihaoyi deleted the shutdown-hook branch February 18, 2025 04:31
lihaoyi added a commit to com-lihaoyi/mill that referenced this pull request Feb 18, 2025
Pulls in com-lihaoyi/os-lib#359 from upstream to
fix a problem with leaked processes causing hangs
lihaoyi added a commit to com-lihaoyi/mill that referenced this pull request Feb 19, 2025
…, use it in integration test cleanup (#4587)

This attempts to fix some of the residual flakiness encountered in
#4570

Somehow the recursive process termination we pulled in from upstream
com-lihaoyi/os-lib#359 only works some of the
time, and other times the processes get leaked. This PR extends the
`serverId`-file-deleted shutdown logic we already used for client-server
mode and enables it for `--no-server` mode as well. This lets us put an
additional guardrail in our `IntegrationTester#close` to delete any such
files, to try and force any Mill processes to terminate.

Added an additional integration test to exercise this behavior

Also fixed a bug in `ExampleTester` not honoring the `clientServerMode`
flag, and update `testkit.test` to assert on those behaviors
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.

1 participant