From efc6a660ec005b1ee678a7955ca8c69152d1ee97 Mon Sep 17 00:00:00 2001 From: ylinzhu <46126022+ylinzhu@users.noreply.github.com> Date: Tue, 15 Nov 2022 10:03:44 +0800 Subject: [PATCH] fix npe when innerRelease and close are concurrent inner 1883 (#3471) --- .../java/com/actiontech/dble/net/service/AbstractService.java | 2 +- .../dble/services/mysqlsharding/MySQLResponseService.java | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/actiontech/dble/net/service/AbstractService.java b/src/main/java/com/actiontech/dble/net/service/AbstractService.java index 20c548e77..ab7d8183f 100644 --- a/src/main/java/com/actiontech/dble/net/service/AbstractService.java +++ b/src/main/java/com/actiontech/dble/net/service/AbstractService.java @@ -167,7 +167,7 @@ public abstract class AbstractService extends VariablesService implements Servic connection.getSocketWR().disableReadForever(); } if (closeTask.isFirst() && !connection.isOnlyFrontTcpConnected()) { - LOGGER.info("prepare close for conn.conn id {},reason [{}]", connection.getId(), closeTask.getReasonsStr()); + LOGGER.info("prepare close for conn {},reason [{}]", connection, closeTask.getReasonsStr()); } break; diff --git a/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java b/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java index d1ce72d98..9ce063064 100644 --- a/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java +++ b/src/main/java/com/actiontech/dble/services/mysqlsharding/MySQLResponseService.java @@ -18,6 +18,7 @@ import com.actiontech.dble.net.handler.BackEndRecycleRunnable; import com.actiontech.dble.net.mysql.*; import com.actiontech.dble.net.response.*; import com.actiontech.dble.net.service.ServiceTask; +import com.actiontech.dble.net.service.ServiceTaskType; import com.actiontech.dble.net.service.WriteFlags; import com.actiontech.dble.route.RouteResultsetNode; import com.actiontech.dble.rwsplit.RWSplitNonBlockingSession; @@ -516,6 +517,9 @@ public class MySQLResponseService extends BackendService { @Override protected void beforeInsertServiceTask(@NotNull ServiceTask task) { super.beforeInsertServiceTask(task); + if (task.getType() == ServiceTaskType.CLOSE) { + return; + } if (session != null) { session.setBackendResponseTime(this); }