Fix Grpc 1.x plugin could leak context due to gRPC cancelled (#140)
This commit is contained in:
parent
fb1983937e
commit
23c724658a
|
|
@ -35,6 +35,7 @@ Release Notes.
|
||||||
* [Breaking Change] Remove the namespace from `cross process propagation` key.
|
* [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.
|
* 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 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
|
#### Documentation
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,9 @@ public class TracingServerCallListener<REQUEST> extends ForwardingServerCallList
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCancel() {
|
public void onCancel() {
|
||||||
|
if (contextSnapshot == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_CANCEL_OPERATION_NAME);
|
final AbstractSpan span = ContextManager.createLocalSpan(operationPrefix + REQUEST_ON_CANCEL_OPERATION_NAME);
|
||||||
span.setComponent(ComponentsDefine.GRPC);
|
span.setComponent(ComponentsDefine.GRPC);
|
||||||
span.setLayer(SpanLayer.RPC_FRAMEWORK);
|
span.setLayer(SpanLayer.RPC_FRAMEWORK);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue