Closed blindspotbounty closed 1 year ago
Alright, I know where this is coming from. What happens here is the following:
When we have enableAutoCommit = false
, we use this method to manually commit offsets:
Which does an unretained pass of this CapturedClosure
and then waits for the func handleOffsetCommit(_:)
method to execute the closure.
The problem we are running into here is that when enableAutoCommit = true
, we don't pass a CapturedClosure
to the commit
, but our code still expects something in func handleOffsetCommit(_:)
.
Fixing this would either mean failing softly as in:
guard let opaquePointer = rd_kafka_event_opaque(event) else {
// No captured closure set (enableAutoCommit = true)
return
}
Or only expecting a value here after we checked that enableAutoCommit == true
.
Thanks for raising this issue!
Yes, exactly! I think that it is possible to remove commit event from poll with enabled_events=0x7fffffff & ~(RD_KAFKA_EVENT_OFFSET_COMMIT)
or as suggested above by softly bypassing that situation
Oh, it is even already in place, just small addition:
// KafkaConsumer
let client = try RDKafkaClient.makeClient(
type: .consumer,
configDictionary: config.dictionary,
events: [.log, .fetch] /* just add */+ config.enableAutoCommit ? [] : [.offsetCommit],
logger: logger
)
With consumer
enableAutoCommit
option library crashes with fatalError at:After some time (I guess after 5 seconds). It is possible to either disable commit events in that case with
enabled_events
, either just skip events without opaque pointer.With auto commit disabled this seems not reproducible.