You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by GitBox <gi...@apache.org> on 2021/10/14 06:57:43 UTC

[GitHub] [skywalking] youzhagui2006 opened a new issue #7923: [Bug] spring cloud gateway use webclient

youzhagui2006 opened a new issue #7923:
URL: https://github.com/apache/skywalking/issues/7923


   ### Search before asking
   
   - [X] I had searched in the [issues](https://github.com/apache/skywalking/issues?q=is%3Aissue) and found no similar issues.
   
   
   ### Apache SkyWalking Component
   
   Java Agent (apache/skywalking-java)
   
   ### What happened
   
   when request gateway , skywalking-api.log  print the error,as follow!
   reactor.netty.http.client.HttpClientFinalizer] before method[send] intercept failure 
   java.lang.NullPointerException
   	at org.apache.skywalking.apm.agent.core.context.ContextManager.activeSpan(ContextManager.java:176)
   	at org.apache.skywalking.apm.plugin.spring.cloud.gateway.v21x.HttpClientFinalizerSendInterceptor.beforeMethod(HttpClientFinalizerSendInterceptor.java:45)
   	at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInterWithOverrideArgs.intercept(InstMethodsInterWithOverrideArgs.java:75)
   	at reactor.netty.http.client.HttpClientFinalizer.send(HttpClientFinalizer.java)
   	at reactor.netty.http.client.HttpClientFinalizer.send(HttpClientFinalizer.java:45)
   	at org.springframework.http.client.reactive.ReactorClientHttpConnector.connect(ReactorClientHttpConnector.java:111)
   	at org.springframework.web.reactive.function.client.ExchangeFunctions$DefaultExchangeFunction.exchange$original$8xEWJLsY(ExchangeFunctions.java:104)
   	at org.springframework.web.reactive.function.client.ExchangeFunctions$DefaultExchangeFunction.exchange$original$8xEWJLsY$accessor$HCrckmu4(ExchangeFunctions.java)
   	at org.springframework.web.reactive.function.client.ExchangeFunctions$DefaultExchangeFunction$auxiliary$GCuBHoVu.call(Unknown Source)
   	at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.v2.InstMethodsInterV2.intercept(InstMethodsInterV2.java:67)
   	at org.springframework.web.reactive.function.client.ExchangeFunctions$DefaultExchangeFunction.exchange(ExchangeFunctions.java)
   	at org.springframework.cloud.sleuth.instrument.web.client.TraceExchangeFilterFunction$MonoWebClientTrace.subscribe(TraceWebClientBeanPostProcessor.java:193)
   	at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
   	at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:52)
   	at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:64)
   	at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
   	at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
   	at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1812)
   	at reactor.core.publisher.MonoFlatMap$FlatMapInner.onNext(MonoFlatMap.java:241)
   	at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:385)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
   	at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
   	at reactor.core.publisher.FluxContextStart$ContextStartSubscriber.onNext(FluxContextStart.java:96)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
   	at reactor.core.publisher.FluxMapFuseable$MapFuseableSubscriber.onNext(FluxMapFuseable.java:121)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
   	at reactor.core.publisher.FluxFilterFuseable$FilterFuseableSubscriber.onNext(FluxFilterFuseable.java:112)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onNext(ScopePassingSpanSubscriber.java:90)
   	at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1812)
   	at reactor.core.publisher.MonoCollect$CollectSubscriber.onComplete(MonoCollect.java:152)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:104)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:104)
   	at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onComplete(FluxOnAssembly.java:395)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:104)
   	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:104)
   	at reactor.core.publisher.FluxPeek$PeekSubscriber.onComplete(FluxPeek.java:252)
   	at org.springframework.cloud.sleuth.instrument.reactor.ScopePassingSpanSubscriber.onComplete(ScopePassingSpanSubscriber.java:104)
   	at reactor.core.publisher.FluxMap$MapSubscriber.onComplete(FluxMap.java:136)
   	at reactor.netty.channel.FluxReceive.onInboundComplete(FluxReceive.java:383)
   	at reactor.netty.channel.ChannelOperations.onInboundComplete(ChannelOperations.java:373)
   	at reactor.netty.channel.ChannelOperations.terminate(ChannelOperations.java:429)
   	at reactor.netty.http.client.HttpClientOperations.onInboundNext(HttpClientOperations.java:655)
   	at reactor.netty.channel.ChannelOperationsHandler.channelRead(ChannelOperationsHandler.java:96)
   	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
   	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
   	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
   	at io.netty.channel.CombinedChannelDuplexHandler$DelegatingChannelHandlerContext.fireChannelRead(CombinedChannelDuplexHandler.java:436)
   	at io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:324)
   	at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:296)
   	at io.netty.channel.CombinedChannelDuplexHandler.channelRead(CombinedChannelDuplexHandler.java:251)
   	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
   	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
   	at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
   	at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
   	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
   	at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
   	at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
   	at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
   	at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:719)
   	at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:655)
   	at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:581)
   	at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:493)
   	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
   	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
   	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
   	at java.lang.Thread.run(Thread.java:748)
   
   ### What you expected to happen
   
   one request has tow traceId
   
   
   ### How to reproduce
   
   my code example
   package com.nlp.cloud.gw.core.filter;
   
   import org.slf4j.Logger;
   import org.slf4j.LoggerFactory;
   import org.springframework.cloud.gateway.filter.GatewayFilterChain;
   import org.springframework.cloud.gateway.filter.GlobalFilter;
   import org.springframework.core.Ordered;
   import org.springframework.web.reactive.function.client.WebClient;
   import org.springframework.web.server.ServerWebExchange;
   import reactor.core.publisher.Mono;
   
   public class RequestLogFilter implements GlobalFilter, Ordered {
       protected static Logger log = LoggerFactory.getLogger(RequestLogFilter.class);
       @Override
       public Mono<Void> filter(ServerWebExchange exchange, GatewayFilterChain chain) {
           Mono<String> response = WebClient
                   .create()
                   .get()
                   .uri("")
                   .retrieve()
                   .bodyToMono(String.class);
           response.subscribe();
           return chain.filter(exchange);
       }
       @Override
       public int getOrder() {
           return Ordered.HIGHEST_PRECEDENCE;
       }
   }
   
   
   ### Anything else
   
   _No response_
   
   ### Are you willing to submit PR?
   
   - [X] Yes I am willing to submit a PR!
   
   ### Code of Conduct
   
   - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient broken trace

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7923:
URL: https://github.com/apache/skywalking/issues/7923#issuecomment-961541719


   No update.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng closed issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient broken trace

