From 13230170b6876fdbdf32628a74bc07b83bcb7f9b Mon Sep 17 00:00:00 2001
From: Tim Wickberg <tim@schedmd.com>
Date: Wed, 22 May 2019 11:37:02 -0600
Subject: [PATCH] Update error message to be more descriptive if port selection
 fails.

Can happen if SrunPortRange has been set too small, especially on shared
login nodes launching multiple large-scale srun processes.
---
 src/common/slurm_protocol_api.c | 2 +-
 testsuite/expect/test1.99       | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/common/slurm_protocol_api.c b/src/common/slurm_protocol_api.c
index c9cfafa0bd7..33a554b7b0e 100644
--- a/src/common/slurm_protocol_api.c
+++ b/src/common/slurm_protocol_api.c
@@ -5309,7 +5309,7 @@ int sock_bind_range(int s, uint16_t *range, bool local)
 		--count;
 	} while (count > 0);
 
-	error("%s: ohmygosh all ports in range (%d, %d) exhausted",
+	error("%s: all ports in range (%u, %u) exhausted, cannot establish listening port",
 	      __func__, min, max);
 
 	return -1;
diff --git a/testsuite/expect/test1.99 b/testsuite/expect/test1.99
index 85de698ad8b..e353ee6ee0e 100755
--- a/testsuite/expect/test1.99
+++ b/testsuite/expect/test1.99
@@ -199,7 +199,7 @@ wait_for_job $tmp_id RUNNING
 set match 0
 spawn $srun -t1 sleep 10
 expect {
-	-re "ohmygosh all ports in range" {
+	-re "all ports in range" {
 		set match 1
 		send_user "\nThis error is expected, do not worry\n"
 		exp_continue
-- 
GitLab