markap14 commented on code in PR #10908:
URL: https://github.com/apache/nifi/pull/10908#discussion_r2920754848
##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/ConsumeKafka.java:
##########
@@ -425,77 +427,85 @@ public void onTrigger(final ProcessContext context, final
ProcessSession session
final OffsetTracker offsetTracker = new OffsetTracker();
boolean recordsReceived = false;
- while (System.currentTimeMillis() < stopTime) {
- try {
- final Duration maxWaitDuration = Duration.ofMillis(stopTime -
System.currentTimeMillis());
- if (maxWaitDuration.toMillis() <= 0) {
- break;
- }
+ rebalanceSessionHolder.session = session;
+ rebalanceSessionHolder.offsetTracker = offsetTracker;
Review Comment:
This is not thread-safe. If we have multiple Concurrent Tasks, they will be
stepping on each other. ProcessSession is not thread-safe in and of itself.
As-is, the call to ProcessSession.commit in `createRebalanceCallback` may be
called from the wrong thread. Additionally, we are not setting the session &
offset tracker atomically.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]