Repository navigation
Recreate producer after InvalidPidMappingException - #4919
Conversation
Fixes: spring-projects#4907 Kafka clients treat InvalidPidMappingException as fatal to the current producer. DefaultKafkaProducerFactory kept that producer cached, so every later send reused the defunct instance. Remove and close the producer when the send callback receives this exception, as already done for OutOfOrderSequenceException, and verify that the next request creates a fresh producer. Signed-off-by: Jonghun Ju <85150438+wn1331@users.noreply.github.com>
|
Thanks a lot for taking this issue and for providing such a focused fix! This looks like a good fit for the problem described in #4907: the failed I had one question about transactional producers. Kafka Clients 4.x currently transitions Would it be possible to add a transactional
This is not intended as a blocker—the current change looks correct for the non-transactional scenario and the existing behavior already handles other fatal producer errors in the same way. The extra test would just give us confidence that the transactional cache and transaction lifecycle are also covered. Thanks again! |
|
Just to clarify: I am not a Spring Kafka maintainer, so please consider this as feedback from an integration user based on the production scenario behind #4907. The Spring Kafka maintainers have the final say on the design, scope, and transactional semantics of this change. Thanks again for taking the time to investigate and contribute the fix. |
Fixes: #4907 Kafka clients treat InvalidPidMappingException as fatal to the current producer. DefaultKafkaProducerFactory kept that producer cached, so every later send reused the defunct instance. Remove and close the producer when the send callback receives this exception, as already done for OutOfOrderSequenceException, and verify that the next request creates a fresh producer. Signed-off-by: Jonghun Ju <85150438+wn1331@users.noreply.github.com> (cherry picked from commit 934fdf1)
Fixes: #4907 Kafka clients treat InvalidPidMappingException as fatal to the current producer. DefaultKafkaProducerFactory kept that producer cached, so every later send reused the defunct instance. Remove and close the producer when the send callback receives this exception, as already done for OutOfOrderSequenceException, and verify that the next request creates a fresh producer. Signed-off-by: Jonghun Ju <85150438+wn1331@users.noreply.github.com> (cherry picked from commit 934fdf1)
Kafka clients treat InvalidPidMappingException as fatal to the current producer, but DefaultKafkaProducerFactory kept the failed non-transactional producer cached. Subsequent sends therefore reused the same defunct producer.
This change:
The factory does not replay failed records, so applications retain responsibility for handling the failed send and its delivery semantics.
Validation:
Fixes #4907