From 2676590daefb9229d38b4b9110935f04781f19be Mon Sep 17 00:00:00 2001 From: Sean Yang Date: Mon, 18 Nov 2024 23:28:21 +0800 Subject: [PATCH] Fix dead loop in onNext --- .../http12/AbstractServerHttpChannelObserver.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java index 1c7cf43cc47..c1edd74d504 100644 --- a/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java +++ b/dubbo-remoting/dubbo-remoting-http12/src/main/java/org/apache/dubbo/remoting/http12/AbstractServerHttpChannelObserver.java @@ -96,7 +96,14 @@ public final void onNext(Object data) { doOnNext(data); } catch (Throwable t) { LOGGER.warn(INTERNAL_ERROR, "", "", "Error while doOnNext", t); - onError(t); + Throwable throwable = t; + try { + doOnError(throwable); + } catch (Throwable t1) { + LOGGER.warn(INTERNAL_ERROR, "", "", "Error while doOnError, original error: " + throwable, t1); + throwable = t1; + } + onCompleted(throwable); } } @@ -105,7 +112,6 @@ public final void onError(Throwable throwable) { if (closed) { return; } - try { throwable = customizeError(throwable); if (throwable == null) { @@ -122,7 +128,6 @@ public final void onError(Throwable throwable) { LOGGER.warn(INTERNAL_ERROR, "", "", "Error while doOnError, original error: " + throwable, t); throwable = t; } - onCompleted(throwable); }