From b84c1386bba2ac306a002b1a283cdb952b456047 Mon Sep 17 00:00:00 2001 From: icodening Date: Wed, 11 Oct 2023 11:17:41 +0800 Subject: [PATCH 01/27] add ping pong for tri protocol (#12955) * add ping pong for tri protocol * add ping pong for tri protocol * add ping pong for tri protocol * add ping pong for tri protocol --- .../netty4/NettyConnectionClient.java | 14 +++- .../rpc/protocol/tri/TripleHttp2Protocol.java | 2 + .../protocol/tri/TriplePingPongHandler.java | 76 +++++++++++++++++++ 3 files changed, 88 insertions(+), 4 deletions(-) create mode 100644 dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriplePingPongHandler.java diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java index b1da49c8a5..e585bff61b 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java @@ -40,15 +40,18 @@ import io.netty.channel.ChannelPipeline; import io.netty.channel.EventLoop; import io.netty.channel.socket.SocketChannel; import io.netty.handler.ssl.SslContext; +import io.netty.handler.timeout.IdleStateHandler; import io.netty.util.AttributeKey; import io.netty.util.concurrent.DefaultPromise; import io.netty.util.concurrent.GlobalEventExecutor; import io.netty.util.concurrent.Promise; +import org.apache.dubbo.remoting.utils.UrlUtils; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; +import static java.util.concurrent.TimeUnit.MILLISECONDS; import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_CLIENT_THREADPOOL; import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_CLIENT_CONNECT_TIMEOUT; @@ -122,12 +125,15 @@ public class NettyConnectionClient extends AbstractConnectionClient { } // pipeline.addLast("logging", new LoggingHandler(LogLevel.INFO)); //for debug - // TODO support IDLE -// int heartbeatInterval = UrlUtils.getHeartbeat(getUrl()); + + int heartbeat = UrlUtils.getHeartbeat(getUrl()); + pipeline.addLast("client-idle-handler", new IdleStateHandler(heartbeat, 0, 0, MILLISECONDS)); + pipeline.addLast("connectionHandler", connectionHandler); NettyConfigOperator operator = new NettyConfigOperator(nettyChannel, getChannelHandler()); protocol.configClientPipeline(getUrl(), operator, nettySslContextOperator); + ch.closeFuture().addListener(channelFuture -> doClose()); // TODO support Socks5 } }); @@ -271,7 +277,7 @@ public class NettyConnectionClient extends AbstractConnectionClient { try { doConnect(); } catch (RemotingException e) { - LOGGER.error(TRANSPORT_FAILED_RECONNECT, "", "", "Failed to connect to server: " + getConnectAddress()); + LOGGER.error(TRANSPORT_FAILED_RECONNECT, "", "", "Failed to connect to server: " + getConnectAddress()); } } @@ -349,7 +355,7 @@ public class NettyConnectionClient extends AbstractConnectionClient { try { connectionClient.doConnect(); } catch (RemotingException e) { - LOGGER.error(TRANSPORT_FAILED_RECONNECT, "", "", "Failed to connect to server: " + getConnectAddress()); + LOGGER.error(TRANSPORT_FAILED_RECONNECT, "", "", "Failed to connect to server: " + getConnectAddress()); } }, 1L, TimeUnit.SECONDS); } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java index 8daa1f600f..4a07c30706 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java @@ -37,6 +37,7 @@ import org.apache.dubbo.remoting.api.AbstractWireProtocol; import org.apache.dubbo.remoting.api.pu.ChannelHandlerPretender; import org.apache.dubbo.remoting.api.pu.ChannelOperator; import org.apache.dubbo.remoting.api.ssl.ContextOperator; +import org.apache.dubbo.remoting.utils.UrlUtils; import org.apache.dubbo.rpc.HeaderFilter; import org.apache.dubbo.rpc.executor.ExecutorSupport; import org.apache.dubbo.rpc.model.FrameworkModel; @@ -165,6 +166,7 @@ public class TripleHttp2Protocol extends AbstractWireProtocol implements ScopeMo List handlers = new ArrayList<>(); handlers.add(new ChannelHandlerPretender(codec)); handlers.add(new ChannelHandlerPretender(handler)); + handlers.add(new ChannelHandlerPretender(new TriplePingPongHandler(UrlUtils.getCloseTimeout(url)))); handlers.add(new ChannelHandlerPretender(new TripleTailHandler())); operator.configChannelHandler(handlers); } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriplePingPongHandler.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriplePingPongHandler.java new file mode 100644 index 0000000000..cffb6ba10e --- /dev/null +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TriplePingPongHandler.java @@ -0,0 +1,76 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.dubbo.rpc.protocol.tri; + +import io.netty.channel.ChannelDuplexHandler; +import io.netty.channel.ChannelHandlerContext; +import io.netty.handler.codec.http2.DefaultHttp2PingFrame; +import io.netty.handler.codec.http2.Http2PingFrame; +import io.netty.handler.timeout.IdleStateEvent; + +import java.util.concurrent.ScheduledFuture; +import java.util.concurrent.TimeUnit; + +public class TriplePingPongHandler extends ChannelDuplexHandler { + + private final long pingAckTimeout; + + private ScheduledFuture pingAckTimeoutFuture; + + public TriplePingPongHandler(long pingAckTimeout) { + this.pingAckTimeout = pingAckTimeout; + } + + @Override + public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { + if (!(msg instanceof Http2PingFrame) || pingAckTimeoutFuture == null) { + super.channelRead(ctx, msg); + return; + } + //cancel task when read anything, include http2 ping ack + pingAckTimeoutFuture.cancel(true); + pingAckTimeoutFuture = null; + } + + @Override + public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { + if (!(evt instanceof IdleStateEvent)) { + ctx.fireUserEventTriggered(evt); + return; + } + ctx.writeAndFlush(new DefaultHttp2PingFrame(0)); + if (pingAckTimeoutFuture == null) { + pingAckTimeoutFuture = ctx.executor().schedule(new CloseChannelTask(ctx), pingAckTimeout, TimeUnit.MILLISECONDS); + } + //not null means last ping ack not received + } + + private static class CloseChannelTask implements Runnable { + + private final ChannelHandlerContext ctx; + + public CloseChannelTask(ChannelHandlerContext ctx) { + this.ctx = ctx; + } + + @Override + public void run() { + ctx.close(); + } + } + +} From 069fd5e1ce1009e230b4d392602e8be327d34a85 Mon Sep 17 00:00:00 2001 From: TomlongTK Date: Wed, 11 Oct 2023 23:23:25 +0800 Subject: [PATCH 02/27] Fix triple client stream executor (#13178) * Fix error stream executor * add ping pong for tri protocol (#12955) * add ping pong for tri protocol * add ping pong for tri protocol * add ping pong for tri protocol * add ping pong for tri protocol * Revert "add ping pong for tri protocol (#12955)" This reverts commit 5a3be17bf133e023c1a1627406c2c6539cdf0bb1. --------- Co-authored-by: Albumen Kevin Co-authored-by: icodening --- .../support/cached/CachedThreadPool.java | 17 +++++++++++++---- .../support/limited/LimitedThreadPool.java | 17 +++++++++++++---- .../remoting/transport/AbstractClient.java | 3 +-- .../transport/netty4/NettyConnectionClient.java | 10 ++-------- .../dubbo/rpc/protocol/tri/TripleProtocol.java | 14 +++++++++----- 5 files changed, 38 insertions(+), 23 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPool.java b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPool.java index b053bd9337..90419c4d90 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPool.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/cached/CachedThreadPool.java @@ -22,6 +22,7 @@ import org.apache.dubbo.common.threadpool.MemorySafeLinkedBlockingQueue; import org.apache.dubbo.common.threadpool.ThreadPool; import org.apache.dubbo.common.threadpool.support.AbortPolicyWithReport; +import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.SynchronousQueue; @@ -53,10 +54,18 @@ public class CachedThreadPool implements ThreadPool { int threads = url.getParameter(THREADS_KEY, Integer.MAX_VALUE); int queues = url.getParameter(QUEUES_KEY, DEFAULT_QUEUES); int alive = url.getParameter(ALIVE_KEY, DEFAULT_ALIVE); - return new ThreadPoolExecutor(cores, threads, alive, TimeUnit.MILLISECONDS, - queues == 0 ? new SynchronousQueue() : - (queues < 0 ? new MemorySafeLinkedBlockingQueue() - : new LinkedBlockingQueue(queues)), + + BlockingQueue blockingQueue; + + if (queues == 0) { + blockingQueue = new SynchronousQueue<>(); + } else if (queues < 0) { + blockingQueue = new MemorySafeLinkedBlockingQueue<>(); + } else { + blockingQueue = new LinkedBlockingQueue<>(queues); + } + + return new ThreadPoolExecutor(cores, threads, alive, TimeUnit.MILLISECONDS, blockingQueue, new NamedInternalThreadFactory(name, true), new AbortPolicyWithReport(name, url)); } } diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPool.java b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPool.java index f0203e6676..de70f3c512 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPool.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/support/limited/LimitedThreadPool.java @@ -23,6 +23,7 @@ import org.apache.dubbo.common.threadpool.MemorySafeLinkedBlockingQueue; import org.apache.dubbo.common.threadpool.ThreadPool; import org.apache.dubbo.common.threadpool.support.AbortPolicyWithReport; +import java.util.concurrent.BlockingQueue; import java.util.concurrent.Executor; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.SynchronousQueue; @@ -50,10 +51,18 @@ public class LimitedThreadPool implements ThreadPool { int cores = url.getParameter(CORE_THREADS_KEY, DEFAULT_CORE_THREADS); int threads = url.getParameter(THREADS_KEY, DEFAULT_THREADS); int queues = url.getParameter(QUEUES_KEY, DEFAULT_QUEUES); - return new ThreadPoolExecutor(cores, threads, Long.MAX_VALUE, TimeUnit.MILLISECONDS, - queues == 0 ? new SynchronousQueue() : - (queues < 0 ? new MemorySafeLinkedBlockingQueue() - : new LinkedBlockingQueue(queues)), + + BlockingQueue blockingQueue; + + if (queues == 0) { + blockingQueue = new SynchronousQueue<>(); + } else if (queues < 0) { + blockingQueue = new MemorySafeLinkedBlockingQueue<>(); + } else { + blockingQueue = new LinkedBlockingQueue<>(queues); + } + + return new ThreadPoolExecutor(cores, threads, Long.MAX_VALUE, TimeUnit.MILLISECONDS, blockingQueue, new NamedInternalThreadFactory(name, true), new AbortPolicyWithReport(name, url)); } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java index a2cba73bc4..71392adf82 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractClient.java @@ -40,14 +40,13 @@ import static org.apache.dubbo.common.constants.CommonConstants.THREAD_NAME_KEY; import static org.apache.dubbo.common.constants.CommonConstants.LAZY_CONNECT_KEY; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CLOSE; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CONNECT_PROVIDER; +import static org.apache.dubbo.config.Constants.CLIENT_THREAD_POOL_NAME; /** * AbstractClient */ public abstract class AbstractClient extends AbstractEndpoint implements Client { - protected static final String CLIENT_THREAD_POOL_NAME = "DubboClientHandler"; - private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(AbstractClient.class); private final Lock connectLock = new ReentrantLock(); diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java index e585bff61b..d60807f836 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java @@ -20,7 +20,6 @@ import org.apache.dubbo.common.URL; import org.apache.dubbo.common.Version; import org.apache.dubbo.common.logger.ErrorTypeAwareLogger; import org.apache.dubbo.common.logger.LoggerFactory; -import org.apache.dubbo.common.utils.ExecutorUtil; import org.apache.dubbo.common.utils.NetUtils; import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.ChannelHandler; @@ -29,6 +28,7 @@ import org.apache.dubbo.remoting.api.WireProtocol; import org.apache.dubbo.remoting.api.connection.AbstractConnectionClient; import org.apache.dubbo.remoting.transport.netty4.ssl.SslClientTlsHandler; import org.apache.dubbo.remoting.transport.netty4.ssl.SslContexts; +import org.apache.dubbo.remoting.utils.UrlUtils; import io.netty.bootstrap.Bootstrap; import io.netty.buffer.PooledByteBufAllocator; @@ -45,15 +45,12 @@ import io.netty.util.AttributeKey; import io.netty.util.concurrent.DefaultPromise; import io.netty.util.concurrent.GlobalEventExecutor; import io.netty.util.concurrent.Promise; -import org.apache.dubbo.remoting.utils.UrlUtils; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicReference; import static java.util.concurrent.TimeUnit.MILLISECONDS; -import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_CLIENT_THREADPOOL; -import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_CLIENT_CONNECT_TIMEOUT; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CONNECT_PROVIDER; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_RECONNECT; @@ -82,10 +79,7 @@ public class NettyConnectionClient extends AbstractConnectionClient { @Override protected void initConnectionClient() { - URL url = ExecutorUtil.setThreadName(getUrl(), "DubboClientHandler"); - url = url.addParameterIfAbsent(THREADPOOL_KEY, DEFAULT_CLIENT_THREADPOOL); - setUrl(url); - this.protocol = url.getOrDefaultFrameworkModel().getExtensionLoader(WireProtocol.class).getExtension(url.getProtocol()); + this.protocol = getUrl().getOrDefaultFrameworkModel().getExtensionLoader(WireProtocol.class).getExtension(getUrl().getProtocol()); this.remote = getConnectAddress(); this.connectingPromise = new AtomicReference<>(); this.connectionListener = new ConnectionListener(); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java index 4ec09e4a56..8f9925da79 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java @@ -44,6 +44,10 @@ import java.util.Objects; import java.util.Set; import java.util.concurrent.ExecutorService; +import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_CLIENT_THREADPOOL; +import static org.apache.dubbo.common.constants.CommonConstants.THREADPOOL_KEY; +import static org.apache.dubbo.common.constants.CommonConstants.THREAD_NAME_KEY; +import static org.apache.dubbo.config.Constants.CLIENT_THREAD_POOL_NAME; import static org.apache.dubbo.config.Constants.SERVER_THREAD_POOL_NAME; import static org.apache.dubbo.rpc.Constants.H2_IGNORE_1_0_0_KEY; import static org.apache.dubbo.rpc.Constants.H2_RESOLVE_FALLBACK_TO_DEFAULT_KEY; @@ -154,8 +158,7 @@ public class TripleProtocol extends AbstractProtocol { @Override public Invoker refer(Class type, URL url) throws RpcException { optimizeSerialization(url); - ExecutorService streamExecutor = getOrCreateStreamExecutor( - url.getOrDefaultApplicationModel(), url); + ExecutorService streamExecutor = getOrCreateStreamExecutor(url.getOrDefaultApplicationModel(), url); AbstractConnectionClient connectionClient = PortUnificationExchanger.connect(url, new DefaultPuHandler()); TripleInvoker invoker = new TripleInvoker<>(type, url, acceptEncodings, connectionClient, invokers, streamExecutor); @@ -164,9 +167,10 @@ public class TripleProtocol extends AbstractProtocol { } private ExecutorService getOrCreateStreamExecutor(ApplicationModel applicationModel, URL url) { - ExecutorService executor = ExecutorRepository.getInstance(applicationModel).createExecutorIfAbsent(ExecutorUtil.setThreadName(url, SERVER_THREAD_POOL_NAME)); - Objects.requireNonNull(executor, - String.format("No available executor found in %s", url)); + url = url.addParameter(THREAD_NAME_KEY, CLIENT_THREAD_POOL_NAME) + .addParameterIfAbsent(THREADPOOL_KEY, DEFAULT_CLIENT_THREADPOOL); + ExecutorService executor = ExecutorRepository.getInstance(applicationModel).createExecutorIfAbsent(url); + Objects.requireNonNull(executor, String.format("No available executor found in %s", url)); return executor; } From c10d95b56a48e88d9014238a56e7ee1ea18a33d2 Mon Sep 17 00:00:00 2001 From: TomlongTK Date: Wed, 11 Oct 2023 23:32:30 +0800 Subject: [PATCH 03/27] Fix RejectException (#12950) * fix RejectException null * fix reference * use isTerminated judge Executor * use isShutdown judge Executor --------- Co-authored-by: earthchen --- .../threadpool/serial/SerializingExecutor.java | 7 +++++-- .../apache/dubbo/common/utils/ExecutorUtil.java | 15 ++++++++++----- .../AbstractIsolationExecutorSupport.java | 1 + .../rpc/executor/DefaultExecutorSupport.java | 1 + .../java/org/apache/dubbo/rpc/AsyncRpcResult.java | 4 ++-- .../dubbo/rpc/protocol/tri/DeadlineFuture.java | 14 ++++++-------- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutor.java b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutor.java index 5769c1296a..05fd83d1e4 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutor.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/threadpool/serial/SerializingExecutor.java @@ -26,6 +26,7 @@ import org.apache.dubbo.common.logger.LoggerFactory; import org.apache.dubbo.common.threadlocal.InternalThreadLocalMap; import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_ERROR_RUN_THREAD_TASK; +import static org.apache.dubbo.common.utils.ExecutorUtil.isShutdown; /** * Executor ensuring that all {@link Runnable} tasks submitted are executed in order @@ -68,8 +69,10 @@ public final class SerializingExecutor implements Executor, Runnable { if (atomicBoolean.compareAndSet(false, true)) { boolean success = false; try { - executor.execute(this); - success = true; + if (!isShutdown(executor)) { + executor.execute(this); + success = true; + } } finally { // It is possible that at this point that there are still tasks in // the queue, it would be nice to keep trying but the error may not diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java index 6c0bc148a1..f6e1ce41ca 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/ExecutorUtil.java @@ -38,12 +38,17 @@ public class ExecutorUtil { new NamedThreadFactory("Close-ExecutorService-Timer", true)); public static boolean isTerminated(Executor executor) { - if (executor instanceof ExecutorService) { - if (((ExecutorService) executor).isTerminated()) { - return true; - } + if (!(executor instanceof ExecutorService)) { + return false; } - return false; + return ((ExecutorService) executor).isTerminated(); + } + + public static boolean isShutdown(Executor executor) { + if (!(executor instanceof ExecutorService)) { + return false; + } + return ((ExecutorService) executor).isShutdown(); } /** diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/AbstractIsolationExecutorSupport.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/AbstractIsolationExecutorSupport.java index 2a228d3cc5..1c78036a91 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/AbstractIsolationExecutorSupport.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/AbstractIsolationExecutorSupport.java @@ -36,6 +36,7 @@ public abstract class AbstractIsolationExecutorSupport implements ExecutorSuppor this.frameworkServiceRepository = url.getOrDefaultFrameworkModel().getServiceRepository(); } + @Override public Executor getExecutor(Object data) { ProviderModel providerModel = getProviderModel(data); diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/DefaultExecutorSupport.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/DefaultExecutorSupport.java index 3cd671d201..08dd4ebee7 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/DefaultExecutorSupport.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/executor/DefaultExecutorSupport.java @@ -30,6 +30,7 @@ public class DefaultExecutorSupport implements ExecutorSupport { this.executorRepository = ExecutorRepository.getInstance(url.getOrDefaultApplicationModel()); } + @Override public Executor getExecutor(Object data) { return executorRepository.getExecutor(url); } diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java index 7244fa38fb..39e5cceb74 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/AsyncRpcResult.java @@ -180,7 +180,7 @@ public class AsyncRpcResult implements Result { */ @Override public Result get() throws InterruptedException, ExecutionException { - if (executor != null && executor instanceof ThreadlessExecutor) { + if (executor instanceof ThreadlessExecutor) { ThreadlessExecutor threadlessExecutor = (ThreadlessExecutor) executor; try { while (!responseFuture.isDone() && !threadlessExecutor.isShutdown()) { @@ -196,7 +196,7 @@ public class AsyncRpcResult implements Result { @Override public Result get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException { long deadline = System.nanoTime() + unit.toNanos(timeout); - if (executor != null && executor instanceof ThreadlessExecutor) { + if (executor instanceof ThreadlessExecutor) { ThreadlessExecutor threadlessExecutor = (ThreadlessExecutor) executor; try { while (!responseFuture.isDone() && !threadlessExecutor.isShutdown()) { diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFuture.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFuture.java index 32037a59cc..08160dcd74 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFuture.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/DeadlineFuture.java @@ -47,6 +47,9 @@ public class DeadlineFuture extends CompletableFuture { private final List timeoutListeners = new ArrayList<>(); private final Timeout timeoutTask; private ExecutorService executor; + private static final GlobalResourceInitializer TIME_OUT_TIMER = new GlobalResourceInitializer<>( + () -> new HashedWheelTimer(new NamedThreadFactory("dubbo-future-timeout", true), 30, + TimeUnit.MILLISECONDS), DeadlineFuture::destroy); private DeadlineFuture(String serviceName, String methodName, String address, int timeout) { this.serviceName = serviceName; @@ -76,20 +79,15 @@ public class DeadlineFuture extends CompletableFuture { } public void received(TriRpcStatus status, AppResponse appResponse) { - if (status.code != TriRpcStatus.Code.DEADLINE_EXCEEDED) { - // decrease Time - if (!timeoutTask.isCancelled()) { - timeoutTask.cancel(); - } + if (status.code != TriRpcStatus.Code.DEADLINE_EXCEEDED && !timeoutTask.isCancelled()) { + timeoutTask.cancel(); } if (getExecutor() != null) { getExecutor().execute(() -> doReceived(status, appResponse)); } else { doReceived(status, appResponse); } - } private static final GlobalResourceInitializer TIME_OUT_TIMER = new GlobalResourceInitializer<>( - () -> new HashedWheelTimer(new NamedThreadFactory("dubbo-future-timeout", true), 30, - TimeUnit.MILLISECONDS), DeadlineFuture::destroy); + } public void addTimeoutListener(Runnable runnable) { timeoutListeners.add(runnable); From f23829af91f5f125412743f840fa19809b4733bb Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:53:12 +0800 Subject: [PATCH 04/27] Bump org.apache.zookeeper:zookeeper (#13190) Bumps org.apache.zookeeper:zookeeper from 3.8.1 to 3.8.3. --- updated-dependencies: - dependency-name: org.apache.zookeeper:zookeeper dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml index 32aa0f0f5b..443fef8c29 100644 --- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml +++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-provider/pom.xml @@ -31,7 +31,7 @@ true 5.1.0 - 3.8.1 + 3.8.3 From e6d0be3720f25a4581caafea259b1fc240ee9fe3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:53:26 +0800 Subject: [PATCH 05/27] Bump org.apache.zookeeper:zookeeper (#13191) Bumps org.apache.zookeeper:zookeeper from 3.8.1 to 3.8.3. --- updated-dependencies: - dependency-name: org.apache.zookeeper:zookeeper dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .../dubbo-zookeeper-curator5-spring-boot-starter/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-spring-boot/dubbo-spring-boot-starters/dubbo-zookeeper-curator5-spring-boot-starter/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-starters/dubbo-zookeeper-curator5-spring-boot-starter/pom.xml index 2cd0feb699..e6e6c6ab91 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-starters/dubbo-zookeeper-curator5-spring-boot-starter/pom.xml +++ b/dubbo-spring-boot/dubbo-spring-boot-starters/dubbo-zookeeper-curator5-spring-boot-starter/pom.xml @@ -33,7 +33,7 @@ 5.1.0 - 3.8.1 + 3.8.3 From ef3b7d700fd1a77d1784958c742477ce6dd2086a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:54:01 +0800 Subject: [PATCH 06/27] Bump org.apache.zookeeper:zookeeper in /dubbo-test/dubbo-test-check (#13192) Bumps org.apache.zookeeper:zookeeper from 3.4.14 to 3.7.2. --- updated-dependencies: - dependency-name: org.apache.zookeeper:zookeeper dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-test/dubbo-test-check/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-test/dubbo-test-check/pom.xml b/dubbo-test/dubbo-test-check/pom.xml index 75437710b5..23a0d19685 100644 --- a/dubbo-test/dubbo-test-check/pom.xml +++ b/dubbo-test/dubbo-test-check/pom.xml @@ -33,7 +33,7 @@ 8 true 4.2.0 - 3.4.14 + 3.7.2 4.2.0 1.24.0 1.9.3 From 14d68e51f762ddb27c10d501253798266b26f5c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:54:35 +0800 Subject: [PATCH 07/27] Bump org.apache.zookeeper:zookeeper (#13195) Bumps org.apache.zookeeper:zookeeper from 3.7.0 to 3.7.2. --- updated-dependencies: - dependency-name: org.apache.zookeeper:zookeeper dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml index 6209329bb5..c66185db78 100644 --- a/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml +++ b/dubbo-remoting/dubbo-remoting-zookeeper-curator5/pom.xml @@ -30,7 +30,7 @@ false 5.1.0 - 3.7.0 + 3.7.2 From c4120feb8fdeb7005168b01b694417027ee84584 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Oct 2023 16:54:43 +0800 Subject: [PATCH 08/27] Bump org.apache.zookeeper:zookeeper (#13194) Bumps org.apache.zookeeper:zookeeper from 3.8.1 to 3.8.3. --- updated-dependencies: - dependency-name: org.apache.zookeeper:zookeeper dependency-type: direct:production ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml index 1eabccca2a..62c4196be0 100644 --- a/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml +++ b/dubbo-demo/dubbo-demo-native/dubbo-demo-native-consumer/pom.xml @@ -31,7 +31,7 @@ true 5.1.0 - 3.8.1 + 3.8.3 From 47821429807654b14010a672d20eca3d00243ffe Mon Sep 17 00:00:00 2001 From: andotorg Date: Fri, 13 Oct 2023 17:43:30 +0800 Subject: [PATCH 09/27] Fix #13135 for testing (#13139) * fix https://github.com/apache/dubbo/issues/13135 * fix Using the '.*' form of import should be avoided build error * nashorn-core jar scope is test --- dubbo-cluster/pom.xml | 7 +++++++ .../org/apache/dubbo/metrics/model/MetricsSupport.java | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/dubbo-cluster/pom.xml b/dubbo-cluster/pom.xml index 130b7e3f7e..2013b81c99 100644 --- a/dubbo-cluster/pom.xml +++ b/dubbo-cluster/pom.xml @@ -29,6 +29,7 @@ The cluster module of dubbo project false + 15.4 @@ -91,5 +92,11 @@ micrometer-tracing-integration-test test + + org.openjdk.nashorn + nashorn-core + ${nashorn-core.version} + test + diff --git a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java index d6510a503f..ed723192e5 100644 --- a/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java +++ b/dubbo-metrics/dubbo-metrics-api/src/main/java/org/apache/dubbo/metrics/model/MetricsSupport.java @@ -20,6 +20,7 @@ package org.apache.dubbo.metrics.model; import org.apache.dubbo.common.Version; import org.apache.dubbo.common.lang.Nullable; import org.apache.dubbo.common.utils.CollectionUtils; +import org.apache.dubbo.common.utils.StringUtils; import org.apache.dubbo.metrics.collector.MethodMetricsCollector; import org.apache.dubbo.metrics.collector.ServiceMetricsCollector; import org.apache.dubbo.metrics.event.MetricsEvent; @@ -32,10 +33,10 @@ import org.apache.dubbo.rpc.Invoker; import org.apache.dubbo.rpc.RpcException; import org.apache.dubbo.rpc.model.ApplicationModel; -import java.util.HashMap; import java.util.Map; -import java.util.Optional; +import java.util.HashMap; import java.util.Set; +import java.util.Optional; import java.util.concurrent.atomic.AtomicLong; import java.util.stream.Collectors; @@ -162,6 +163,9 @@ public class MetricsSupport { } else { String serviceUniqueName = invocation.getTargetServiceUniqueName(); String interfaceAndVersion; + if (StringUtils.isBlank(serviceUniqueName)) { + return ""; + } String[] arr = serviceUniqueName.split(PATH_SEPARATOR); if (arr.length == 2) { interfaceAndVersion = arr[1]; From a4a3fd769f3cd19cbb0b43e8fdb8f387fea80c63 Mon Sep 17 00:00:00 2001 From: JYZ <31824316+sick-cat@users.noreply.github.com> Date: Fri, 13 Oct 2023 22:14:34 -0500 Subject: [PATCH 10/27] fix: set default value for accept (#13199) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 贾彦昭 --- .../dubbo/rpc/protocol/rest/filter/ServiceInvokeRestFilter.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/filter/ServiceInvokeRestFilter.java b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/filter/ServiceInvokeRestFilter.java index 2e97493c0e..72508ce868 100644 --- a/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/filter/ServiceInvokeRestFilter.java +++ b/dubbo-rpc/dubbo-rpc-rest/src/main/java/org/apache/dubbo/rpc/protocol/rest/filter/ServiceInvokeRestFilter.java @@ -46,6 +46,7 @@ import org.apache.dubbo.rpc.protocol.rest.request.RequestFacade; import org.apache.dubbo.rpc.protocol.rest.util.MediaTypeUtil; import java.util.List; +import java.util.Objects; @Activate(value = "invoke", order = Integer.MAX_VALUE) public class ServiceInvokeRestFilter implements RestRequestFilter { @@ -179,6 +180,7 @@ public class ServiceInvokeRestFilter implements RestRequestFilter { */ public static MediaType getAcceptMediaType(RequestFacade request, Class returnType) { String accept = request.getHeader(RestHeaderEnum.ACCEPT.getHeader()); + accept = Objects.isNull(accept) ? MediaType.ALL_VALUE.value : accept; MediaType mediaType = MediaTypeUtil.convertMediaType(returnType, accept); return mediaType; } From 2bed4234281615958d7fb2fa17b6a261ded343bd Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:07:26 +0800 Subject: [PATCH 11/27] Bump io.micrometer:micrometer-core from 1.11.4 to 1.11.5 (#13204) Bumps [io.micrometer:micrometer-core](https://github.com/micrometer-metrics/micrometer) from 1.11.4 to 1.11.5. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.11.4...v1.11.5) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-core dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-demo/dubbo-demo-spring-boot/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-demo/dubbo-demo-spring-boot/pom.xml b/dubbo-demo/dubbo-demo-spring-boot/pom.xml index c122454341..d8f6c1a7a0 100644 --- a/dubbo-demo/dubbo-demo-spring-boot/pom.xml +++ b/dubbo-demo/dubbo-demo-spring-boot/pom.xml @@ -38,7 +38,7 @@ true 2.7.16 2.7.16 - 1.11.4 + 1.11.5 From 310751159d9358e83ecc40953ac05e1c0ea3587d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:07:41 +0800 Subject: [PATCH 12/27] Bump io.micrometer:micrometer-tracing-bom from 1.1.5 to 1.1.6 (#13207) Bumps [io.micrometer:micrometer-tracing-bom](https://github.com/micrometer-metrics/tracing) from 1.1.5 to 1.1.6. - [Release notes](https://github.com/micrometer-metrics/tracing/releases) - [Commits](https://github.com/micrometer-metrics/tracing/compare/v1.1.5...v1.1.6) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-tracing-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-dependencies-bom/pom.xml | 2 +- .../dubbo-spring-boot-starters/observability/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index b9ca4fd3ae..34877759fc 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -135,7 +135,7 @@ 0.1.35 1.11.4 - 1.1.5 + 1.1.6 3.3 0.16.0 1.0.4 diff --git a/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml index 625694a44f..2cf386a00c 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml +++ b/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml @@ -39,7 +39,7 @@ 1.11.4 - 1.1.5 + 1.1.6 1.31.0 2.16.4 0.16.0 From 8f6094b3521042e8a734c57e3b5fc0c8fcfd231d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:07:54 +0800 Subject: [PATCH 13/27] Bump jetty_version from 9.4.52.v20230823 to 9.4.53.v20231009 (#13206) Bumps `jetty_version` from 9.4.52.v20230823 to 9.4.53.v20231009. Updates `org.eclipse.jetty:jetty-server` from 9.4.52.v20230823 to 9.4.53.v20231009 - [Release notes](https://github.com/eclipse/jetty.project/releases) - [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.52.v20230823...jetty-9.4.53.v20231009) Updates `org.eclipse.jetty:jetty-servlet` from 9.4.52.v20230823 to 9.4.53.v20231009 - [Release notes](https://github.com/eclipse/jetty.project/releases) - [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.52.v20230823...jetty-9.4.53.v20231009) --- updated-dependencies: - dependency-name: org.eclipse.jetty:jetty-server dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: org.eclipse.jetty:jetty-servlet dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-dependencies-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 34877759fc..9d5950647a 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -117,7 +117,7 @@ 3.24.4 1.3.2 3.1.0 - 9.4.52.v20230823 + 9.4.53.v20231009 3.0.2 1.1.0.Final 5.4.3.Final From 9cbd55766ab7f5efd4062d93aabfbfdfe25dac90 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:08:04 +0800 Subject: [PATCH 14/27] Bump jackson_version from 2.15.2 to 2.15.3 (#13203) Bumps `jackson_version` from 2.15.2 to 2.15.3. Updates `com.fasterxml.jackson.core:jackson-core` from 2.15.2 to 2.15.3 - [Release notes](https://github.com/FasterXML/jackson-core/releases) - [Commits](https://github.com/FasterXML/jackson-core/compare/jackson-core-2.15.2...jackson-core-2.15.3) Updates `com.fasterxml.jackson.core:jackson-databind` from 2.15.2 to 2.15.3 - [Commits](https://github.com/FasterXML/jackson/commits) Updates `com.fasterxml.jackson.datatype:jackson-datatype-jsr310` from 2.15.2 to 2.15.3 Updates `com.fasterxml.jackson.core:jackson-annotations` from 2.15.2 to 2.15.3 - [Commits](https://github.com/FasterXML/jackson/commits) --- updated-dependencies: - dependency-name: com.fasterxml.jackson.core:jackson-core dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.fasterxml.jackson.core:jackson-databind dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.fasterxml.jackson.datatype:jackson-datatype-jsr310 dependency-type: direct:production update-type: version-update:semver-patch - dependency-name: com.fasterxml.jackson.core:jackson-annotations dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-dependencies-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 9d5950647a..941a14064f 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -184,7 +184,7 @@ 2.0.6 5.4.3 2.10.1 - 2.15.2 + 2.15.3 6.1.26 2.0 1.5.0 From 14834eded4041a99ebd1ebf7d0f1d53942f202a1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:08:28 +0800 Subject: [PATCH 15/27] Bump org.eclipse.jetty:jetty-maven-plugin (#13212) Bumps [org.eclipse.jetty:jetty-maven-plugin](https://github.com/eclipse/jetty.project) from 9.4.52.v20230823 to 9.4.53.v20231009. - [Release notes](https://github.com/eclipse/jetty.project/releases) - [Commits](https://github.com/eclipse/jetty.project/compare/jetty-9.4.52.v20230823...jetty-9.4.53.v20231009) --- updated-dependencies: - dependency-name: org.eclipse.jetty:jetty-maven-plugin dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 93f7d497b1..dd3d4ffe33 100644 --- a/pom.xml +++ b/pom.xml @@ -119,7 +119,7 @@ 3.11.0 3.2.1 3.5.0 - 9.4.52.v20230823 + 9.4.53.v20231009 3.2.1 0.8.10 1.5.0 From 2f2c9977232fc6f25782ceb8c08a479441ceedac Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:08:40 +0800 Subject: [PATCH 16/27] Bump bytebuddy.version from 1.14.8 to 1.14.9 (#13205) Bumps `bytebuddy.version` from 1.14.8 to 1.14.9. Updates `net.bytebuddy:byte-buddy` from 1.14.8 to 1.14.9 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.8...byte-buddy-1.14.9) Updates `net.bytebuddy:byte-buddy-agent` from 1.14.8 to 1.14.9 - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.8...byte-buddy-1.14.9) --- updated-dependencies: - dependency-name: net.bytebuddy:byte-buddy dependency-type: direct:development update-type: version-update:semver-patch - dependency-name: net.bytebuddy:byte-buddy-agent dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-spring-boot/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-spring-boot/pom.xml b/dubbo-spring-boot/pom.xml index ac90ec6167..548353ad89 100644 --- a/dubbo-spring-boot/pom.xml +++ b/dubbo-spring-boot/pom.xml @@ -45,7 +45,7 @@ 2.20.0 - 1.14.8 + 1.14.9 From e7a8fe007ef4dfa743073a318b2d9c3d2b7bda02 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:20:40 +0800 Subject: [PATCH 17/27] Bump net.bytebuddy:byte-buddy from 1.14.8 to 1.14.9 (#13211) Bumps [net.bytebuddy:byte-buddy](https://github.com/raphw/byte-buddy) from 1.14.8 to 1.14.9. - [Release notes](https://github.com/raphw/byte-buddy/releases) - [Changelog](https://github.com/raphw/byte-buddy/blob/master/release-notes.md) - [Commits](https://github.com/raphw/byte-buddy/compare/byte-buddy-1.14.8...byte-buddy-1.14.9) --- updated-dependencies: - dependency-name: net.bytebuddy:byte-buddy dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-dependencies-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 941a14064f..c19ca9e070 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -94,7 +94,7 @@ 5.3.25 5.8.7 3.29.2-GA - 1.14.8 + 1.14.9 3.2.10.Final 4.1.99.Final 2.2.1 From bf0522d7e017a5b6d1acc3c1cf1ec6351e3fd86f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 16:50:33 +0800 Subject: [PATCH 18/27] Bump io.projectreactor:reactor-core from 3.5.10 to 3.5.11 (#13208) Bumps [io.projectreactor:reactor-core](https://github.com/reactor/reactor-core) from 3.5.10 to 3.5.11. - [Release notes](https://github.com/reactor/reactor-core/releases) - [Commits](https://github.com/reactor/reactor-core/compare/v3.5.10...v3.5.11) --- updated-dependencies: - dependency-name: io.projectreactor:reactor-core dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-dependencies-bom/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index c19ca9e070..2dc1750b80 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -139,7 +139,7 @@ 3.3 0.16.0 1.0.4 - 3.5.10 + 3.5.11 2.2.21 3.14.9 From 78bb3dc0496fa149d0317f667c859a6f7e1448fd Mon Sep 17 00:00:00 2001 From: gzhao9 <74684732+gzhao9@users.noreply.github.com> Date: Tue, 17 Oct 2023 04:55:42 -0400 Subject: [PATCH 19/27] Update EchoFilterTest.java (#13215) --- .../dubbo/rpc/filter/EchoFilterTest.java | 34 +++++++++---------- 1 file changed, 16 insertions(+), 18 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java index 2c67db6ffc..3408b2ebc5 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/filter/EchoFilterTest.java @@ -38,20 +38,9 @@ class EchoFilterTest { @SuppressWarnings("unchecked") @Test void testEcho() { - Invocation invocation = mock(RpcInvocation.class); + Invocation invocation = createMockRpcInvocation(); + Invoker invoker = createMockInvoker(invocation); given(invocation.getMethodName()).willReturn("$echo"); - given(invocation.getParameterTypes()).willReturn(new Class[]{Enum.class}); - given(invocation.getArguments()).willReturn(new Object[]{"hello"}); - given(invocation.getObjectAttachments()).willReturn(null); - - Invoker invoker = mock(Invoker.class); - given(invoker.isAvailable()).willReturn(true); - given(invoker.getInterface()).willReturn(DemoService.class); - AppResponse result = new AppResponse(); - result.setValue("High"); - given(invoker.invoke(invocation)).willReturn(result); - URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1"); - given(invoker.getUrl()).willReturn(url); Result filterResult = echoFilter.invoke(invoker, invocation); assertEquals("hello", filterResult.getValue()); @@ -60,22 +49,31 @@ class EchoFilterTest { @SuppressWarnings("unchecked") @Test void testNonEcho() { - Invocation invocation = mock(Invocation.class); + Invocation invocation = createMockRpcInvocation(); + Invoker invoker = createMockInvoker(invocation); given(invocation.getMethodName()).willReturn("echo"); + + Result filterResult = echoFilter.invoke(invoker, invocation); + assertEquals("High", filterResult.getValue()); + } + + Invocation createMockRpcInvocation() { + Invocation invocation = mock(RpcInvocation.class); given(invocation.getParameterTypes()).willReturn(new Class[]{Enum.class}); given(invocation.getArguments()).willReturn(new Object[]{"hello"}); given(invocation.getObjectAttachments()).willReturn(null); - + return invocation; + } + Invoker createMockInvoker(Invocation invocation){ Invoker invoker = mock(Invoker.class); given(invoker.isAvailable()).willReturn(true); given(invoker.getInterface()).willReturn(DemoService.class); + AppResponse result = new AppResponse(); result.setValue("High"); given(invoker.invoke(invocation)).willReturn(result); URL url = URL.valueOf("test://test:11/test?group=dubbo&version=1.1"); given(invoker.getUrl()).willReturn(url); - - Result filterResult = echoFilter.invoke(invoker, invocation); - assertEquals("High", filterResult.getValue()); + return invoker; } } From 7548a03fdc925c503e6344fca8a93cdc69ff3449 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 17 Oct 2023 17:30:30 +0800 Subject: [PATCH 20/27] Bump io.micrometer:micrometer-bom from 1.11.4 to 1.11.5 (#13210) Bumps [io.micrometer:micrometer-bom](https://github.com/micrometer-metrics/micrometer) from 1.11.4 to 1.11.5. - [Release notes](https://github.com/micrometer-metrics/micrometer/releases) - [Commits](https://github.com/micrometer-metrics/micrometer/compare/v1.11.4...v1.11.5) --- updated-dependencies: - dependency-name: io.micrometer:micrometer-bom dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- dubbo-dependencies-bom/pom.xml | 2 +- .../dubbo-spring-boot-starters/observability/pom.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dubbo-dependencies-bom/pom.xml b/dubbo-dependencies-bom/pom.xml index 2dc1750b80..50f6cccd14 100644 --- a/dubbo-dependencies-bom/pom.xml +++ b/dubbo-dependencies-bom/pom.xml @@ -133,7 +133,7 @@ 3.12.0 1.8.0 0.1.35 - 1.11.4 + 1.11.5 1.1.6 3.3 diff --git a/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml b/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml index 2cf386a00c..37cf3da9b6 100644 --- a/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml +++ b/dubbo-spring-boot/dubbo-spring-boot-starters/observability/pom.xml @@ -38,7 +38,7 @@ - 1.11.4 + 1.11.5 1.1.6 1.31.0 2.16.4 From f82629f7f979d34b33d6a4e1cf0d4a673d577122 Mon Sep 17 00:00:00 2001 From: namelessssssssssss <100946116+namelessssssssssss@users.noreply.github.com> Date: Wed, 18 Oct 2023 09:44:56 +0800 Subject: [PATCH 21/27] Fix wrong returnTypes for StubMethodDescriptor (#13223) --- .../java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java index af294d35e4..a98ef742f2 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/rpc/model/StubMethodDescriptor.java @@ -63,7 +63,7 @@ public class StubMethodDescriptor implements MethodDescriptor, PackableMethod { this.returnClass = responseClass; this.paramDesc = ReflectUtils.getDesc(parameterClasses); this.compatibleParamSignatures = Stream.of(parameterClasses).map(Class::getName).toArray(String[]::new); - this.returnTypes = new Type[]{requestClass, requestClass}; + this.returnTypes = new Type[]{responseClass, responseClass}; serviceDescriptor.addMethod(this); } From 3f07e683a184670ebfc0ef48c268836931b39a75 Mon Sep 17 00:00:00 2001 From: gzhao9 <74684732+gzhao9@users.noreply.github.com> Date: Tue, 17 Oct 2023 22:06:35 -0400 Subject: [PATCH 22/27] Refactor rpc utils test (#13214) --- .../dubbo/rpc/support/RpcUtilsTest.java | 33 ++++++++++--------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java index b64a008d1e..1c2f5df7be 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java +++ b/dubbo-rpc/dubbo-rpc-api/src/test/java/org/apache/dubbo/rpc/support/RpcUtilsTest.java @@ -50,6 +50,14 @@ class RpcUtilsTest { * regular scenario: async invocation in URL * verify: 1. whether invocationId is set correctly, 2. idempotent or not */ + Invoker createMockInvoker(URL url){ + Invoker invoker = createMockInvoker(); + given(invoker.getUrl()).willReturn(url); + return invoker; + } + Invoker createMockInvoker(){ + return mock(Invoker.class); + } @Test void testAttachInvocationIdIfAsync_normal() { URL url = URL.valueOf("dubbo://localhost/?test.async=true"); @@ -117,8 +125,7 @@ class RpcUtilsTest { void testGetReturnType() { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); - given(invoker.getUrl()).willReturn(URL.valueOf( + Invoker invoker = createMockInvoker(URL.valueOf( "test://127.0.0.1:1/org.apache.dubbo.rpc.support.DemoService?interface=org.apache.dubbo.rpc.support.DemoService")); // void sayHello(String name); @@ -157,8 +164,7 @@ class RpcUtilsTest { void testGetReturnTypesUseCache() throws Exception { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); - given(invoker.getUrl()).willReturn(URL.valueOf( + Invoker invoker = createMockInvoker(URL.valueOf( "test://127.0.0.1:1/org.apache.dubbo.rpc.support.DemoService?interface=org.apache.dubbo.rpc.support.DemoService")); RpcInvocation inv = new RpcInvocation("testReturnType", serviceName, "", new Class[] {String.class}, null, null, invoker, null); @@ -221,8 +227,7 @@ class RpcUtilsTest { void testGetReturnTypesWithoutCache() throws Exception { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); - given(invoker.getUrl()).willReturn(URL.valueOf( + Invoker invoker = createMockInvoker(URL.valueOf( "test://127.0.0.1:1/org.apache.dubbo.rpc.support.DemoService?interface=org.apache.dubbo.rpc.support.DemoService")); RpcInvocation inv = new RpcInvocation("testReturnType", serviceName, "", new Class[] {String.class}, null, null, invoker, null); @@ -286,8 +291,7 @@ class RpcUtilsTest { void testGetReturnTypesWhenGeneric() throws Exception { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); - given(invoker.getUrl()).willReturn(URL.valueOf( + Invoker invoker = createMockInvoker(URL.valueOf( "test://127.0.0.1:1/org.apache.dubbo.rpc.support.DemoService?interface=org.apache.dubbo.rpc.support.DemoService")); RpcInvocation inv = new RpcInvocation("testReturnType", serviceName, "", new Class[] {String.class}, null, null, invoker, null); @@ -329,7 +333,7 @@ class RpcUtilsTest { void testGetParameterTypes() { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); + Invoker invoker =createMockInvoker(); // void sayHello(String name); RpcInvocation inv1 = new RpcInvocation("sayHello", serviceName, "", @@ -383,7 +387,7 @@ class RpcUtilsTest { public void testGetMethodName(String methodName) { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); + Invoker invoker =createMockInvoker(); RpcInvocation inv1 = new RpcInvocation(methodName, serviceName, "", new Class[] {String.class}, null, null, invoker, null); @@ -401,7 +405,7 @@ class RpcUtilsTest { public void testGet_$invoke_MethodName(String method) { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); + Invoker invoker =createMockInvoker(); RpcInvocation inv = new RpcInvocation("$invoke", serviceName, "", new Class[] {String.class, String[].class}, @@ -418,7 +422,7 @@ class RpcUtilsTest { Object[] args = new Object[] {"hello", "dubbo", 520}; Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); + Invoker invoker =createMockInvoker(); RpcInvocation inv = new RpcInvocation("$invoke", serviceName, "", new Class[] {String.class, String[].class, Object[].class}, @@ -438,7 +442,7 @@ class RpcUtilsTest { Object[] args = new Object[] {"hello", "dubbo", 520}; Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); + Invoker invoker =createMockInvoker(); URL url = URL.valueOf( "test://127.0.0.1:1/org.apache.dubbo.rpc.support.DemoService?interface=org.apache.dubbo.rpc.support.DemoService"); @@ -470,8 +474,7 @@ class RpcUtilsTest { void testIsReturnTypeFuture() { Class demoServiceClass = DemoService.class; String serviceName = demoServiceClass.getName(); - Invoker invoker = mock(Invoker.class); - given(invoker.getUrl()).willReturn(URL.valueOf( + Invoker invoker = createMockInvoker(URL.valueOf( "test://127.0.0.1:1/org.apache.dubbo.rpc.support.DemoService?interface=org.apache.dubbo.rpc.support.DemoService")); RpcInvocation inv = new RpcInvocation("testReturnType", serviceName, "", new Class[] {String.class}, null, null, invoker, null); From 02e486a1dccef10a03b81575fb3b7158d3cd9299 Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Wed, 18 Oct 2023 11:38:57 +0800 Subject: [PATCH 23/27] Fix unable to receive go away frame (#13228) * Fix unable to receive go away frame * Rename * rename --- .../org/apache/dubbo/remoting/Constants.java | 3 +++ .../netty4/NettyConnectionClient.java | 3 ++- .../rpc/protocol/tri/TripleHttp2Protocol.java | 27 ++++++++++--------- ...tHandler.java => TripleGoAwayHandler.java} | 12 +++------ 4 files changed, 23 insertions(+), 22 deletions(-) rename dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/{TripleClientHandler.java => TripleGoAwayHandler.java} (77%) diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java index ae7ab3f682..4ffe4b0b17 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/Constants.java @@ -178,4 +178,7 @@ public interface Constants { String CONTENT_LENGTH_KEY = "content-length"; String USE_SECURE_RANDOM_ID = "dubbo.application.use-secure-random-request-id"; + + String CONNECTION_HANDLER_NAME = "connectionHandler"; + } diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java index d60807f836..a86e9634c5 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionClient.java @@ -23,6 +23,7 @@ import org.apache.dubbo.common.logger.LoggerFactory; import org.apache.dubbo.common.utils.NetUtils; import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.ChannelHandler; +import org.apache.dubbo.remoting.Constants; import org.apache.dubbo.remoting.RemotingException; import org.apache.dubbo.remoting.api.WireProtocol; import org.apache.dubbo.remoting.api.connection.AbstractConnectionClient; @@ -123,7 +124,7 @@ public class NettyConnectionClient extends AbstractConnectionClient { int heartbeat = UrlUtils.getHeartbeat(getUrl()); pipeline.addLast("client-idle-handler", new IdleStateHandler(heartbeat, 0, 0, MILLISECONDS)); - pipeline.addLast("connectionHandler", connectionHandler); + pipeline.addLast(Constants.CONNECTION_HANDLER_NAME, connectionHandler); NettyConfigOperator operator = new NettyConfigOperator(nettyChannel, getChannelHandler()); protocol.configClientPipeline(getUrl(), operator, nettySslContextOperator); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java index 4a07c30706..70d018d78a 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleHttp2Protocol.java @@ -17,15 +17,6 @@ package org.apache.dubbo.rpc.protocol.tri; -import io.netty.channel.ChannelInitializer; -import io.netty.channel.ChannelPipeline; -import io.netty.handler.codec.http2.Http2FrameCodec; -import io.netty.handler.codec.http2.Http2FrameLogger; -import io.netty.handler.codec.http2.Http2MultiplexHandler; -import io.netty.handler.codec.http2.Http2Settings; -import io.netty.handler.codec.http2.Http2StreamChannel; -import io.netty.handler.flush.FlushConsolidationHandler; -import io.netty.handler.logging.LogLevel; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.config.Configuration; import org.apache.dubbo.common.config.ConfigurationUtils; @@ -42,13 +33,24 @@ import org.apache.dubbo.rpc.HeaderFilter; import org.apache.dubbo.rpc.executor.ExecutorSupport; import org.apache.dubbo.rpc.model.FrameworkModel; import org.apache.dubbo.rpc.model.ScopeModelAware; -import org.apache.dubbo.rpc.protocol.tri.transport.TripleClientHandler; import org.apache.dubbo.rpc.protocol.tri.transport.TripleCommandOutBoundHandler; +import org.apache.dubbo.rpc.protocol.tri.transport.TripleGoAwayHandler; import org.apache.dubbo.rpc.protocol.tri.transport.TripleHttp2FrameServerHandler; import org.apache.dubbo.rpc.protocol.tri.transport.TripleServerConnectionHandler; import org.apache.dubbo.rpc.protocol.tri.transport.TripleTailHandler; import org.apache.dubbo.rpc.protocol.tri.transport.TripleWriteQueue; +import io.netty.channel.ChannelDuplexHandler; +import io.netty.channel.ChannelInitializer; +import io.netty.channel.ChannelPipeline; +import io.netty.handler.codec.http2.Http2FrameCodec; +import io.netty.handler.codec.http2.Http2FrameLogger; +import io.netty.handler.codec.http2.Http2MultiplexHandler; +import io.netty.handler.codec.http2.Http2Settings; +import io.netty.handler.codec.http2.Http2StreamChannel; +import io.netty.handler.flush.FlushConsolidationHandler; +import io.netty.handler.logging.LogLevel; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -161,11 +163,10 @@ public class TripleHttp2Protocol extends AbstractWireProtocol implements ScopeMo .frameLogger(CLIENT_LOGGER) .build(); codec.connection().local().flowController().frameWriter(codec.encoder().frameWriter()); - final Http2MultiplexHandler handler = new Http2MultiplexHandler( - new TripleClientHandler(frameworkModel)); List handlers = new ArrayList<>(); handlers.add(new ChannelHandlerPretender(codec)); - handlers.add(new ChannelHandlerPretender(handler)); + handlers.add(new ChannelHandlerPretender(new Http2MultiplexHandler(new ChannelDuplexHandler()))); + handlers.add(new ChannelHandlerPretender(new TripleGoAwayHandler())); handlers.add(new ChannelHandlerPretender(new TriplePingPongHandler(UrlUtils.getCloseTimeout(url)))); handlers.add(new ChannelHandlerPretender(new TripleTailHandler())); operator.configChannelHandler(handlers); diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleClientHandler.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java similarity index 77% rename from dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleClientHandler.java rename to dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java index daa7e1921c..234d9b341b 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleClientHandler.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java @@ -17,28 +17,24 @@ package org.apache.dubbo.rpc.protocol.tri.transport; +import org.apache.dubbo.remoting.Constants; import org.apache.dubbo.remoting.api.connection.ConnectionHandler; -import org.apache.dubbo.rpc.model.FrameworkModel; import io.netty.channel.ChannelDuplexHandler; import io.netty.channel.ChannelHandlerContext; import io.netty.handler.codec.http2.Http2GoAwayFrame; import io.netty.util.ReferenceCountUtil; -public class TripleClientHandler extends ChannelDuplexHandler { +public class TripleGoAwayHandler extends ChannelDuplexHandler { - private final FrameworkModel frameworkModel; - private static final String CONNECTION_HANDLER_NAME = "connectionHandler"; - - public TripleClientHandler(FrameworkModel frameworkModel) { - this.frameworkModel = frameworkModel; + public TripleGoAwayHandler() { } @Override public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof Http2GoAwayFrame) { - final ConnectionHandler connectionHandler = (ConnectionHandler) ctx.pipeline().get(CONNECTION_HANDLER_NAME); + final ConnectionHandler connectionHandler = (ConnectionHandler) ctx.pipeline().get(Constants.CONNECTION_HANDLER_NAME); connectionHandler.onGoAway(ctx.channel()); } ReferenceCountUtil.release(msg); From f995ef506c2e3306f9cbcd4bc33ad169a3da0b7e Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Wed, 18 Oct 2023 11:39:33 +0800 Subject: [PATCH 24/27] Fix triple method override (#13224) * Fix triple method override * Fix server * Fix test --- .../tri/ReflectionPackableMethod.java | 19 ++++-------- .../dubbo/rpc/protocol/tri/TripleInvoker.java | 25 +++++++++------- .../rpc/protocol/tri/TripleProtocol.java | 2 -- .../call/ReflectionAbstractServerCall.java | 29 +++++++++++++------ .../tri/call/ReflectionServerCallTest.java | 4 +++ 5 files changed, 45 insertions(+), 34 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java index da3e67dfa4..66f34d48c3 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/ReflectionPackableMethod.java @@ -22,16 +22,16 @@ import org.apache.dubbo.common.constants.CommonConstants; import org.apache.dubbo.common.serialize.MultipleSerialization; import org.apache.dubbo.common.stream.StreamObserver; import org.apache.dubbo.config.Constants; -import org.apache.dubbo.remoting.utils.UrlUtils; import org.apache.dubbo.remoting.transport.CodecSupport; +import org.apache.dubbo.remoting.utils.UrlUtils; import org.apache.dubbo.rpc.model.MethodDescriptor; import org.apache.dubbo.rpc.model.Pack; import org.apache.dubbo.rpc.model.PackableMethod; - -import com.google.protobuf.Message; import org.apache.dubbo.rpc.model.UnPack; import org.apache.dubbo.rpc.model.WrapperUnPack; +import com.google.protobuf.Message; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; @@ -42,7 +42,6 @@ import java.util.stream.Stream; import static org.apache.dubbo.common.constants.CommonConstants.$ECHO; import static org.apache.dubbo.common.constants.CommonConstants.PROTOBUF_MESSAGE_CLASS_NAME; -import static org.apache.dubbo.rpc.protocol.tri.TripleProtocol.METHOD_ATTR_PACK; public class ReflectionPackableMethod implements PackableMethod { @@ -118,16 +117,10 @@ public class ReflectionPackableMethod implements PackableMethod { } public static ReflectionPackableMethod init(MethodDescriptor methodDescriptor, URL url) { - Object stored = methodDescriptor.getAttribute(METHOD_ATTR_PACK); - if (stored != null) { - return (ReflectionPackableMethod) stored; - } - final String serializeName = UrlUtils.serializationOrDefault(url); - final Collection allSerialize = UrlUtils.allSerializations(url); - ReflectionPackableMethod reflectionPackableMethod = new ReflectionPackableMethod( + String serializeName = UrlUtils.serializationOrDefault(url); + Collection allSerialize = UrlUtils.allSerializations(url); + return new ReflectionPackableMethod( methodDescriptor, url, serializeName, allSerialize); - methodDescriptor.addAttribute(METHOD_ATTR_PACK, reflectionPackableMethod); - return reflectionPackableMethod; } static boolean isStreamType(Class type) { diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java index b666c8c5e3..7903cf00db 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleInvoker.java @@ -62,9 +62,11 @@ import org.apache.dubbo.rpc.support.RpcUtils; import io.netty.util.AsciiString; import java.util.Arrays; +import java.util.Map; import java.util.Objects; import java.util.Set; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutorService; import java.util.concurrent.locks.ReentrantLock; @@ -94,18 +96,22 @@ public class TripleInvoker extends AbstractInvoker { private final TripleWriteQueue writeQueue = new TripleWriteQueue(256); private static final boolean setFutureWhenSync = Boolean.parseBoolean(System.getProperty(CommonConstants.SET_FUTURE_IN_SYNC_MODE, "true")); + private final PackableMethodFactory packableMethodFactory; + private final Map packableMethodCache = new ConcurrentHashMap<>(); public TripleInvoker(Class serviceType, - URL url, - String acceptEncodings, - AbstractConnectionClient connectionClient, - Set> invokers, - ExecutorService streamExecutor) { + URL url, + String acceptEncodings, + AbstractConnectionClient connectionClient, + Set> invokers, + ExecutorService streamExecutor) { super(serviceType, url, new String[]{INTERFACE_KEY, GROUP_KEY, TOKEN_KEY}); this.invokers = invokers; this.connectionClient = connectionClient; this.acceptEncodings = acceptEncodings; this.streamExecutor = streamExecutor; + this.packableMethodFactory = url.getOrDefaultFrameworkModel().getExtensionLoader(PackableMethodFactory.class) + .getExtension(ConfigurationUtils.getGlobalConfiguration(url.getApplicationModel()).getString(DUBBO_PACKABLE_METHOD_FACTORY, DEFAULT_KEY)); } private static AsciiString getSchemeFromUrl(URL url) { @@ -175,7 +181,7 @@ public class TripleInvoker extends AbstractInvoker { } } - private static boolean isSync(MethodDescriptor methodDescriptor, Invocation invocation){ + private static boolean isSync(MethodDescriptor methodDescriptor, Invocation invocation) { if (!(invocation instanceof RpcInvocation)) { return false; } @@ -230,7 +236,7 @@ public class TripleInvoker extends AbstractInvoker { if (timeout <= 0) { return AsyncRpcResult.newDefaultAsyncResult(new RpcException(RpcException.TIMEOUT_TERMINATE, "No time left for making the following call: " + invocation.getServiceName() + "." - + RpcUtils.getMethodName(invocation)+ ", terminate directly."), invocation); + + RpcUtils.getMethodName(invocation) + ", terminate directly."), invocation); } invocation.setAttachment(TIMEOUT_KEY, String.valueOf(timeout)); @@ -280,9 +286,8 @@ public class TripleInvoker extends AbstractInvoker { if (methodDescriptor instanceof PackableMethod) { meta.packableMethod = (PackableMethod) methodDescriptor; } else { - meta.packableMethod = url.getOrDefaultFrameworkModel().getExtensionLoader(PackableMethodFactory.class) - .getExtension(ConfigurationUtils.getGlobalConfiguration(url.getApplicationModel()).getString(DUBBO_PACKABLE_METHOD_FACTORY, DEFAULT_KEY)) - .create(methodDescriptor, url, TripleConstant.CONTENT_PROTO); + meta.packableMethod = packableMethodCache.computeIfAbsent(methodDescriptor, + (md) -> packableMethodFactory.create(md, url, TripleConstant.CONTENT_PROTO)); } meta.convertNoLowerHeader = TripleProtocol.CONVERT_NO_LOWER_HEADER; meta.ignoreDefaultVersion = TripleProtocol.IGNORE_1_0_0_VERSION; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java index 8f9925da79..f28d16287b 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/TripleProtocol.java @@ -55,8 +55,6 @@ import static org.apache.dubbo.rpc.Constants.H2_SUPPORT_NO_LOWER_HEADER_KEY; public class TripleProtocol extends AbstractProtocol { - - public static final String METHOD_ATTR_PACK = "pack"; private static final Logger logger = LoggerFactory.getLogger(TripleProtocol.class); private final PathResolver pathResolver; private final TriBuiltinService triBuiltinService; diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionAbstractServerCall.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionAbstractServerCall.java index 7789474a70..80e7c3cbc9 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionAbstractServerCall.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionAbstractServerCall.java @@ -17,7 +17,6 @@ package org.apache.dubbo.rpc.protocol.tri.call; -import io.netty.handler.codec.http.HttpHeaderNames; import org.apache.dubbo.common.URL; import org.apache.dubbo.common.config.ConfigurationUtils; import org.apache.dubbo.common.constants.CommonConstants; @@ -29,6 +28,7 @@ import org.apache.dubbo.rpc.TriRpcStatus; import org.apache.dubbo.rpc.model.FrameworkModel; import org.apache.dubbo.rpc.model.MethodDescriptor; import org.apache.dubbo.rpc.model.MethodDescriptor.RpcType; +import org.apache.dubbo.rpc.model.PackableMethod; import org.apache.dubbo.rpc.model.PackableMethodFactory; import org.apache.dubbo.rpc.model.ProviderModel; import org.apache.dubbo.rpc.model.ServiceDescriptor; @@ -37,8 +37,12 @@ import org.apache.dubbo.rpc.protocol.tri.TripleCustomerProtocolWapper; import org.apache.dubbo.rpc.protocol.tri.stream.ServerStream; import org.apache.dubbo.rpc.service.ServiceDescriptorInternalCache; +import io.netty.handler.codec.http.HttpHeaderNames; + import java.util.Arrays; import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.Executor; import static org.apache.dubbo.common.constants.CommonConstants.DEFAULT_KEY; @@ -46,6 +50,7 @@ import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_PACKABLE_M public class ReflectionAbstractServerCall extends AbstractServerCall { + private static final String PACKABLE_METHOD_CACHE = "PACKABLE_METHOD_CACHE"; private final List headerFilters; private List methodDescriptors; @@ -120,10 +125,7 @@ public class ReflectionAbstractServerCall extends AbstractServerCall { } } if (methodDescriptor != null) { - final URL url = invoker.getUrl(); - packableMethod = frameworkModel.getExtensionLoader(PackableMethodFactory.class) - .getExtension(ConfigurationUtils.getGlobalConfiguration(url.getApplicationModel()).getString(DUBBO_PACKABLE_METHOD_FACTORY, DEFAULT_KEY)) - .create(methodDescriptor, url, (String) requestMetadata.get(HttpHeaderNames.CONTENT_TYPE.toString())); + loadPackableMethod(invoker.getUrl()); } trySetListener(); if (listener == null) { @@ -191,10 +193,19 @@ public class ReflectionAbstractServerCall extends AbstractServerCall { + serviceDescriptor.getInterfaceName()), null); return; } - final URL url = invoker.getUrl(); - packableMethod = frameworkModel.getExtensionLoader(PackableMethodFactory.class) - .getExtension(ConfigurationUtils.getGlobalConfiguration(url.getApplicationModel()).getString(DUBBO_PACKABLE_METHOD_FACTORY, DEFAULT_KEY)) - .create(methodDescriptor, url, (String) requestMetadata.get(HttpHeaderNames.CONTENT_TYPE.toString())); + loadPackableMethod(invoker.getUrl()); + } + + @SuppressWarnings("unchecked") + private void loadPackableMethod(URL url) { + Map cacheMap = (Map) url.getServiceModel() + .getServiceMetadata() + .getAttributeMap() + .computeIfAbsent(PACKABLE_METHOD_CACHE, (k) -> new ConcurrentHashMap<>()); + packableMethod = cacheMap.computeIfAbsent(methodDescriptor, + (md) -> frameworkModel.getExtensionLoader(PackableMethodFactory.class) + .getExtension(ConfigurationUtils.getGlobalConfiguration(url.getApplicationModel()).getString(DUBBO_PACKABLE_METHOD_FACTORY, DEFAULT_KEY)) + .create(methodDescriptor, url, (String) requestMetadata.get(HttpHeaderNames.CONTENT_TYPE.toString()))); } } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionServerCallTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionServerCallTest.java index 7b841e5ac4..7b379dbcdd 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionServerCallTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/call/ReflectionServerCallTest.java @@ -24,6 +24,7 @@ import org.apache.dubbo.rpc.model.MethodDescriptor; import org.apache.dubbo.rpc.model.ProviderModel; import org.apache.dubbo.rpc.model.ReflectionMethodDescriptor; import org.apache.dubbo.rpc.model.ServiceDescriptor; +import org.apache.dubbo.rpc.model.ServiceMetadata; import org.apache.dubbo.rpc.protocol.tri.DescriptorService; import org.apache.dubbo.rpc.protocol.tri.HelloReply; import org.apache.dubbo.rpc.protocol.tri.stream.TripleServerStream; @@ -46,6 +47,7 @@ class ReflectionServerCallTest { Invoker invoker = Mockito.mock(Invoker.class); TripleServerStream serverStream = Mockito.mock(TripleServerStream.class); ProviderModel providerModel = Mockito.mock(ProviderModel.class); + ServiceMetadata serviceMetadata = new ServiceMetadata(); Method method = DescriptorService.class.getMethod("sayHello", HelloReply.class); MethodDescriptor methodDescriptor = new ReflectionMethodDescriptor(method); URL url = Mockito.mock(URL.class); @@ -53,6 +55,8 @@ class ReflectionServerCallTest { .thenReturn(url); when(url.getServiceModel()) .thenReturn(providerModel); + when(providerModel.getServiceMetadata()) + .thenReturn(serviceMetadata); String service = "testService"; String methodName = "method"; From 91594eccfaf060af2c60f8c88c9fba2234538871 Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Wed, 18 Oct 2023 11:51:40 +0800 Subject: [PATCH 25/27] Enhance logs following up #13228 (#13229) --- .../rpc/protocol/tri/transport/TripleGoAwayHandler.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java index 234d9b341b..14e652adf4 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleGoAwayHandler.java @@ -17,6 +17,8 @@ package org.apache.dubbo.rpc.protocol.tri.transport; +import org.apache.dubbo.common.logger.Logger; +import org.apache.dubbo.common.logger.LoggerFactory; import org.apache.dubbo.remoting.Constants; import org.apache.dubbo.remoting.api.connection.ConnectionHandler; @@ -27,6 +29,7 @@ import io.netty.util.ReferenceCountUtil; public class TripleGoAwayHandler extends ChannelDuplexHandler { + private static final Logger logger = LoggerFactory.getLogger(TripleGoAwayHandler.class); public TripleGoAwayHandler() { } @@ -35,6 +38,9 @@ public class TripleGoAwayHandler extends ChannelDuplexHandler { public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception { if (msg instanceof Http2GoAwayFrame) { final ConnectionHandler connectionHandler = (ConnectionHandler) ctx.pipeline().get(Constants.CONNECTION_HANDLER_NAME); + if (logger.isInfoEnabled()) { + logger.info("Receive go away frame of " + ctx.channel().localAddress() + " -> " + ctx.channel().remoteAddress() + " and will reconnect later."); + } connectionHandler.onGoAway(ctx.channel()); } ReferenceCountUtil.release(msg); From c5efc65a99cab6d558bcff704fd76ba0f008e353 Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Wed, 18 Oct 2023 11:52:28 +0800 Subject: [PATCH 26/27] Remove sync lock for lazy target (#13220) --- .../config/spring/util/LazyTargetInvocationHandler.java | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/LazyTargetInvocationHandler.java b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/LazyTargetInvocationHandler.java index cb414f93f0..043c86a612 100644 --- a/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/LazyTargetInvocationHandler.java +++ b/dubbo-config/dubbo-config-spring/src/main/java/org/apache/dubbo/config/spring/util/LazyTargetInvocationHandler.java @@ -47,11 +47,7 @@ public class LazyTargetInvocationHandler implements InvocationHandler { } if (target == null) { - synchronized (this) { - if (target == null) { - target = lazyTargetSource.getTarget(); - } - } + target = lazyTargetSource.getTarget(); } if (method.getDeclaringClass().isInstance(target)) { try { From fa11b68a16a550ed19bb263d2f3ecd6d20a5fb8d Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Wed, 18 Oct 2023 11:52:46 +0800 Subject: [PATCH 27/27] Only throws exception when exporting service (#13217) --- .../qos/protocol/QosProtocolWrapper.java | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java index fe47762a33..2a6dfeff60 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/protocol/QosProtocolWrapper.java @@ -75,13 +75,13 @@ public class QosProtocolWrapper implements Protocol, ScopeModelAware { @Override public Exporter export(Invoker invoker) throws RpcException { - startQosServer(invoker.getUrl()); + startQosServer(invoker.getUrl(), true); return protocol.export(invoker); } @Override public Invoker refer(Class type, URL url) throws RpcException { - startQosServer(url); + startQosServer(url, false); return protocol.refer(type, url); } @@ -96,7 +96,7 @@ public class QosProtocolWrapper implements Protocol, ScopeModelAware { return protocol.getServers(); } - private void startQosServer(URL url) throws RpcException { + private void startQosServer(URL url, boolean isServer) throws RpcException { boolean qosCheck = url.getParameter(QOS_CHECK, false); try { @@ -134,13 +134,18 @@ public class QosProtocolWrapper implements Protocol, ScopeModelAware { } catch (Throwable throwable) { logger.warn(QOS_FAILED_START_SERVER, "", "", "Fail to start qos server: ", throwable); - try { - stopServer(); - } catch (Throwable stop) { - logger.warn(QOS_FAILED_START_SERVER, "", "", "Fail to stop qos server: ", stop); - } + if (qosCheck) { - throw new RpcException(throwable); + try { + // Stop QoS Server to support re-start if Qos-Check is enabled + stopServer(); + } catch (Throwable stop) { + logger.warn(QOS_FAILED_START_SERVER, "", "", "Fail to stop qos server: ", stop); + } + if (isServer) { + // Only throws exception when export services + throw new RpcException(throwable); + } } } }