Confluent platform Kafka Connect crashed with Exit 137
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.
Confluent Platform Kafka Connect is a scalable and reliable tool designed to facilitate the streaming of data between Apache Kafka and other systems. Sometimes, however, issues arise such as Kafka Connect crashing with an Exit code 137. Below, I explain why this happens, its implications, and how to troubleshoot and fix the issue.
Understanding Exit Code 137
Exit code 137 typically signifies that the process was forcefully killed due to exhausting system resources or as a result of a system-level kill command. In technical terms, 137 usually means the process has been terminated by the SIGKILL signal. This can occur in environments managed by orchestrators like Kubernetes or Docker, where processes that exceed a set resource limit (memory or CPU) are automatically killed to preserve the overall health of the system.
Why Does Kafka Connect Crash with Exit 137?
- Memory Overuse: Kafka Connect could be trying to serialize large messages, handle a vast amount of data connectors, or perform memory-intensive operations. If the Kafka Connect worker exceeds the allocated memory, the container orchestrator or the system itself might issue a kill signal.
- Resource Misconfiguration: If the resource limits set in the orchestrator are too low compared to the demands of Kafka Connect tasks, the likelihood of encountering an Exit 137 error increases.
- Unexpected Traffic Spikes: Sudden increases in data flow can cause Kafka Connect to consume more resources than it usually does, potentially leading to a crash if the system cannot handle the spike.
Troubleshooting and Fixing Exit 137
Here are some strategies for troubleshooting and mitigating an Exit 137 crash:
- Increase Memory Limits: Adjust the memory limits for Kafka Connect tasks in your container orchestrator to better reflect the requirements of your workload.
- Optimize Data Processing: Reduce batch sizes, streamline data transformations, or optimize serializer/deserializer (SerDe) configurations. Smaller batches mean less memory and CPU usage.
- Logging and Monitoring: Implement robust logging and monitoring to detect any anomalies or sustained increase in resource usage by Kafka Connect workers which could cause crashes.
- Resource Allocation Review: Regularly review and adjust the resource quotas allocated to Kafka Connect based on the observed performance metrics.
Debugging Techniques
- Inspect Logs: Check for warnings or errors logged by Kafka Connect before the process termination. This can provide insight into what the connector was attempting to do before it ran out of resources.
- Kubernetes or Docker Insights: Utilize tools like
kubectl describeordocker statsto observe the state and resource usage of Kafka Connect containers. - JVM Profiling: Use Java profiling tools to analyze memory usage and identify memory leaks or areas of heavy memory allocation that could be optimized.
Key Points Table
| Key Aspect | Description | Troubleshooting Actions |
| Memory Overuse | Kafka Connect using more memory than allocated. | Increase memory limits or optimize data processing. |
| Resource Configuration | Improper resource settings in Kubernetes or Docker. | Adjust resource configurations based on Kafka Connect needs. |
| Traffic Spikes | Sudden and unexpected increase in data volume. | Implement auto-scaling and optimize resource allocation. |
| Monitoring Needs | Lack of proper monitoring can lead to unnoticed issues. | Improve logging and monitoring capabilities. |
Conclusion
Crashes in Kafka Connect due to Exit code 137 are typically related to resource constraints. Understanding and configuring the environment appropriately can mitigate such issues. Regular monitoring and optimization, coupled with a responsive resource management strategy, ensure that Kafka Connect can handle the workload without interruption.
Through effective management of resources, monitoring, and timely optimization of configurations, stability in Kafka Connect operations can be maintained, enhancing the robustness and reliability of data streaming architectures. By addressing these critical factors, businesses can harness the full capabilities of Kafka Connect, ensuring a smooth and efficient data integration process.
Related reading
- Confluent Platform Schema Registry Subjects
- Confluent Schema Registry Persistence
- Confluent.Kafka.KafkaException Broker Specified group generation id is not valid
- Confluent's Kafka REST Proxy vs Kafka Client
- Confluent Replicator Failed to Reconfigure Connectors Task?
- Confusing error message from git
- Confused about Kafka exactly-once semantics
- Confused about the consistency guarantee of zookeeper (Sequential vs Eventual Consistency)

System Design Fundamentals
Build a strong foundation in designing scalable, reliable distributed systems.
View the courseTrack what you have practised
A free account saves your progress, solutions and study plan across every problem on Codemia.
System Design practice on Codemia
Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.