All Products
Search
Document Center

ApsaraMQ for Kafka:What do I do if an error is reported on a client when I use ApsaraMQ for Kafka?

Last Updated:Jun 06, 2024

If errors are reported on your client when you use ApsaraMQ for Kafka, you can troubleshoot the errors based on the returned error messages.

Solutions

The following table describes client errors and the corresponding solutions to the errors.

Error message

Programming language

Cause

Solution

TimeoutException

Java

  • Network issues

  • Client authentication (sasl.mechanisms) failure

Note

This error is reported only on ApsaraMQ for Kafka instances that are connected over the Internet.

  • Make sure that the server is correctly configured.

  • Run the telnet command to check the network connection.

  • If the network connection is normal, check whether the authentication is successful. For more information, see the following topics:

    Note

    This solution is applicable only to ApsaraMQ for Kafka instances that are connected over the Internet.

run out of brokers

Go

Authentication failed for user

Python

Leader is not available

All

This error is temporarily reported when a topic is initialized. If the error persists, the topic may not exist.

  1. Log on to the ApsaraMQ for Kafka console.

  2. Check whether the topic exists.

  3. If the topic does not exist, create a topic. For information about how to create a topic, see Step 1: Create a topic.

leader is in election

array index out of bound exception

Java

Spring Cloud uses a built-in format to parse messages.

The following solutions are provided:

  • We recommend that you use Spring Cloud Stream to send and consume messages.

  • If you use another method to send messages but use Spring Cloud Stream to consume messages, set the headerMode parameter to raw to disable message parsing. For example, you call a native Java client to send messages but use Spring Cloud Stream to consume messages. For more information, see Spring Cloud Stream Reference Guide.

No such configuration property: "sasl.mechanisms"

  • C++

  • Clients that run C++ as the core programming language, such as PHP and Node.js.

The Simple Authentication and Security Layer (SASL) and Secure Sockets Layer (SSL) modules are not installed or are not properly installed.

Run the following commands to install the SASL and SSL modules:

Note

In this example, the CentOS system is used. For other OSs, see the official websites or use a third-party search engine to search for related information.

  • SSL: sudo yum install openssl openssl-devel

  • SASL: sudo yum install cyrus-sasl{,-plain}

No worthy mechs found

No KafkaClient Entry

Java

The kafka_client_jaas.conf configuration file is not found.

Prepare the kafka_client_jaas.conf file and save the file in a directory, such as /home/admin. The logon security settings of a Java client are configured in the system. You can use one of the following methods to configure the settings:

  • Configure system variables.

    • Configure system variables by configuring the Java Virtual Machine (JVM) parameter: -Djava.security.auth.login.config=/home/admin/kafka_client_jaas.conf.

    • Configure system variables in the code: System.setProperty("java.security.auth.login.config","/home/admin/kafka_client_jaas.conf").

      Note

      If you configure system variables in the code, make sure that the code can be executed before you start the client.

  • Add the system file: Add the login.config.url.1=file:/home/admin/kafka_client_jaas.conf file to ${JAVA_HOME}/jre/lib/java.security.

For more information, see JAAS Login Configuration File.

Error sending fetch request

Java

Messages fail to be pulled by the consumer. Possible causes:

  • Network issues

  • Message pulling timeout

  1. Make sure that the server is correctly configured.

  2. Run the telnet command to check the network connection.

  3. If the network connection is normal, message pulling may time out. You can modify the following parameters to limit the number of messages that can be pulled each time.

    • fetch.max.bytes: the maximum number of bytes that are returned by the broker from a single pull.

    • max.partition.fetch.bytes: the maximum number of bytes that are returned by one partition on the broker from a single pull.

  4. Traffic may be limited on the broker. You can view the details on the Instance Details page in the ApsaraMQ for Kafka console.

    • If the instance is connected in a virtual private cloud (VPC), view the value of the Traffic Specification parameter.

    • If the instance is connected over the Internet, view the value of the Public Traffic parameter.

DisconnectException

CORRUPT_MESSAGE

All

  • Cloud storage: If your client version is 3.0 or later, the idempotence feature is automatically enabled. However, the idempotence feature is not supported by cloud storage.

  • Local storage: The message key is not specified when you run the log compaction command.

  • Cloud storage: Set the enable.idempotence parameter to false on the client.

  • Local storage: Specify the value of the message key.