This is an automated email from the ASF dual-hosted git repository.
zrlw pushed a commit to branch 3.3
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.3 by this push:
new 79683be9ff Revert "Add connection preface process to
TripleHttp2Protocol (#15368)" (#15435)
79683be9ff is described below
commit 79683be9ffd6da9474e85fc1567a75d900944ce3
Author: zrlw <[email protected]>
AuthorDate: Sun Jun 8 09:26:10 2025 +0800
Revert "Add connection preface process to TripleHttp2Protocol (#15368)"
(#15435)
This reverts commit e396bde74aa16961137f955f3c9fac35d6bc0410.
---
.../apache/dubbo/remoting/api/WireProtocol.java | 4 --
.../remoting/api/connection/ConnectionHandler.java | 7 ---
.../netty4/AbstractNettyConnectionClient.java | 57 ----------------------
.../transport/netty4/NettyConnectionHandler.java | 8 ---
.../rpc/protocol/tri/TripleHttp2Protocol.java | 7 ---
.../tri/transport/TripleHttp2SettingsHandler.java | 45 -----------------
6 files changed, 128 deletions(-)
diff --git
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/WireProtocol.java
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/WireProtocol.java
index 952884d98f..89f6d1766f 100644
---
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/WireProtocol.java
+++
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/WireProtocol.java
@@ -32,8 +32,4 @@ public interface WireProtocol {
void configClientPipeline(URL url, ChannelOperator operator,
ContextOperator contextOperator);
void close();
-
- default boolean hasConnectionPreface() {
- return false;
- }
}
diff --git
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/connection/ConnectionHandler.java
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/connection/ConnectionHandler.java
index 871a754c01..4bafd19266 100644
---
a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/connection/ConnectionHandler.java
+++
b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/connection/ConnectionHandler.java
@@ -31,11 +31,4 @@ public interface ConnectionHandler {
* @param channel Channel
*/
void reconnect(Object channel);
-
- /**
- * when connection preface is received.
- *
- * @param channel Channel
- */
- void onConnectionPrefaceReceived(Object channel);
}
diff --git
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AbstractNettyConnectionClient.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AbstractNettyConnectionClient.java
index f0530d85d5..f26ca4d819 100644
---
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AbstractNettyConnectionClient.java
+++
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/AbstractNettyConnectionClient.java
@@ -57,8 +57,6 @@ public abstract class AbstractNettyConnectionClient extends
AbstractConnectionCl
private ConnectionListener connectionListener;
- private AtomicReference<Promise<Void>> connectionPrefaceReceivedPromiseRef;
-
public static final AttributeKey<AbstractConnectionClient> CONNECTION =
AttributeKey.valueOf("connection");
public AbstractNettyConnectionClient(URL url, ChannelHandler handler)
throws RemotingException {
@@ -83,12 +81,6 @@ public abstract class AbstractNettyConnectionClient extends
AbstractConnectionCl
isReconnecting = new AtomicBoolean(false);
connectionListener = new ConnectionListener();
increase();
-
- // Create connection preface received promise for Http2 client since
it should wait server http2 settings frame
- // before sending client Headers frame, see details at
https://github.com/apache/dubbo/issues/15233
- if (protocol != null && protocol.hasConnectionPreface()) {
- connectionPrefaceReceivedPromiseRef = new AtomicReference<>();
- }
}
protected abstract void initBootstrap() throws Exception;
@@ -137,11 +129,6 @@ public abstract class AbstractNettyConnectionClient
extends AbstractConnectionCl
Future<Void> connectPromise = performConnect();
connectPromise.addListener(connectionListener);
- Promise<Void> connectionPrefaceReceivedPromise = null;
- if (connectionPrefaceReceivedPromiseRef != null) {
- connectionPrefaceReceivedPromise =
getOrCreateConnectionPrefaceReceivedPromise();
- }
-
boolean ret =
connectingPromise.awaitUninterruptibly(getConnectTimeout(),
TimeUnit.MILLISECONDS);
// destroy connectingPromise after used
synchronized (this) {
@@ -181,35 +168,6 @@ public abstract class AbstractNettyConnectionClient
extends AbstractConnectionCl
throw remotingException;
}
-
- if (connectionPrefaceReceivedPromise != null) {
- long retainedTimeout = getConnectTimeout() -
System.currentTimeMillis() + start;
- ret =
connectionPrefaceReceivedPromise.awaitUninterruptibly(retainedTimeout,
TimeUnit.MILLISECONDS);
- // destroy connectionPrefaceReceivedPromise after used
- synchronized (this) {
- connectionPrefaceReceivedPromiseRef.set(null);
- }
- if (!ret || !connectionPrefaceReceivedPromise.isSuccess()) {
- // 6-2 Client-side connection preface timeout
- RemotingException remotingException = new RemotingException(
- this,
- "client(url: " + getUrl() + ") failed to connect to
server " + getConnectAddress()
- + " client-side connection preface timeout " +
getConnectTimeout() + "ms (elapsed: "
- + (System.currentTimeMillis() - start) + "ms)
from netty client "
- + NetUtils.getLocalHost()
- + " using dubbo version "
- + Version.getVersion());
-
- logger.error(
- TRANSPORT_CLIENT_CONNECT_TIMEOUT,
- "provider crash",
- "",
- "Client-side connection preface timeout",
- remotingException);
-
- throw remotingException;
- }
- }
}
protected abstract ChannelFuture performConnect();
@@ -288,16 +246,6 @@ public abstract class AbstractNettyConnectionClient
extends AbstractConnectionCl
}
}
- public void onConnectionPrefaceReceived(Object channel) {
- if (!(channel instanceof io.netty.channel.Channel) ||
connectionPrefaceReceivedPromiseRef == null) {
- return;
- }
- Promise<Void> connectionPrefaceReceivedPromise =
connectionPrefaceReceivedPromiseRef.get();
- if (connectionPrefaceReceivedPromise != null) {
- connectionPrefaceReceivedPromise.trySuccess(null);
- }
- }
-
@Override
protected Channel getChannel() {
io.netty.channel.Channel c = getNettyChannel();
@@ -354,11 +302,6 @@ public abstract class AbstractNettyConnectionClient
extends AbstractConnectionCl
return connectingPromiseRef.get();
}
- private Promise<Void> getOrCreateConnectionPrefaceReceivedPromise() {
- connectionPrefaceReceivedPromiseRef.compareAndSet(null, new
DefaultPromise<>(GlobalEventExecutor.INSTANCE));
- return connectionPrefaceReceivedPromiseRef.get();
- }
-
public Promise<Void> getClosePromise() {
return closePromise;
}
diff --git
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionHandler.java
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionHandler.java
index 00116d3d2a..9c4d08c0ce 100644
---
a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionHandler.java
+++
b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyConnectionHandler.java
@@ -83,14 +83,6 @@ public class NettyConnectionHandler extends
ChannelInboundHandlerAdapter impleme
eventLoop.schedule(connectionClient::doReconnect, 1, TimeUnit.SECONDS);
}
- @Override
- public void onConnectionPrefaceReceived(Object channel) {
- if (!(channel instanceof Channel)) {
- return;
- }
- connectionClient.onConnectionPrefaceReceived(channel);
- }
-
@Override
public void channelActive(ChannelHandlerContext ctx) {
ctx.fireChannelActive();
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 1d68251d4e..bbd53f4ab1 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
@@ -41,7 +41,6 @@ import
org.apache.dubbo.rpc.protocol.tri.h12.TripleProtocolDetector;
import
org.apache.dubbo.rpc.protocol.tri.h12.http1.DefaultHttp11ServerTransportListenerFactory;
import
org.apache.dubbo.rpc.protocol.tri.h12.http2.GenericHttp2ServerTransportListenerFactory;
import org.apache.dubbo.rpc.protocol.tri.transport.TripleGoAwayHandler;
-import org.apache.dubbo.rpc.protocol.tri.transport.TripleHttp2SettingsHandler;
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.websocket.DefaultWebSocketServerTransportListenerFactory;
@@ -96,11 +95,6 @@ public class TripleHttp2Protocol extends
AbstractWireProtocol implements ScopeMo
super.close();
}
- @Override
- public boolean hasConnectionPreface() {
- return true;
- }
-
@Override
public void configClientPipeline(URL url, ChannelOperator operator,
ContextOperator contextOperator) {
TripleConfig tripleConfig =
ConfigManager.getProtocolOrDefault(url).getTripleOrDefault();
@@ -122,7 +116,6 @@ public class TripleHttp2Protocol extends
AbstractWireProtocol implements ScopeMo
handlers.add(new ChannelHandlerPretender(new Http2MultiplexHandler(new
ChannelDuplexHandler())));
handlers.add(new ChannelHandlerPretender(new
TriplePingPongHandler(UrlUtils.getCloseTimeout(url))));
handlers.add(new ChannelHandlerPretender(new TripleGoAwayHandler()));
- handlers.add(new ChannelHandlerPretender(new
TripleHttp2SettingsHandler()));
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/TripleHttp2SettingsHandler.java
b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleHttp2SettingsHandler.java
deleted file mode 100644
index 541c2fb915..0000000000
---
a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/TripleHttp2SettingsHandler.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.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;
-
-import io.netty.channel.ChannelHandlerContext;
-import io.netty.channel.SimpleChannelInboundHandler;
-import io.netty.handler.codec.http2.Http2SettingsFrame;
-
-public class TripleHttp2SettingsHandler extends
SimpleChannelInboundHandler<Http2SettingsFrame> {
-
- private static final Logger logger =
LoggerFactory.getLogger(TripleHttp2SettingsHandler.class);
-
- public TripleHttp2SettingsHandler() {}
-
- @Override
- protected void channelRead0(ChannelHandlerContext ctx, Http2SettingsFrame
msg) throws Exception {
- final ConnectionHandler connectionHandler =
- (ConnectionHandler)
ctx.pipeline().get(Constants.CONNECTION_HANDLER_NAME);
- if (logger.isDebugEnabled()) {
- logger.debug("Receive Http2 Settings frame of " +
ctx.channel().localAddress() + " -> "
- + ctx.channel().remoteAddress());
- }
- // Notify the connection preface is received.
- connectionHandler.onConnectionPrefaceReceived(ctx.channel());
- }
-}