This is an automated email from the ASF dual-hosted git repository.
roryqi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-uniffle.git
The following commit(s) were added to refs/heads/master by this push:
new 2eafb523c [MINOR] improve(common/server/coordinator): Display the port
in use port (#2122)
2eafb523c is described below
commit 2eafb523c2dfe94624d2c13678236cf44032d12f
Author: maobaolong <[email protected]>
AuthorDate: Sat Sep 14 19:03:18 2024 +0800
[MINOR] improve(common/server/coordinator): Display the port in use port
(#2122)
### What changes were proposed in this pull request?
Display the port while in use
### Why are the changes needed?
Help to find the in use port and its process.
### Does this PR introduce _any_ user-facing change?
```
16:29:02.179 [main] ERROR org.apache.uniffle.common.web.JettyServer -
Terminating with exit status 1: Fail to start jetty http server, port is 9528
java.net.BindException: Address already in use
at sun.nio.ch.Net.bind0(Native Method) ~[?:1.8.0_251]
at sun.nio.ch.Net.bind(Net.java:433) ~[?:1.8.0_251]
at sun.nio.ch.Net.bind(Net.java:425) ~[?:1.8.0_251]
at
sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
~[?:1.8.0_251]
```
### How was this patch tested?
UTs.
---
common/src/main/java/org/apache/uniffle/common/web/JettyServer.java | 2 +-
.../src/test/java/org/apache/uniffle/common/web/JettyServerTest.java | 2 +-
.../java/org/apache/uniffle/coordinator/CoordinatorServerTest.java | 3 ++-
server/src/test/java/org/apache/uniffle/server/ShuffleServerTest.java | 3 ++-
4 files changed, 6 insertions(+), 4 deletions(-)
diff --git
a/common/src/main/java/org/apache/uniffle/common/web/JettyServer.java
b/common/src/main/java/org/apache/uniffle/common/web/JettyServer.java
index e42d86a1e..00b906266 100644
--- a/common/src/main/java/org/apache/uniffle/common/web/JettyServer.java
+++ b/common/src/main/java/org/apache/uniffle/common/web/JettyServer.java
@@ -167,7 +167,7 @@ public class JettyServer {
try {
server.start();
} catch (BindException e) {
- ExitUtils.terminate(1, "Fail to start jetty http server", e, LOG);
+ ExitUtils.terminate(1, "Fail to start jetty http server, port is " +
httpPort, e, LOG);
}
LOG.info("Jetty http server started, listening on port {}", httpPort);
}
diff --git
a/common/src/test/java/org/apache/uniffle/common/web/JettyServerTest.java
b/common/src/test/java/org/apache/uniffle/common/web/JettyServerTest.java
index a168f111f..353c74d3b 100644
--- a/common/src/test/java/org/apache/uniffle/common/web/JettyServerTest.java
+++ b/common/src/test/java/org/apache/uniffle/common/web/JettyServerTest.java
@@ -86,7 +86,7 @@ public class JettyServerTest {
try {
jettyServer2.start();
} catch (Exception e) {
- assertEquals(expectMessage, e.getMessage());
+ assertTrue(e.getMessage().startsWith(expectMessage));
assertEquals(expectStatus, ((ExitException) e).getStatus());
}
diff --git
a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java
b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java
index ef151207e..2fb4810ec 100644
---
a/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java
+++
b/coordinator/src/test/java/org/apache/uniffle/coordinator/CoordinatorServerTest.java
@@ -23,6 +23,7 @@ import org.apache.uniffle.common.util.ExitUtils;
import org.apache.uniffle.common.util.ExitUtils.ExitException;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
public class CoordinatorServerTest {
@@ -43,7 +44,7 @@ public class CoordinatorServerTest {
try {
cs2.start();
} catch (Exception e) {
- assertEquals(expectMessage, e.getMessage());
+ assertTrue(e.getMessage().startsWith(expectMessage));
assertEquals(expectStatus, ((ExitException) e).getStatus());
} finally {
// Always call stopServer after new CoordinatorServer to shut down
ExecutorService
diff --git
a/server/src/test/java/org/apache/uniffle/server/ShuffleServerTest.java
b/server/src/test/java/org/apache/uniffle/server/ShuffleServerTest.java
index 55aa433c4..3356f6790 100644
--- a/server/src/test/java/org/apache/uniffle/server/ShuffleServerTest.java
+++ b/server/src/test/java/org/apache/uniffle/server/ShuffleServerTest.java
@@ -38,6 +38,7 @@ import org.apache.uniffle.storage.util.StorageType;
import static
org.apache.uniffle.server.ShuffleServerConf.SERVER_DECOMMISSION_CHECK_INTERVAL;
import static
org.apache.uniffle.server.ShuffleServerConf.SERVER_DECOMMISSION_SHUTDOWN;
import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
import static org.junit.jupiter.api.Assertions.fail;
public class ShuffleServerTest {
@@ -56,7 +57,7 @@ public class ShuffleServerTest {
try {
ss2.start();
} catch (Exception e) {
- assertEquals(expectMessage, e.getMessage());
+ assertTrue(e.getMessage().startsWith(expectMessage));
assertEquals(expectStatus, ((ExitException) e).getStatus());
}