Posted by GitBox <gi...@apache.org>.
wu-sheng closed issue #7923:
URL: https://github.com/apache/skywalking/issues/7923


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng closed issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient broken trace

Posted by GitBox <gi...@apache.org>.
wu-sheng closed issue #7923:
URL: https://github.com/apache/skywalking/issues/7923


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient broken trace

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7923:
URL: https://github.com/apache/skywalking/issues/7923#issuecomment-961541719


   No update.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7923:
URL: https://github.com/apache/skywalking/issues/7923#issuecomment-943070785


   As I has explained, this issue will be kept open only. If there is anyone wants to help, we are welcome.
   Plugins are contributed from global contributors, the core team doesn't know most of them. 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wallezhang commented on issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient broken trace

Posted by GitBox <gi...@apache.org>.
wallezhang commented on issue #7923:
URL: https://github.com/apache/skywalking/issues/7923#issuecomment-946328181


   @youzhagui2006 Hi, I can't reproduce the bug. Could you upload a complete demo that can reproduce this bug?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng closed issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient broken trace

Posted by GitBox <gi...@apache.org>.
wu-sheng closed issue #7923:
URL: https://github.com/apache/skywalking/issues/7923


   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [skywalking] wu-sheng commented on issue #7923: [Bug] skywalking8.7.0 spring cloud gateway 2.1 use webclient broken trace

Posted by GitBox <gi...@apache.org>.
wu-sheng commented on issue #7923:
URL: https://github.com/apache/skywalking/issues/7923#issuecomment-961541719


   No update.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@skywalking.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org