Repository navigation
Conversation
…with newer clients * rocketMQ-5.x: skip callbacks without SendCallBackEnhanceInfo in OnSuccessInterceptor. Since rocketmq-client 5.1.4 the producer wraps every async-send callback in BackpressureSendCallBack, and the wrapped callback threw an NPE and stopped the wrapper's span, whose afterMethod then threw a second NPE (apache/skywalking#14189). * rocketMQ-client-java-5.x: intercept every PushConsumerImpl constructor taking the ClientConfiguration and the MessageListener, so push-consumer spans get their peer and mq.broker again with rocketmq-client-java 5.0.8 or later. * rocketMQ-client-java-5.x: stop rebuilding the sent message, which dropped the lite topic and the priority. Inject the span into the producer's PublishingMessageImpl copy and add the headers to the properties it sends. * Test rocketmq-client 5.5, and rocketmq-client-java 5.0, 5.1 and 5.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix the
NullPointerExceptions of async send callbacks in therocketMQ-5.xplugin (apache/skywalking#14189), and therocketMQ-client-java-5.xplugin with newer clients1.
rocketMQ-5.x: two NPEs on every successful async send with a callback (apache/skywalking#14189)Since rocketmq-client 5.1.4, all three async
DefaultMQProducerImpl#send(..., SendCallback, ...)overloads wrap the callback inDefaultMQProducerImpl$BackpressureSendCallBack, whether backpressure is enabled or not. Only the wrapper reachesMQClientAPIImpl#sendMessage, so only the wrapper gets theSendCallBackEnhanceInfo.SendCallbackInstrumentationmatches everySendCallback, so the application's callback is enhanced too, and the wrapper'sonSuccesscalls it on the same stack. ItsOnSuccessInterceptor#beforeMethodthrows an NPE before creating a span, itsafterMethodstops the wrapper's span anyway, and the wrapper'safterMethodthen throws an NPE on the empty context.OnExceptionInterceptoralready handles callbacks without the info.OnSuccessInterceptornow skipsbeforeMethod,afterMethodandhandleMethodExceptionwhen the callback has no info. The wrapper keeps the span and continues the context, and the inner callback runs inside that span, so each send gets one callback span, as it does with clients before 5.1.4. All three methods check the same field, and nothing sets it during the call, so they stay paired. Auto-batch (ProduceAccumulator) adds one more level of nesting and is handled the same way.2.
rocketMQ-client-java-5.x: push-consumer spans withoutpeersince rocketmq-client-java 5.0.8PushConsumerImplInstrumentationintercepted only the 7-argumentPushConsumerImplconstructor, which the builder calls up to 5.0.7. The builder in 5.0.8 calls an 8-argument constructor, and 5.1.0+ a 9-argument one. So theMessageListenernever got the endpoints, and consumer entry spans had nopeerormq.broker. The instrumentation now matches every constructor whose argument 0 is theClientConfigurationand argument 3 is theMessageListener.3.
rocketMQ-client-java-5.x: lite topic and priority dropped from sent messagesTo add its headers, the plugin rebuilt every message from the fields that 5.0 has, which dropped the lite topic (5.1.0+) and the priority (5.2.0+). Those messages went out as
NORMALmessages, and sends to aPRIORITYtopic failed withCurrent message type not match with topic accept message types. The send interceptors no longer change the message:PublishingMessageImplon the sending thread, inside the exit span. A constructor interceptor injects the span into that copy's dynamic field.MessageImpl#getProperties()returns a new map, whichPublishingMessageImpl#toProtobufputs into the user properties. An interceptor adds the headers to that map, for copies that carry them.No reflection is involved, and the plugin no longer copies every message body.
Tests
rocketmq-scenarioadds rocketmq-client 5.5.0. 5.5.1 has no broker image. All hook points are unchanged up to 5.5.1, and the plugin compiles against it.rocketmq-5-grpc-scenariotested only rocketmq-client-java 5.0.5. It now tests 5.0.8, 5.1.0 and 5.2.2, the latest patch of each minor, on brokers 5.3.3, 5.3.4 and 5.4.0. The proxy of broker 5.5.0 rejects a gRPC consumer whose group doesn't exist yet, and this scenario relies on auto-created groups.Locally (arm64), both scenarios pass with every new version, with the gRPC cases on brokers 5.3.2 and 5.3.4: the arm64 image of 5.4.0 lacks the RocksDB native library. With
main's plugin, the 5.0.8 case fails, because the push-consumer spans havepeer: ''and nomq.broker.I also ran a throwaway end-to-end check with rocketmq-client-java 5.2.2 and broker 5.5.0, sending a message with priority 7 to a
PRIORITYtopic:mainactualMessageType=NORMAL, acceptMessageTypes=[PRIORITY]priority=Optional[7], propertiessw8,sw8-xpriority=Optional[7], propertiessw8-xNo unit tests or scenario code are added. Fix 1 isn't covered by a scenario: the scenarios send synchronously, and the reported trace looks the same with or without the NPEs.
CHANGESlog.