Ma77Ball opened a new pull request, #57436:
URL: https://github.com/apache/spark/pull/57436
### What changes were proposed in this pull request?
Bind the Spark Connect server test harness to port 0 so the OS assigns a
free port,
instead of guessing `CONNECT_GRPC_BINDING_PORT + Random.nextInt(1000)`:
- `SparkConnectServerTest` starts the service on port 0 and reads the real
bound port
from `SparkConnectService.localPort` into `serverPort` (new `startService`
helper).
- `SparkConnectServiceKeepAliveSuite` restarts via a new `restartService`
helper that
rebinds to port 0 rather than reusing a fixed port.
- `RemoteSparkSession` obtains a free port from a throwaway
`ServerSocket(0)`.
### Why are the changes needed?
The random fixed port races other processes and parallel test JVMs for a
specific
port, causing intermittent `BindException`. Letting the OS pick a free port
removes
the race. This complements the SPARK-58094 follow-up (#57342), which only
narrowed
the stop/start-same-port window.
### Does this PR introduce _any_ user-facing change?
No. Test-only; production code is unchanged.
### How was this patch tested?
Existing Connect server and client-jvm suites. Both test modules compile;
Scala
line-length and ASCII lint pass.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.8
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]