[
https://issues.apache.org/jira/browse/NIFI-14644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Pierre Villard updated NIFI-14644:
----------------------------------
Fix Version/s: 2.5.0
Resolution: Fixed
Status: Resolved (was: Patch Available)
> Kafka3ProducerService should clean up resources if producer creation fails
> --------------------------------------------------------------------------
>
> Key: NIFI-14644
> URL: https://issues.apache.org/jira/browse/NIFI-14644
> Project: Apache NiFi
> Issue Type: Bug
> Reporter: Peter Turcsanyi
> Assignee: Peter Turcsanyi
> Priority: Major
> Fix For: 2.5.0
>
> Time Spent: 40m
> Remaining Estimate: 0h
>
> Kafka3ProducerService performs some [initialization
> steps|https://github.com/apache/nifi/blob/8f2657bdb00bc5664f328b82c01a96b7d18f44e1/nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-shared/src/main/java/org/apache/nifi/kafka/service/producer/Kafka3ProducerService.java#L52-L64]
> onĀ KafkaProducer. If it fails (e.g. due to authentication error), the
> producer is not used anymore but there remains a background thread that
> cannot be stopped (until NiFi is restarted) and continuously logs:
> {noformat}
> 2025-06-09 15:01:39,548 INFO [kafka-producer-network-thread |
> producer-e8c21853-c5ad-454b-8464-c3c8c51bf498]
> o.apache.kafka.common.network.Selector [Producer
> clientId=producer-e8c21853-c5ad-454b-8464-c3c8c51bf498,
> transactionalId=e8c21853-c5ad-454b-8464-c3c8c51bf498] Failed authentication
> with localhost/127.0.0.1 (channelId=-1) (Authentication failed during
> authentication due to invalid credentials with SASL mechanism SCRAM-SHA-256)
> 2025-06-09 15:01:39,550 INFO [kafka-producer-network-thread |
> producer-e8c21853-c5ad-454b-8464-c3c8c51bf498]
> org.apache.kafka.clients.NetworkClient [Producer
> clientId=producer-e8c21853-c5ad-454b-8464-c3c8c51bf498,
> transactionalId=e8c21853-c5ad-454b-8464-c3c8c51bf498] Node -1 disconnected.
> 2025-06-09 15:01:39,550 ERROR [kafka-producer-network-thread |
> producer-e8c21853-c5ad-454b-8464-c3c8c51bf498]
> org.apache.kafka.clients.NetworkClient [Producer
> clientId=producer-e8c21853-c5ad-454b-8464-c3c8c51bf498,
> transactionalId=e8c21853-c5ad-454b-8464-c3c8c51bf498] Connection to node -1
> (localhost/127.0.0.1:9093) failed authentication due to: Authentication
> failed during authentication due to invalid credentials with SASL mechanism
> SCRAM-SHA-256
> 2025-06-09 15:01:39,551 WARN [kafka-producer-network-thread |
> producer-e8c21853-c5ad-454b-8464-c3c8c51bf498]
> org.apache.kafka.clients.NetworkClient [Producer
> clientId=producer-e8c21853-c5ad-454b-8464-c3c8c51bf498,
> transactionalId=e8c21853-c5ad-454b-8464-c3c8c51bf498] Bootstrap broker
> localhost:9093 (id: -1 rack: null isFenced: false) disconnected{noformat}
> The failed producer object is not returned to Kafka3ConnectionService and
> PublishKafka so these components cannot handle it. Kafka3ProducerService
> should do the clean-up after producer initialization failure by calling
> Producer.close().
> To replicate the issue: configure SCRAM authentication and provide a wrong
> password.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)