Skip to content

[2.0.x] fix: Print server stderr on startup failure (#8816)#8857

Merged
eed3si9n merged 1 commit intosbt:2.0.xfrom
eed3si9n:bport2/server-startup
Mar 1, 2026
Merged

[2.0.x] fix: Print server stderr on startup failure (#8816)#8857
eed3si9n merged 1 commit intosbt:2.0.xfrom
eed3si9n:bport2/server-startup

Conversation

@eed3si9n
Copy link
Copy Markdown
Member

@eed3si9n eed3si9n commented Mar 1, 2026

This is a backport of #8816

Problem

When the sbt server fails to start (e.g. wrong JDK version), the client only shows "failed to connect to server" hiding the actual error. The server stderr is redirected to /dev/null to prevent Linux pipe buffer deadlocks (#8442), so diagnostic output is lost.

Solution

Redirect server stderr to a temp file instead of /dev/null. When the server fails to start (portfile never appears), read and print the temp file contents before throwing ServerFailedException. The temp file is cleaned up eagerly on both success and failure paths.

Fixes #8812

**Problem**
When the sbt server fails to start (e.g. wrong JDK version), the client
only shows "failed to connect to server" hiding the actual error. The
server stderr is redirected to /dev/null to prevent Linux pipe buffer
deadlocks (sbt#8442), so diagnostic output is lost.

**Solution**
Redirect server stderr to a temp file instead of /dev/null. When the
server fails to start (portfile never appears), read and print the temp
file contents before throwing ServerFailedException. The temp file is
cleaned up eagerly on both success and failure paths.

Fixes sbt#8812
@eed3si9n eed3si9n changed the title [2.x] fix: Print server stderr on startup failure (#8816) [2.0.x] fix: Print server stderr on startup failure (#8816) Mar 1, 2026
@eed3si9n eed3si9n merged commit 5ce61b7 into sbt:2.0.x Mar 1, 2026
15 checks passed
@eed3si9n eed3si9n deleted the bport2/server-startup branch March 1, 2026 20:50
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.

2 participants