From 1a3cc57e56522f9508cd3b02fa7c3b390d0ffecc Mon Sep 17 00:00:00 2001 From: Nick Mitchell Date: Thu, 26 Sep 2024 11:17:55 -0400 Subject: [PATCH] fix: avoid system port numbers for internal s3 port Signed-off-by: Nick Mitchell --- pkg/fe/prepare-run.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/fe/prepare-run.go b/pkg/fe/prepare-run.go index 5356c278..f6dceeb1 100644 --- a/pkg/fe/prepare-run.go +++ b/pkg/fe/prepare-run.go @@ -41,8 +41,12 @@ func PrepareForRun(runname string, popts PrepareOptions, opts build.Options) (ll } // Assign a port for the internal S3 (TODO: we only need to do - // this if this run will be using an internal S3) - internalS3Port := rand.Intn(65536) + 1 + // this if this run will be using an internal S3). We use the + // range of "ephemeral" + // ports. https://en.wikipedia.org/wiki/Ephemeral_bbport + portMin := 49152 + portMax := 65535 + internalS3Port := rand.Intn(portMax-portMin+1) + portMin if verbose { fmt.Fprintf(os.Stderr, "Using internal S3 port %d\n", internalS3Port) }