Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
None
-
None
-
None
Description
I have created a simple java `HelloWorld` app. When I start Kafka and then the app, all messages are logged to Kafka and my app finishes with exit code 0.
However, if I start the app without starting Kafka, it seems that Kafka Appender prevents the app from terminating. It tries to send all logged messages. The termination time depends on the number of logged messages. Each messages adds an extra one minute delay. So if one message has been logged, there is one minutes delay. It is two minutes for two messages and so on.
I found out that if I stop the Kafka appender manually, the app terminates without any delays.
public class HelloWorld { private static final Logger logger = LogManager.getLogger(HelloWorld.class); public static void main(String[] args) throws InterruptedException { logger.info("test1"); logger.error("test2"); LoggerContext context = (LoggerContext) LogManager.getContext(false); KafkaAppender kafkaAppender = context.getConfiguration().getAppender("Kafka"); kafkaAppender.stop(); LogManager.shutdown(); } }
The one minutes delay (per message) is configured by max.block.ms. The parameter syncSend seems to have no affect.
It is important for us that the app runs and terminates without any delays, even if some messages were lost.
I tried to debug it and found out where it hangs, see
Attachments
Attachments
Issue Links
- is caused by
-
KAFKA-3539 KafkaProducer.send() may block even though it returns the Future
- In Progress
-
KAFKA-6705 producer.send() should not block due to metadata not available
- Resolved