One possible reason is that the Kafka server reached the maximum heap size limit (-Xmx). Under high load, when the garbage collector runs, it can cause the server to take longer to process requests. In my case, after I increased the maximum memory limit for Kafka, the error was resolved.