wu-sheng commented on issue #3073: fixed for asyncFinishLock: avoid call finish 
more than once
URL: https://github.com/apache/skywalking/pull/3073#issuecomment-511259449
 
 
   I think I get your point of issue, but if you are talking about `#asyncStop` 
and `#stopSpan` called concurrently, then your solution is still not working, 
due to the same reason **no status change**.
   
   I think this problem only could be solved by adding a field `#running` in 
`TracingContext`, default true in the constructor. check `running==true` before 
finish condition check, set it to false if check passed. Then add your change, 
move finish into it.
   ```java
   // rename checkFinishConditions
   private void finish () {
        ... lock
        if (running) {
               if (activeSpanStack.isEmpty() && (!isRunningInAsyncMode || 
asyncSpanCounter.get() == 0)) {
                     running = false;
                     _doFinish(); // rename old finish method
               }
       }
      .... unlock
   }
   ```

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to