You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by GitBox <gi...@apache.org> on 2021/07/29 04:30:40 UTC

[GitHub] [incubator-eventmesh] lrhkobe opened a new issue #476: Biz Exceptions occured in EventMesh cause connection close of client

lrhkobe opened a new issue #476:
URL: https://github.com/apache/incubator-eventmesh/issues/476


   ## Bug Report
   
   ### Describe the bug
   When exception occured in the method of `channelRead0`,  it will be thrown, and handled by the method 'exceptionCaught' in the class of `EventMeshTcpExceptionHandler` .
   ```
   public class EventMeshTcpMessageDispatcher extends SimpleChannelInboundHandler<Package> {
   
       @Override
       protected void channelRead0(ChannelHandlerContext ctx, Package pkg) throws Exception { 
           try {
               ...
   
               dispatch(ctx, pkg, startTime, cmd);
           } catch (Exception e) {
               logger.error("exception occurred while pkg|cmd={}|pkg={}|errMsg={}", cmd, pkg, e);
               //throw new RuntimeException(e);
               throw e;
           }
       }
   }
   ```
   
   
   When EventMesh caught the exception, it will send goodbye instruction to the client, that means the biz exception caused the connection close of client. It seems unreasonable.
   ```
   public class EventMeshTcpExceptionHandler extends ChannelDuplexHandler {
   
       @Override
       public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
           Session session = eventMeshTCPServer.getClientSessionGroupMapping().getSession(ctx);
           UserAgent client = session == null ? null : session.getClient();
           logger.error("exceptionCaught, push goodbye to client|user={},errMsg={}", client, cause.fillInStackTrace());
           String errMsg;
           if (cause.toString().contains("value not one of declared Enum instance names")) {
               errMsg = "Unknown Command type";
           } else {
               errMsg = cause.toString();
           }
   
           if (session != null) {
               EventMeshTcp2Client.goodBye2Client(eventMeshTCPServer, session, errMsg, OPStatus.FAIL.getCode(), eventMeshTCPServer.getClientSessionGroupMapping());
           } else {
               EventMeshTcp2Client.goodBye2Client(ctx, errMsg, eventMeshTCPServer.getClientSessionGroupMapping(), eventMeshTCPServer.getEventMeshTcpMonitor());
           }
       }
   }
   ```
   
   
   
   
   
   
   
   
   
   
   


-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org


[GitHub] [incubator-eventmesh] xwm1992 closed issue #476: Biz Exceptions occured in EventMesh cause connection close of client

Posted by GitBox <gi...@apache.org>.
xwm1992 closed issue #476:
URL: https://github.com/apache/incubator-eventmesh/issues/476


   


-- 
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: dev-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org