Skip to content

Frequent MSK connect timeout issue

0

Hi all,

I'm seeing frequent MSK connect timeout issue with my debezium connector, with following error

ERROR [debezium-postgres-connector-stg|task-0] Graceful stop of task debezium-postgres-connector failed. (org.apache.kafka.connect.runtime.Worker:1036)

I have the connector configured retry errors.max.retries=-1 which will retry indefinitely, and led to replication slot error.

org.postgresql.util.PSQLException: ERROR: replication slot "debezium" is active for PID 2802

My guess is the previous task still holding the slot and the new task kept restarting

Is there a way to fine tune the config to allow the connector restart gracefully without end up in this deadlock state?

asked 10 months ago268 views

1 Answer
0

The timeout issues you're experiencing with your Debezium connector for PostgreSQL appear to be related to connection management and resource handling. There are a few approaches you can take to address this:

  1. Configure connection backoff: Set the reconnect.backoff.ms parameter on the client side to control how aggressively your connector attempts to reconnect. For example, setting it to 1000 would make the client retry connections after 1 second, which can help prevent overwhelming the broker with connection attempts.

  2. Be aware of connector task limitations: The Debezium connector for MySQL is limited to using a single task, and similar limitations may apply to your PostgreSQL connector. This is an inherent constraint in some Debezium implementations.

  3. Monitor connection counts: MSK has limits on the maximum TCP connections per broker, especially when using IAM authentication (3000 connections per broker, with a rate limit of 100 per second for IAM). Exceeding these limits can cause connection failures.

  4. Address the replication slot issue: The error indicates that the replication slot is still being held by a previous process (PID 2802) while new tasks are trying to use it. This suggests that the connector isn't properly releasing resources when it fails.

To help resolve the deadlock state:

  • Consider implementing a more controlled retry strategy rather than infinite retries (errors.max.retries=-1)
  • Add a reasonable timeout configuration to ensure failed connections don't hang indefinitely
  • Monitor your connector operations through the MSK Connect console's "Operations" tab to track the state of updates and failures
  • If you're using autoscaled capacity mode, be aware that MSK Connect may override your tasks.max property

When updating your connector configuration to address these issues, you can use either the AWS Management Console or the AWS CLI with a JSON configuration file.
Sources
Troubleshoot issues in Amazon MSK Connect - Amazon Managed Streaming for Apache Kafka
Best practices for Express brokers - Amazon Managed Streaming for Apache Kafka
Troubleshoot your Amazon MSK cluster - Amazon Managed Streaming for Apache Kafka
Update a Debezium connector configuration - Amazon Managed Streaming for Apache Kafka
Update a connector - Amazon Managed Streaming for Apache Kafka

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.