I know it’s been discussed before, but that conversation never really concluded 
with any reasonable explanation, so I am bringing it up again as I believe this 
is a bug that would need to be fixed in some future release.
Can someone please explain the rational for the following code in KafkaProducer:

@Override
public Future<RecordMetadata> send(ProducerRecord<K, V> record, Callback 
callback) {
        try {
            // first make sure the metadata for the topic is available
            long waitedOnMetadataMs = waitOnMetadata(record.topic(), 
this.maxBlockTimeMs);
. . .
}

By definition the method that returns Future implies that caller decides how 
long to wait for the completion via Future.get(TIMETOWAIT). In this case there 
is an explicit blocking call (waitOnMetadata), that can hang infinitely 
(regardless of the reasons) which essentially results in user’s code deadlock 
since the Future may never be returned in the first place.

Thoughts?

Oleg

Reply via email to