[ 
https://issues.apache.org/jira/browse/SCB-365?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16400218#comment-16400218
 ] 

ASF GitHub Bot commented on SCB-365:
------------------------------------

liubao68 closed pull request #567: [SCB-365]when configured ssl certificates 
not exists, startup will hang and no error messages
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/567
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
index c0937732d..19e972bea 100644
--- 
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
+++ 
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/client/ClientVerticle.java
@@ -17,15 +17,25 @@
 
 package org.apache.servicecomb.foundation.vertx.client;
 
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 import io.vertx.core.AbstractVerticle;
 
 public class ClientVerticle<CLIENT_POOL> extends AbstractVerticle {
+  private static final Logger LOGGER = 
LoggerFactory.getLogger(ClientVerticle.class);
   public static final String CLIENT_MGR = "clientMgr";
 
   @SuppressWarnings("unchecked")
   @Override
   public void start() throws Exception {
-    ClientPoolManager<CLIENT_POOL> clientMgr = 
(ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR);
-    clientMgr.createClientPool();
+    try {
+      ClientPoolManager<CLIENT_POOL> clientMgr = 
(ClientPoolManager<CLIENT_POOL>) config().getValue(CLIENT_MGR);
+      clientMgr.createClientPool();
+    } catch (Throwable e) {
+      // vert.x got some states that not print error and execute call back in 
VertexUtils.blockDeploy, we add a log our self.
+      LOGGER.error("", e);
+      throw e;
+    }
   }
 }
diff --git 
a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
 
b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
index e7a694be5..9c892b8f2 100644
--- 
a/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
+++ 
b/transports/transport-highway/src/main/java/org/apache/servicecomb/transport/highway/HighwayServerVerticle.java
@@ -48,9 +48,14 @@ public void init(Vertx vertx, Context context) {
 
   @Override
   public void start(Future<Void> startFuture) throws Exception {
-    super.start();
-
-    startListen(startFuture);
+    try {
+      super.start();
+      startListen(startFuture);
+    } catch (Throwable e) {
+      // vert.x got some states that not print error and execute call back in 
VertexUtils.blockDeploy, we add a log our self.
+      LOGGER.error("", e);
+      throw e;
+    }
   }
 
   protected void startListen(Future<Void> startFuture) {
diff --git 
a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
 
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
index 73eab866a..6578d725e 100644
--- 
a/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
+++ 
b/transports/transport-rest/transport-rest-vertx/src/main/java/org/apache/servicecomb/transport/rest/vertx/RestServerVerticle.java
@@ -59,23 +59,25 @@ public void init(Vertx vertx, Context context) {
 
   @Override
   public void start(Future<Void> startFuture) throws Exception {
-    super.start();
-
-    // 如果本地未配置地址,则表示不必监听,只需要作为客户端使用即可
-    if (endpointObject == null) {
-      LOGGER.warn("rest listen address is not configured, will not start.");
-      startFuture.complete();
-      return;
+    try {
+      super.start();
+      // 如果本地未配置地址,则表示不必监听,只需要作为客户端使用即可
+      if (endpointObject == null) {
+        LOGGER.warn("rest listen address is not configured, will not start.");
+        startFuture.complete();
+        return;
+      }
+      Router mainRouter = Router.router(vertx);
+      mountAccessLogHandler(mainRouter);
+      initDispatcher(mainRouter);
+      HttpServer httpServer = createHttpServer();
+      httpServer.requestHandler(mainRouter::accept);
+      startListen(httpServer, startFuture);
+    } catch(Throwable e) {
+      // vert.x got some states that not print error and execute call back in 
VertexUtils.blockDeploy, we add a log our self.
+      LOGGER.error("", e);
+      throw e;
     }
-
-    Router mainRouter = Router.router(vertx);
-    mountAccessLogHandler(mainRouter);
-    initDispatcher(mainRouter);
-
-    HttpServer httpServer = createHttpServer();
-    httpServer.requestHandler(mainRouter::accept);
-
-    startListen(httpServer, startFuture);
   }
 
   private void mountAccessLogHandler(Router mainRouter) {


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> when configured ssl certificates not exists, startup will hang and no error 
> messages
> ------------------------------------------------------------------------------------
>
>                 Key: SCB-365
>                 URL: https://issues.apache.org/jira/browse/SCB-365
>             Project: Apache ServiceComb
>          Issue Type: Bug
>          Components: Java-Chassis
>    Affects Versions: java-chassis-1.0.0-m1
>            Reporter: liubao
>            Assignee: liubao
>            Priority: Major
>
> runnging demo of springmvc-server
>  # modify ssl.keystore to a wrong file name;
>  # start springmvc-server demo
> we will see startup is hang and no error messages is printed
>  
> Root cause anaylse:
> For HttpServer in Verticals, vert.x will create a CloseHook and execute 
> deploy callback. But HttpServer CloseHook will check if httpserver is created 
> and listen is successful. if not it will not execute deploy callback and 
> VertexUtils.blockDeploy will hang.
>  
> Solutions:
> This is not a valid scenario, so just print the exceptions and give user 
> diagnosis information is enough now. We will future to feedback to vert.x to 
> see better solution.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to