未验证 提交 0036ea67 编写于 作者: L Leon Yang 提交者: GitHub

FIX: NPE when thrift field is nested (#6909)

* FIX: NPE when field is nested

* ADD: change.md
Co-authored-by: NYang Xin <yangxinbj@fenbi.com>
上级 004eef65
...@@ -23,6 +23,7 @@ Release Notes. ...@@ -23,6 +23,7 @@ Release Notes.
* Add an optional agent plugin to support mybatis. * Add an optional agent plugin to support mybatis.
* Add `spring-cloud-gateway-3.x` optional plugin. * Add `spring-cloud-gateway-3.x` optional plugin.
* Add `okhttp-4.x` plugin. * Add `okhttp-4.x` plugin.
* Fix NPE when thrift field is nested in plugin `thrift`
#### OAP-Backend #### OAP-Backend
* BugFix: filter invalid Envoy access logs whose socket address is empty. * BugFix: filter invalid Envoy access logs whose socket address is empty.
......
...@@ -85,25 +85,29 @@ public class ServerInProtocolWrapper extends AbstractProtocolWrapper { ...@@ -85,25 +85,29 @@ public class ServerInProtocolWrapper extends AbstractProtocolWrapper {
} }
return readFieldBegin(); return readFieldBegin();
} }
if (field.type == TType.STOP) {
Boolean haveCreatedSpan = return field;
(Boolean) ContextManager.getRuntimeContext().get(HAVE_CREATED_SPAN); }
if (haveCreatedSpan != null && !haveCreatedSpan) {
try { @Override
AbstractSpan span = ContextManager.createEntrySpan( public void readMessageEnd() throws TException {
context.getOperatorName(), createContextCarrier(null)); super.readMessageEnd();
span.start(context.startTime); Boolean haveCreatedSpan =
span.tag(TAG_ARGS, context.getArguments()); (Boolean) ContextManager.getRuntimeContext().get(HAVE_CREATED_SPAN);
span.setComponent(ComponentsDefine.THRIFT_SERVER); if (haveCreatedSpan != null && !haveCreatedSpan) {
SpanLayer.asRPCFramework(span); try {
} catch (Throwable throwable) { AbstractSpan span = ContextManager.createEntrySpan(
LOGGER.error("Failed to create EntrySpan.", throwable); context.getOperatorName(), createContextCarrier(null));
} finally { span.start(context.startTime);
context = null; span.tag(TAG_ARGS, context.getArguments());
} span.setComponent(ComponentsDefine.THRIFT_SERVER);
SpanLayer.asRPCFramework(span);
} catch (Throwable throwable) {
LOGGER.error("Failed to create EntrySpan.", throwable);
} finally {
context = null;
} }
} }
return field;
} }
private ContextCarrier createContextCarrier(Map<String, String> header) { private ContextCarrier createContextCarrier(Map<String, String> header) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册