From 73969703b1f4407fce837de1816106eb53f7f03b Mon Sep 17 00:00:00 2001 From: Albumen Kevin Date: Fri, 30 Dec 2022 20:34:44 +0800 Subject: [PATCH 1/3] Add some qos command logs (#11224) * Add some qos command logs * Add some qos command logs * Fix tests --- .../qos/command/DefaultCommandExecutor.java | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java index 12cd5f9b9e..4bb6eac704 100644 --- a/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java +++ b/dubbo-plugin/dubbo-qos/src/main/java/org/apache/dubbo/qos/command/DefaultCommandExecutor.java @@ -16,9 +16,18 @@ */ package org.apache.dubbo.qos.command; +import org.apache.dubbo.common.logger.Logger; +import org.apache.dubbo.common.logger.LoggerFactory; import org.apache.dubbo.rpc.model.FrameworkModel; +import io.netty.channel.Channel; + +import java.util.Arrays; +import java.util.Objects; +import java.util.Optional; + public class DefaultCommandExecutor implements CommandExecutor { + private final static Logger logger = LoggerFactory.getLogger(DefaultCommandExecutor.class); private FrameworkModel frameworkModel; public DefaultCommandExecutor(FrameworkModel frameworkModel) { @@ -27,6 +36,11 @@ public class DefaultCommandExecutor implements CommandExecutor { @Override public String execute(CommandContext commandContext) throws NoSuchCommandException { + String remoteAddress = Optional.ofNullable(commandContext.getRemote()) + .map(Channel::remoteAddress).map(Objects::toString).orElse("unknown"); + + logger.info("[Dubbo QoS] Command Process start. Command: " + commandContext.getCommandName() + + ", Args: " + Arrays.toString(commandContext.getArgs()) + ", Remote Address: " + remoteAddress); BaseCommand command = null; try { command = frameworkModel.getExtensionLoader(BaseCommand.class).getExtension(commandContext.getCommandName()); @@ -34,8 +48,22 @@ public class DefaultCommandExecutor implements CommandExecutor { //can't find command } if (command == null) { + logger.info("[Dubbo QoS] Command Not found. Command: " + commandContext.getCommandName() + + ", Remote Address: " + remoteAddress); throw new NoSuchCommandException(commandContext.getCommandName()); } - return command.execute(commandContext, commandContext.getArgs()); + + try { + String result = command.execute(commandContext, commandContext.getArgs()); + logger.info("[Dubbo QoS] Command Process success. Command: " + commandContext.getCommandName() + + ", Args: " + Arrays.toString(commandContext.getArgs()) + ", Result: " + result + + ", Remote Address: " + remoteAddress); + return result; + } catch (Throwable t) { + logger.info("[Dubbo QoS] Command Process Failed. Command: " + commandContext.getCommandName() + + ", Args: " + Arrays.toString(commandContext.getArgs()) + + ", Remote Address: " + remoteAddress, t); + throw t; + } } } From 2765deb98d11e58788f629aa3b6237e790c0a0d6 Mon Sep 17 00:00:00 2001 From: earthchen Date: Sat, 31 Dec 2022 13:41:31 +0800 Subject: [PATCH 2/3] fix tri upper error (#11214) * fix error * fix * fix * fix * fix * fix --- .../tri/stream/TripleClientStream.java | 30 +++---------------- .../tri/stream/TripleServerStream.java | 6 +++- .../AbstractH2TransportListener.java | 26 +++++++++++++--- .../AbstractH2TransportListenerTest.java | 6 ++-- 4 files changed, 34 insertions(+), 34 deletions(-) diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStream.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStream.java index 589239c4e5..27efb969ba 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStream.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleClientStream.java @@ -19,7 +19,6 @@ package org.apache.dubbo.rpc.protocol.tri.stream; import org.apache.dubbo.common.logger.ErrorTypeAwareLogger; import org.apache.dubbo.common.logger.LoggerFactory; -import org.apache.dubbo.common.utils.JsonUtils; import org.apache.dubbo.rpc.TriRpcStatus; import org.apache.dubbo.rpc.model.FrameworkModel; import org.apache.dubbo.rpc.protocol.tri.TripleHeaderEnum; @@ -52,8 +51,6 @@ import java.nio.charset.StandardCharsets; import java.util.Map; import java.util.concurrent.Executor; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.COMMON_REFLECTIVE_OPERATION_FAILED; - /** * ClientStream is an abstraction for bi-directional messaging. It maintains a {@link WriteQueue} to @@ -195,29 +192,10 @@ public class TripleClientStream extends AbstractStream implements ClientStream { halfClosed = true; final Map reserved = filterReservedHeaders(trailers); - final Map attachments = headersToMap(trailers); - final Map finalAttachments = convertNoLowerCaseHeader(attachments); - listener.onComplete(status, finalAttachments, reserved); - } - - private Map convertNoLowerCaseHeader(Map attachments) { - Object obj = attachments.remove(TripleHeaderEnum.TRI_HEADER_CONVERT.getHeader()); - if (obj == null) { - return attachments; - } - if (obj instanceof String) { - String json = TriRpcStatus.decodeMessage((String) obj); - Map map = JsonUtils.getJson().toJavaObject(json, Map.class); - map.forEach((originalKey, lowerCaseKey) -> { - Object val = attachments.remove(lowerCaseKey); - if (val != null) { - attachments.put(originalKey, val); - } - }); - } else { - LOGGER.error(COMMON_REFLECTIVE_OPERATION_FAILED, "", "", "Triple convertNoLowerCaseHeader error, obj is not String"); - } - return attachments; + final Map attachments = headersToMap(trailers, () -> { + return reserved.get(TripleHeaderEnum.TRI_HEADER_CONVERT.getHeader()); + }); + listener.onComplete(status, attachments, reserved); } private TriRpcStatus validateHeaderStatus(Http2Headers headers) { diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleServerStream.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleServerStream.java index 33a17c6283..0c0cfe5eb2 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleServerStream.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/stream/TripleServerStream.java @@ -371,7 +371,11 @@ public class TripleServerStream extends AbstractStream implements ServerStream { } } - Map requestMetadata = headersToMap(headers); + Map requestMetadata = headersToMap(headers, () -> { + return Optional.ofNullable(headers.get(TripleHeaderEnum.TRI_HEADER_CONVERT.getHeader())) + .map(CharSequence::toString) + .orElse(null); + }); boolean hasStub = pathResolver.hasNativeStub(path); if (hasStub) { listener = new StubAbstractServerCall(invoker, TripleServerStream.this, diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java index 2cf6caa001..f4732bb87c 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java @@ -19,6 +19,8 @@ package org.apache.dubbo.rpc.protocol.tri.transport; import org.apache.dubbo.common.logger.ErrorTypeAwareLogger; import org.apache.dubbo.common.logger.LoggerFactory; +import org.apache.dubbo.common.utils.JsonUtils; +import org.apache.dubbo.rpc.TriRpcStatus; import org.apache.dubbo.rpc.protocol.tri.TripleConstant; import org.apache.dubbo.rpc.protocol.tri.TripleHeaderEnum; import org.apache.dubbo.rpc.protocol.tri.stream.StreamUtils; @@ -28,6 +30,7 @@ import io.netty.handler.codec.http2.Http2Headers; import java.util.Collections; import java.util.HashMap; import java.util.Map; +import java.util.function.Supplier; import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_FAILED_PARSE; @@ -41,7 +44,7 @@ public abstract class AbstractH2TransportListener implements H2TransportListener * @param trailers the metadata from remote * @return KV pairs map */ - protected Map headersToMap(Http2Headers trailers) { + protected Map headersToMap(Http2Headers trailers, Supplier convertUpperHeaderSupplier) { if (trailers == null) { return Collections.emptyMap(); } @@ -62,6 +65,24 @@ public abstract class AbstractH2TransportListener implements H2TransportListener attachments.put(key, header.getValue().toString()); } } + + // try convert upper key + Object obj = convertUpperHeaderSupplier.get(); + if (obj == null) { + return attachments; + } + if (obj instanceof String) { + String json = TriRpcStatus.decodeMessage((String) obj); + Map map = JsonUtils.getJson().toJavaObject(json, Map.class); + for (Map.Entry entry : map.entrySet()) { + Object val = attachments.remove(entry.getKey()); + if (val != null) { + attachments.put(entry.getValue(), val); + } + } + } else { + LOGGER.error(PROTOCOL_FAILED_PARSE, "", "", "Triple convertNoLowerCaseHeader error, obj is not String"); + } return attachments; } @@ -73,9 +94,6 @@ public abstract class AbstractH2TransportListener implements H2TransportListener Map excludeHeaders = new HashMap<>(trailers.size()); for (Map.Entry header : trailers) { String key = header.getKey().toString(); - if (Http2Headers.PseudoHeaderName.isPseudoHeader(key)) { - excludeHeaders.put(key, trailers.getAndRemove(key).toString()); - } if (TripleHeaderEnum.containsExcludeAttachments(key)) { excludeHeaders.put(key, trailers.getAndRemove(key).toString()); } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListenerTest.java b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListenerTest.java index a2daf0eaf3..ba936e6084 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListenerTest.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/test/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListenerTest.java @@ -50,10 +50,10 @@ class AbstractH2TransportListenerTest { }; DefaultHttp2Headers headers = new DefaultHttp2Headers(); headers.scheme(HTTPS.name()) - .path("/foo.bar") - .method(HttpMethod.POST.asciiName()); + .path("/foo.bar") + .method(HttpMethod.POST.asciiName()); headers.set("foo", "bar"); - final Map map = listener.headersToMap(headers); + final Map map = listener.headersToMap(headers, () -> null); Assertions.assertEquals(4, map.size()); } From 34168e6d0e1bff11f433a7bca99686481c43dd18 Mon Sep 17 00:00:00 2001 From: Andy Cheung Date: Tue, 3 Jan 2023 15:03:55 +0800 Subject: [PATCH 3/3] Merge error code 3-3 to 3-8, 6-4 to 99-0. (#11225) * Replace LoggerCodeConstants.java with 3.2 branch. * Add hints in the constant file. * Add hints in the constant file. (2) * Merge 3-3 to 3-8. * 6-4 -> 99-0. * 6-4 -> 99-0. * 6-4 -> 99-0. * 6-4 -> 99-0. (4) * 6-4 -> 99-0. (5, Compatible) * Change AbstractH2TransportListener's error code per @EarthChen's request. --- .../common/constants/LoggerCodeConstants.java | 41 ++++++++++++++++--- .../deploy/DefaultApplicationDeployer.java | 4 +- .../ServiceAnnotationPostProcessor.java | 2 +- .../dubbo/remoting/api/ConnectionHandler.java | 4 +- .../remoting/api/SslClientTlsHandler.java | 4 +- .../remoting/api/SslServerTlsHandler.java | 6 +-- .../support/header/HeaderExchangeServer.java | 4 +- .../support/header/ReconnectTimerTask.java | 4 +- .../remoting/transport/AbstractEndpoint.java | 6 +-- .../remoting/transport/AbstractServer.java | 14 +++---- .../transport/ChannelHandlerDispatcher.java | 12 +++--- .../transport/MultiMessageHandler.java | 6 +-- .../dispatcher/ChannelEventRunnable.java | 14 +++---- .../remoting/transport/netty/NettyHelper.java | 11 ++--- .../NettyPortUnificationServerHandler.java | 6 +-- .../javassist/JavassistProxyFactory.java | 14 +++---- .../AbstractH2TransportListener.java | 8 +++- 17 files changed, 97 insertions(+), 63 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java index ef4be3c1a6..f033d3941a 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/constants/LoggerCodeConstants.java @@ -18,7 +18,20 @@ package org.apache.dubbo.common.constants; /** - * Constants of Error codes used in logger. + *

Constants of Error Codes used in logger. + * + *

Format: [Category]-[Code], where: + *

  • [Category] is the category code which identifies the module. + *
  • [Code] is the detailed code. + *
  • Every blanks should be filled with positive number. + * + *

    + *

    Hint: + *

  • Synchronize this file across different branches. (Use merge and cherry-pick.) + *
  • Double-check the usage in different branches before deleting any of the error code. + *
  • If applicable, use error code that already appears in this file. + *
  • If it's required to add an error code, find an error code that's marked by 'Absent', and rename it. (so that no code is wasted) + *
  • Update the corresponding file in dubbo-website repository. */ public interface LoggerCodeConstants { @@ -75,8 +88,10 @@ public interface LoggerCodeConstants { String COMMON_METADATA_PROCESSOR = "0-26"; + String COMMON_ISOLATED_EXECUTOR_CONFIGURATION_ERROR = "0-27"; + // Registry module - + String REGISTRY_ADDRESS_INVALID = "1-1"; /** @@ -170,7 +185,11 @@ public interface LoggerCodeConstants { String REGISTRY_FAILED_LOAD_METADATA = "1-39"; - // Cluster module + String REGISTRY_ROUTER_WAIT_LONG = "1-40"; + + String REGISTRY_ISTIO_EXCEPTION = "1-41"; + + // Cluster module 2-x String CLUSTER_FAILED_SITE_SELECTION = "2-1"; String CLUSTER_NO_VALID_PROVIDER = "2-2"; @@ -211,12 +230,15 @@ public interface LoggerCodeConstants { String CLUSTER_FAILED_GROUP_MERGE = "2-20"; - // Proxy module. + // Proxy module. 3-1 String PROXY_FAILED_CONVERT_URL = "3-1"; String PROXY_FAILED_EXPORT_SERVICE = "3-2"; - String PROXY_FAILED_JAVASSIST = "3-3"; + /** + * Absent. Merged with 3-8. + */ + String PROXY_33 = "3-3"; String PROXY_TIMEOUT_REQUEST = "3-4"; @@ -226,6 +248,8 @@ public interface LoggerCodeConstants { String PROXY_TIMEOUT_RESPONSE = "3-7"; + String PROXY_FAILED = "3-8"; + // Protocol module. String PROTOCOL_UNSUPPORTED = "4-1"; @@ -311,7 +335,7 @@ public interface LoggerCodeConstants { String CONFIG_STOP_DUBBO_ERROR = "5-20"; - String CONFIG_FAILED_EXECUTE_DESTORY = "5-21"; + String CONFIG_FAILED_EXECUTE_DESTROY = "5-21"; String CONFIG_FAILED_INIT_CONFIG_CENTER = "5-22"; @@ -358,6 +382,9 @@ public interface LoggerCodeConstants { String TRANSPORT_FAILED_CLOSE = "6-3"; + /** + * Absent. Merged to 99-0. + */ String TRANSPORT_UNEXPECTED_EXCEPTION = "6-4"; String TRANSPORT_FAILED_DISCONNECT_PROVIDER = "6-5"; @@ -397,6 +424,8 @@ public interface LoggerCodeConstants { String QOS_UNEXPECTED_EXCEPTION = "7-6"; + String QOS_PERMISSION_DENY_EXCEPTION = "7-7"; + // Testing module (8[X], where [X] is number of the module to be tested.) String TESTING_REGISTRY_FAILED_TO_START_ZOOKEEPER = "81-1"; diff --git a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java index 3411789c09..94d4d94ed4 100644 --- a/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java +++ b/dubbo-config/dubbo-config-api/src/main/java/org/apache/dubbo/config/deploy/DefaultApplicationDeployer.java @@ -76,7 +76,7 @@ import static java.lang.String.format; import static org.apache.dubbo.common.config.ConfigurationUtils.parseProperties; import static org.apache.dubbo.common.constants.CommonConstants.REGISTRY_SPLIT_PATTERN; import static org.apache.dubbo.common.constants.CommonConstants.REMOTE_METADATA_STORAGE_TYPE; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_EXECUTE_DESTORY; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_EXECUTE_DESTROY; import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_INIT_CONFIG_CENTER; import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_FAILED_START_MODEL; import static org.apache.dubbo.common.constants.LoggerCodeConstants.CONFIG_REFRESH_INSTANCE_ERROR; @@ -1063,7 +1063,7 @@ public class DefaultApplicationDeployer extends AbstractDeployer resolvePackagesToScan(Set packagesToScan) { - Set resolvedPackagesToScan = new LinkedHashSet(packagesToScan.size()); + Set resolvedPackagesToScan = new LinkedHashSet<>(packagesToScan.size()); for (String packageToScan : packagesToScan) { if (StringUtils.hasText(packageToScan)) { String resolvedPackageToScan = environment.resolvePlaceholders(packageToScan.trim()); diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/ConnectionHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/ConnectionHandler.java index 6f0baa6158..97cb908049 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/ConnectionHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/ConnectionHandler.java @@ -29,7 +29,7 @@ import io.netty.util.AttributeKey; import java.util.concurrent.TimeUnit; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; @ChannelHandler.Sharable public class ConnectionHandler extends ChannelInboundHandlerAdapter { @@ -70,7 +70,7 @@ public class ConnectionHandler extends ChannelInboundHandlerAdapter { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - log.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", String.format("Channel error:%s", ctx.channel()), cause); + log.warn(INTERNAL_ERROR, "unknown error in remoting module", "", String.format("Channel error:%s", ctx.channel()), cause); ctx.close(); } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslClientTlsHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslClientTlsHandler.java index 5a7239c16a..2955827b9f 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslClientTlsHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslClientTlsHandler.java @@ -29,7 +29,7 @@ import io.netty.handler.ssl.SslHandshakeCompletionEvent; import javax.net.ssl.SSLEngine; import javax.net.ssl.SSLSession; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; public class SslClientTlsHandler extends ChannelInboundHandlerAdapter { @@ -61,7 +61,7 @@ public class SslClientTlsHandler extends ChannelInboundHandlerAdapter { logger.info("TLS negotiation succeed with session: " + session); ctx.pipeline().remove(this); } else { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "TLS negotiation failed when trying to accept new connection.", handshakeEvent.cause()); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", "TLS negotiation failed when trying to accept new connection.", handshakeEvent.cause()); ctx.fireExceptionCaught(handshakeEvent.cause()); } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslServerTlsHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslServerTlsHandler.java index ee926f06d6..94be77a933 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslServerTlsHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/api/SslServerTlsHandler.java @@ -31,7 +31,7 @@ import io.netty.handler.ssl.SslHandshakeCompletionEvent; import javax.net.ssl.SSLSession; import java.util.List; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; public class SslServerTlsHandler extends ByteToMessageDecoder { private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(SslServerTlsHandler.class); @@ -59,7 +59,7 @@ public class SslServerTlsHandler extends ByteToMessageDecoder { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "TLS negotiation failed when trying to accept new connection.", cause); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", "TLS negotiation failed when trying to accept new connection.", cause); } @Override @@ -72,7 +72,7 @@ public class SslServerTlsHandler extends ByteToMessageDecoder { // Remove after handshake success. ctx.pipeline().remove(this); } else { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "TLS negotiation failed when trying to accept new connection.", handshakeEvent.cause()); + logger.error(INTERNAL_ERROR, "", "", "TLS negotiation failed when trying to accept new connection.", handshakeEvent.cause()); ctx.close(); } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java index aab03f6f44..25d2370d4f 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/HeaderExchangeServer.java @@ -46,7 +46,7 @@ import static java.util.Collections.unmodifiableCollection; import static org.apache.dubbo.common.constants.CommonConstants.READONLY_EVENT; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_CLOSE; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_RESPONSE; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; import static org.apache.dubbo.remoting.Constants.HEARTBEAT_CHECK_TICK; import static org.apache.dubbo.remoting.Constants.LEAST_HEARTBEAT_DURATION; import static org.apache.dubbo.remoting.Constants.TICKS_PER_WHEEL; @@ -221,7 +221,7 @@ public class HeaderExchangeServer implements ExchangeServer { startIdleCheckTask(url); } } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTask.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTask.java index 9306f3aaf1..54a035b764 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTask.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/exchange/support/header/ReconnectTimerTask.java @@ -23,7 +23,7 @@ import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.Client; import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_FAILED_RECONNECT; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; /** * ReconnectTimerTask @@ -64,7 +64,7 @@ public class ReconnectTimerTask extends AbstractTimerTask { } } } catch (Throwable t) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "Exception when reconnect to remote channel " + channel.getRemoteAddress(), t); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "Exception when reconnect to remote channel " + channel.getRemoteAddress(), t); } } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java index ed4004bdd1..16b57f1204 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractEndpoint.java @@ -28,7 +28,7 @@ import org.apache.dubbo.remoting.Constants; import org.apache.dubbo.remoting.transport.codec.CodecAdapter; import org.apache.dubbo.rpc.model.FrameworkModel; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; import static org.apache.dubbo.rpc.model.ScopeModelUtil.getFrameworkModel; /** @@ -80,7 +80,7 @@ public abstract class AbstractEndpoint extends AbstractPeer implements Resetable } } } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "", "", t.getMessage(), t); } try { @@ -88,7 +88,7 @@ public abstract class AbstractEndpoint extends AbstractPeer implements Resetable this.codec = getChannelCodec(url); } } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java index 0c0aad37bb..0a27e256f2 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/AbstractServer.java @@ -36,7 +36,7 @@ import java.util.concurrent.ExecutorService; import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_KEY; import static org.apache.dubbo.common.constants.CommonConstants.ANYHOST_VALUE; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; import static org.apache.dubbo.remoting.Constants.ACCEPTS_KEY; import static org.apache.dubbo.remoting.Constants.DEFAULT_ACCEPTS; @@ -96,7 +96,7 @@ public abstract class AbstractServer extends AbstractEndpoint implements Remotin } } } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } ExecutorService executor = executorRepository.createExecutorIfAbsent(url); @@ -128,13 +128,13 @@ public abstract class AbstractServer extends AbstractEndpoint implements Remotin try { super.close(); } catch (Throwable e) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", e.getMessage(), e); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", e.getMessage(), e); } try { doClose(); } catch (Throwable e) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", e.getMessage(), e); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", e.getMessage(), e); } } @@ -163,13 +163,13 @@ public abstract class AbstractServer extends AbstractEndpoint implements Remotin public void connected(Channel ch) throws RemotingException { // If the server has entered the shutdown process, reject any new connection if (this.isClosing() || this.isClosed()) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "Close new channel " + ch + ", cause: server is closing or has been closed. For example, receive a new connect request while in shutdown process."); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "Close new channel " + ch + ", cause: server is closing or has been closed. For example, receive a new connect request while in shutdown process."); ch.close(); return; } if (accepts > 0 && getChannels().size() > accepts) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "Close channel " + ch + ", cause: The server " + ch.getLocalAddress() + " connections greater than max config " + accepts); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", "Close channel " + ch + ", cause: The server " + ch.getLocalAddress() + " connections greater than max config " + accepts); ch.close(); return; } @@ -180,7 +180,7 @@ public abstract class AbstractServer extends AbstractEndpoint implements Remotin public void disconnected(Channel ch) throws RemotingException { Collection channels = getChannels(); if (channels.isEmpty()) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "All clients has disconnected from " + ch.getLocalAddress() + ". You can graceful shutdown now."); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "All clients has disconnected from " + ch.getLocalAddress() + ". You can graceful shutdown now."); } super.disconnected(ch); } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcher.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcher.java index f425eb3ce0..c0dc2b2f84 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcher.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/ChannelHandlerDispatcher.java @@ -26,7 +26,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.concurrent.CopyOnWriteArraySet; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; /** * ChannelListenerDispatcher @@ -70,7 +70,7 @@ public class ChannelHandlerDispatcher implements ChannelHandler { try { listener.connected(channel); } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } } } @@ -81,7 +81,7 @@ public class ChannelHandlerDispatcher implements ChannelHandler { try { listener.disconnected(channel); } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } } } @@ -92,7 +92,7 @@ public class ChannelHandlerDispatcher implements ChannelHandler { try { listener.sent(channel, message); } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } } } @@ -103,7 +103,7 @@ public class ChannelHandlerDispatcher implements ChannelHandler { try { listener.received(channel, message); } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } } } @@ -114,7 +114,7 @@ public class ChannelHandlerDispatcher implements ChannelHandler { try { listener.caught(channel, exception); } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", t.getMessage(), t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", t.getMessage(), t); } } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java index 7d65fdd757..0e78bb06b0 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/MultiMessageHandler.java @@ -23,7 +23,7 @@ import org.apache.dubbo.remoting.ChannelHandler; import org.apache.dubbo.remoting.RemotingException; import org.apache.dubbo.remoting.exchange.support.MultiMessage; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; /** * @see MultiMessage @@ -45,11 +45,11 @@ public class MultiMessageHandler extends AbstractChannelHandlerDelegate { try { handler.received(channel, obj); } catch (Throwable t) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "MultiMessageHandler received fail.", t); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", "MultiMessageHandler received fail.", t); try { handler.caught(channel, t); } catch (Throwable t1) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "MultiMessageHandler caught fail.", t1); + logger.error(INTERNAL_ERROR, "unknown error in remoting module", "", "MultiMessageHandler caught fail.", t1); } } } diff --git a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java index 9af07d3b38..a250d05bf7 100644 --- a/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java +++ b/dubbo-remoting/dubbo-remoting-api/src/main/java/org/apache/dubbo/remoting/transport/dispatcher/ChannelEventRunnable.java @@ -22,7 +22,7 @@ import org.apache.dubbo.common.threadlocal.InternalThreadLocal; import org.apache.dubbo.remoting.Channel; import org.apache.dubbo.remoting.ChannelHandler; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; public class ChannelEventRunnable implements Runnable { private static final ErrorTypeAwareLogger logger = LoggerFactory.getErrorTypeAwareLogger(ChannelEventRunnable.class); @@ -60,7 +60,7 @@ public class ChannelEventRunnable implements Runnable { try { handler.received(channel, message); } catch (Exception e) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel + ", message is " + message, e); } } else { @@ -69,21 +69,21 @@ public class ChannelEventRunnable implements Runnable { try { handler.connected(channel); } catch (Exception e) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); } break; case DISCONNECTED: try { handler.disconnected(channel); } catch (Exception e) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel, e); } break; case SENT: try { handler.sent(channel, message); } catch (Exception e) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel + ", message is " + message, e); } break; @@ -91,12 +91,12 @@ public class ChannelEventRunnable implements Runnable { try { handler.caught(channel, exception); } catch (Exception e) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "ChannelEventRunnable handle " + state + " operation error, channel is " + channel + ", message is: " + message + ", exception is " + exception, e); } break; default: - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "unknown state: " + state + ", message is " + message); + logger.warn(INTERNAL_ERROR, "unknown error in remoting module", "", "unknown state: " + state + ", message is " + message); } } InternalThreadLocal.removeAll(); diff --git a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHelper.java b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHelper.java index bfe8cafd8a..f7f70bfecd 100644 --- a/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHelper.java +++ b/dubbo-remoting/dubbo-remoting-netty/src/main/java/org/apache/dubbo/remoting/transport/netty/NettyHelper.java @@ -23,7 +23,7 @@ import org.jboss.netty.logging.AbstractInternalLogger; import org.jboss.netty.logging.InternalLogger; import org.jboss.netty.logging.InternalLoggerFactory; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; final class NettyHelper { @@ -44,6 +44,7 @@ final class NettyHelper { static class DubboLogger extends AbstractInternalLogger { + public static final String LOGGER_CAUSE_STRING = "unknown error in remoting-netty module"; private ErrorTypeAwareLogger logger; DubboLogger(ErrorTypeAwareLogger logger) { @@ -92,22 +93,22 @@ final class NettyHelper { @Override public void warn(String msg) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", msg); + logger.warn(INTERNAL_ERROR, LOGGER_CAUSE_STRING, "", msg); } @Override public void warn(String msg, Throwable cause) { - logger.warn(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", msg, cause); + logger.warn(INTERNAL_ERROR, LOGGER_CAUSE_STRING, "", msg, cause); } @Override public void error(String msg) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", msg); + logger.error(INTERNAL_ERROR, LOGGER_CAUSE_STRING, "", msg); } @Override public void error(String msg, Throwable cause) { - logger.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", msg, cause); + logger.error(INTERNAL_ERROR, LOGGER_CAUSE_STRING, "", msg, cause); } @Override diff --git a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java index 338f3572d1..c48372865e 100644 --- a/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java +++ b/dubbo-remoting/dubbo-remoting-netty4/src/main/java/org/apache/dubbo/remoting/transport/netty4/NettyPortUnificationServerHandler.java @@ -39,7 +39,7 @@ import java.util.List; import java.util.Map; import java.util.Set; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.TRANSPORT_UNEXPECTED_EXCEPTION; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; public class NettyPortUnificationServerHandler extends ByteToMessageDecoder { @@ -71,7 +71,7 @@ public class NettyPortUnificationServerHandler extends ByteToMessageDecoder { @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { - LOGGER.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", "Unexpected exception from downstream before protocol detected.", cause); + LOGGER.error(INTERNAL_ERROR, "unknown error in remoting module", "", "Unexpected exception from downstream before protocol detected.", cause); } @Override @@ -125,7 +125,7 @@ public class NettyPortUnificationServerHandler extends ByteToMessageDecoder { Set supported = url.getApplicationModel() .getExtensionLoader(WireProtocol.class) .getSupportedExtensions(); - LOGGER.error(TRANSPORT_UNEXPECTED_EXCEPTION, "", "", String.format("Can not recognize protocol from downstream=%s . " + LOGGER.error(INTERNAL_ERROR, "unknown error in remoting module", "", String.format("Can not recognize protocol from downstream=%s . " + "preface=%s protocols=%s", ctx.channel().remoteAddress(), Bytes.bytes2hex(preface), supported)); diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactory.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactory.java index 8755a75cca..4d341b2ec9 100644 --- a/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactory.java +++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/org/apache/dubbo/rpc/proxy/javassist/JavassistProxyFactory.java @@ -29,7 +29,7 @@ import org.apache.dubbo.rpc.proxy.jdk.JdkProxyFactory; import java.util.Arrays; -import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROXY_FAILED_JAVASSIST; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROXY_FAILED; /** * JavassistRpcProxyFactory @@ -47,13 +47,13 @@ public class JavassistProxyFactory extends AbstractProxyFactory { // try fall back to JDK proxy factory try { T proxy = jdkProxyFactory.getProxy(invoker, interfaces); - logger.error(PROXY_FAILED_JAVASSIST, "", "", "Failed to generate proxy by Javassist failed. Fallback to use JDK proxy success. " + + logger.error(PROXY_FAILED, "", "", "Failed to generate proxy by Javassist failed. Fallback to use JDK proxy success. " + "Interfaces: " + Arrays.toString(interfaces), fromJavassist); return proxy; } catch (Throwable fromJdk) { - logger.error(PROXY_FAILED_JAVASSIST, "", "", "Failed to generate proxy by Javassist failed. Fallback to use JDK proxy is also failed. " + + logger.error(PROXY_FAILED, "", "", "Failed to generate proxy by Javassist failed. Fallback to use JDK proxy is also failed. " + "Interfaces: " + Arrays.toString(interfaces) + " Javassist Error.", fromJavassist); - logger.error(PROXY_FAILED_JAVASSIST, "", "", "Failed to generate proxy by Javassist failed. Fallback to use JDK proxy is also failed. " + + logger.error(PROXY_FAILED, "", "", "Failed to generate proxy by Javassist failed. Fallback to use JDK proxy is also failed. " + "Interfaces: " + Arrays.toString(interfaces) + " JDK Error.", fromJdk); throw fromJavassist; } @@ -77,14 +77,14 @@ public class JavassistProxyFactory extends AbstractProxyFactory { // try fall back to JDK proxy factory try { Invoker invoker = jdkProxyFactory.getInvoker(proxy, type, url); - logger.error(PROXY_FAILED_JAVASSIST, "", "", "Failed to generate invoker by Javassist failed. Fallback to use JDK proxy success. " + + logger.error(PROXY_FAILED, "", "", "Failed to generate invoker by Javassist failed. Fallback to use JDK proxy success. " + "Interfaces: " + type, fromJavassist); // log out error return invoker; } catch (Throwable fromJdk) { - logger.error(PROXY_FAILED_JAVASSIST, "", "", "Failed to generate invoker by Javassist failed. Fallback to use JDK proxy is also failed. " + + logger.error(PROXY_FAILED, "", "", "Failed to generate invoker by Javassist failed. Fallback to use JDK proxy is also failed. " + "Interfaces: " + type + " Javassist Error.", fromJavassist); - logger.error(PROXY_FAILED_JAVASSIST, "", "", "Failed to generate invoker by Javassist failed. Fallback to use JDK proxy is also failed. " + + logger.error(PROXY_FAILED, "", "", "Failed to generate invoker by Javassist failed. Fallback to use JDK proxy is also failed. " + "Interfaces: " + type + " JDK Error.", fromJdk); throw fromJavassist; } diff --git a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java index f4732bb87c..110e0472f5 100644 --- a/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java +++ b/dubbo-rpc/dubbo-rpc-triple/src/main/java/org/apache/dubbo/rpc/protocol/tri/transport/AbstractH2TransportListener.java @@ -32,6 +32,7 @@ import java.util.HashMap; import java.util.Map; import java.util.function.Supplier; +import static org.apache.dubbo.common.constants.LoggerCodeConstants.INTERNAL_ERROR; import static org.apache.dubbo.common.constants.LoggerCodeConstants.PROTOCOL_FAILED_PARSE; public abstract class AbstractH2TransportListener implements H2TransportListener { @@ -66,7 +67,7 @@ public abstract class AbstractH2TransportListener implements H2TransportListener } } - // try convert upper key + // try converting upper key Object obj = convertUpperHeaderSupplier.get(); if (obj == null) { return attachments; @@ -81,7 +82,10 @@ public abstract class AbstractH2TransportListener implements H2TransportListener } } } else { - LOGGER.error(PROTOCOL_FAILED_PARSE, "", "", "Triple convertNoLowerCaseHeader error, obj is not String"); + // If convertUpperHeaderSupplier does not return String, just fail... + // Internal invocation, use INTERNAL_ERROR instead. + + LOGGER.error(INTERNAL_ERROR, "wrong internal invocation", "", "Triple convertNoLowerCaseHeader error, obj is not String"); } return attachments; }