skywalking icon indicating copy to clipboard operation
skywalking copied to clipboard

SpringCloudGateway More than 300 spans required to create

Open DerekHQ opened this issue 7 years ago • 5 comments

Please answer these questions before submitting your issue.

  • Why do you submit this issue?
  • [ ] Question or discussion
  • [x] Bug
  • [ ] Requirement
  • [ ] Feature or performance improvement

Bug

  • Which version of SkyWalking, OS and JRE? SkyWalking version: 6.2.0 OS: Redhat4 jdk: jdk1.8 spring-boot 2.1.4-RELEASE spring-cloud-dependencies: Greenwich.SR2 spring-cloud-starter-gateway: 2.1.2.RELEASE spring-webflux: 5.1.6.RELEASE

  • Which company or project?

  • What happen? It is a sample project, only two levels, just gateway-> service for echo demo. At first, it's work fine! But, when I using Apachebench(ab) to stress testing, then agent throw exception:

-----------------agent log-----------------

WARN 2019-07-24 17:40:14:099 reactor-http-epoll-10 TracingContext : More than 300 spans required to create java.lang.RuntimeException: Shadow tracing context. Thread dump at org.apache.skywalking.apm.agent.core.context.TracingContext.isLimitMechanismWorking(TracingContext.java:543) at org.apache.skywalking.apm.agent.core.context.TracingContext.access$100(TracingContext.java:46) at org.apache.skywalking.apm.agent.core.context.TracingContext$5.doProcess(TracingContext.java:322) at org.apache.skywalking.apm.agent.core.dictionary.PossibleFound.doInCondition(PossibleFound.java:50) at org.apache.skywalking.apm.agent.core.context.TracingContext.createExitSpan(TracingContext.java:318) at org.apache.skywalking.apm.agent.core.context.ContextManager.createExitSpan(ContextManager.java:122) at org.apache.skywalking.apm.plugin.spring.cloud.gateway.v2.HttpClientOperationsSendInterceptor.beforeMethod(HttpClientOperationsSendInterceptor.java:56) at org.apache.skywalking.apm.agent.core.plugin.interceptor.enhance.InstMethodsInter.intercept(InstMethodsInter.java:82) at reactor.netty.http.client.HttpClientOperations.send(HttpClientOperations.java) at org.springframework.cloud.gateway.filter.NettyRoutingFilter.lambda$filter$2(NettyRoutingFilter.java:140) at reactor.netty.http.client.HttpClientConnect$HttpClientHandler.requestWithBody(HttpClientConnect.java:569) at reactor.netty.http.client.HttpClientConnect$HttpObserver.lambda$onStateChange$0(HttpClientConnect.java:424) at reactor.core.publisher.MonoDefer.subscribe(MonoDefer.java:44) at reactor.netty.http.client.HttpClientConnect$HttpObserver.onStateChange(HttpClientConnect.java:425) at reactor.netty.resources.PooledConnectionProvider$DisposableAcquire.onStateChange(PooledConnectionProvider.java:511) at reactor.netty.resources.PooledConnectionProvider$DisposableAcquire.run(PooledConnectionProvider.java:540) at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:163) at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:404) at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:333) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:905) at java.lang.Thread.run(Thread.java:748)

DerekHQ avatar Jul 24 '19 10:07 DerekHQ

I found that when the traffic is large, the thread will not enter the HttpClientOperationsStatusInterceptor method to exit the gateway.entrySpan, so the gateway segment cannot be finished, I also find the missing point again. If you find it, welcome to fix it.

zhaoyuguang avatar Jul 24 '19 10:07 zhaoyuguang

If you have found the cause, send a quick fix please. @zhaoyuguang

wu-sheng avatar Jul 24 '19 10:07 wu-sheng

If you have found the cause, send a quick fix please. @zhaoyuguang

no problem

zhaoyuguang avatar Jul 24 '19 10:07 zhaoyuguang

Thanks!

DerekHQ avatar Jul 24 '19 10:07 DerekHQ

@DerekHQ Check the master branch please, this should be fixed by @zhaoyuguang

wu-sheng avatar Aug 16 '19 00:08 wu-sheng