Fix Grpc 1.x plugin could leak context due to gRPC cancelled (#140)

This commit is contained in:
Cool-Coding 2022-04-06 22:43:21 +08:00 committed by GitHub
parent fb1983937e
commit 23c724658a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View File

@ -35,6 +35,7 @@ Release Notes.
* [Breaking Change] Remove the namespace from `cross process propagation` key.
* Make sure the parent endpoint in tracing context from existing first ENTRY span, rather than first span only.
* Fix the bug that maybe causing memory leak and repeated traceId when use gateway-2.1.x-plugin or gateway-3.x-plugin.
* Fix Grpc 1.x plugin could leak context due to gRPC cancelled.
#### Documentation

View File

@ -73,6 +73,9 @@ public class TracingServerCallListener<REQUEST> extends ForwardingServerCallList
@Override
public void onCancel() {
if (contextSnapshot == null) {
return;
}
final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_CANCEL_OPERATION_NAME);
span.setComponent(ComponentsDefine.GRPC);
span.setLayer(SpanLayer.RPC_FRAMEWORK);