sutianbo opened a new issue, #9571:
URL: https://github.com/apache/skywalking/issues/9571

   ### 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
   
   jdk version 11
   skywalking version 8.7.0
   
   java.lang.RuntimeException: Prepare for async repeatedly. Span is already in 
async mode. at 
org.apache.skywalking.apm.agent.core.context.trace.AbstractTracingSpan.prepareForAsync(AbstractTracingSpan.java:319)
 at 
org.apache.skywalking.apm.plugin.undertow.v2x.handler.TracingHandler.handleRequest(TracingHandler.java:68)
 at 
org.apache.skywalking.apm.plugin.undertow.v2x.handler.TracingHandler.handleRequest(TracingHandler.java:84)
 at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387) at 
io.undertow.server.protocol.http.HttpReadListener.handleEventWithNoRunningRequest(HttpReadListener.java:256)
 at 
io.undertow.server.protocol.http.HttpReadListener.handleEvent(HttpReadListener.java:136)
 at 
io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:162)
 at 
io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:100)
 at 
io.undertow.server.protocol.http.HttpOpenListener.handleEvent(HttpOpenListener.java:57)
 at org.xnio.Ch
 annelListeners.invokeChannelListener(ChannelListeners.java:92) at 
org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:291) at 
org.xnio.ChannelListeners$10.handleEvent(ChannelListeners.java:286) at 
org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92) at 
org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:178) at 
org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:612) at 
org.xnio.nio.WorkerThread.run(WorkerThread.java:479)
   
   ### What you expected to happen
   
   no exception
   
   ### How to reproduce
   
   Any http Gateway request may be reproduce
   
   ### Anything else
   
   org.apache.skywalking.apm.plugin.undertow.v2x.handler.TracingHandler
   try {
               span.prepareForAsync();
               exchange.addExchangeCompleteListener(new 
ExchangeCompletionListener() {
                   @Override
                   public void exchangeEvent(HttpServerExchange 
httpServerExchange, NextListener nextListener) {
                       nextListener.proceed();
                       if (httpServerExchange.getStatusCode() >= 400) {
                           span.errorOccurred();
                           Tags.STATUS_CODE.set(span, 
Integer.toString(httpServerExchange.getStatusCode()));
                       }
                       span.asyncFinish();
                   }
               });
           } catch (Throwable e) {
               ContextManager.activeSpan().log(e);
           }
           try {
               next.handleRequest(exchange);
           } catch (Throwable e) {
               span.log(e);
           } finally {
               ContextManager.stopSpan(span);
               
ContextManager.getRuntimeContext().remove(Constants.FORWARD_REQUEST_FLAG);
           }
           
           It could be span.asyncfinish (); Is in asynchronous, not yet 
executed, but executes next. HandleRequest (exchange);
   
   ### Are you willing to submit PR?
   
   - [ ] 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: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to