Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA_OPTS and KAFKA_HEAP_OPTS causing java starting errors #73539

Open
GuardMoony opened this issue Oct 23, 2024 · 0 comments
Open

KAFKA_OPTS and KAFKA_HEAP_OPTS causing java starting errors #73539

GuardMoony opened this issue Oct 23, 2024 · 0 comments
Assignees
Labels
tech-issues The user has a technical issue about an application triage Triage is needed

Comments

@GuardMoony
Copy link

GuardMoony commented Oct 23, 2024

Name and Version

bitnami/kafka

What architecture are you using?

None

What steps will reproduce the bug?

  1. Create a docker compose file with KAFKA_OPTS or KAFKA_HEAP_OPTS set.

example docker-compose.yml:

services:

  kafka:
    container_name: kafka
    image: bitnami/kafka
    volumes:
      - "./kafka-persistence:/bitnami/kafka"
    environment:
      - KAFKA_CFG_NODE_ID=0
      - KAFKA_CFG_PROCESS_ROLES=controller,broker
      - KAFKA_CFG_LISTENERS=PLAINTEXT://:9092,CONTROLLER://:9093
      - KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP=CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
      - KAFKA_CFG_CONTROLLER_QUORUM_VOTERS=0@kafka:9093
      - KAFKA_CFG_CONTROLLER_LISTENER_NAMES=CONTROLLER
      - KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE=true
      - KAFKA_HEAP_OPTS='-Xmx1024m -Xms1024m'
     - KAFKA_OPTS='-javaagent:/bitnami/kafka/agents/jmx_prometheus_javaagent-1.0.1.jar=7071:/bitnami/kafka/agents/config.yml'
    expose:
      - "7071"
      - "9092"
      - "9093"
    restart: unless-stopped
  1. In case of my example:
    • Create the persistence directory.
    • Create agents directory inside the persistence directory.
    • Download the JMX exporter
    • Add a simple config.yml
      rules:
        - pattern: ".*"
      

What is the expected behavior?

For KAFKA_HEAP_OPTS: Expecting to set set heap variables for java. This is mainly to limit memory usage and garbage collection settings.

For KAFKA_OPTS: Expecting to add extra java launch parameters.

What do you see instead?

Logs:

$ docker compose up
[+] Running 1/0
 ✔ Container kafka  Created                                                                                                                                                                                               0.0s 
Attaching to kafka
kafka  | kafka 09:26:22.15 INFO  ==> 
kafka  | kafka 09:26:22.15 INFO  ==> Welcome to the Bitnami kafka container
kafka  | kafka 09:26:22.15 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
kafka  | kafka 09:26:22.15 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
kafka  | kafka 09:26:22.15 INFO  ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise
kafka  | kafka 09:26:22.15 INFO  ==> 
kafka  | kafka 09:26:22.16 INFO  ==> ** Starting Kafka setup **
kafka  | kafka 09:26:22.21 WARN  ==> Kafka has been configured with a PLAINTEXT listener, this setting is not recommended for production environments.
kafka  | kafka 09:26:22.22 INFO  ==> Initializing Kafka...
kafka  | kafka 09:26:22.23 INFO  ==> No injected configuration files found, creating default config files
kafka  | kafka 09:26:22.35 INFO  ==> Initializing KRaft storage metadata
kafka  | kafka 09:26:22.35 INFO  ==> Formatting storage directories to add metadata...
kafka  | Error: Could not find or load main class '-Xmx1024m
kafka  | Caused by: java.lang.ClassNotFoundException: '-Xmx1024m
kafka exited with code 0
$ docker compose up
[+] Running 1/0
 ✔ Container kafka  Recreated                                                                                                                                                                                             0.1s 
Attaching to kafka
kafka  | kafka 09:33:29.54 INFO  ==> 
kafka  | kafka 09:33:29.54 INFO  ==> Welcome to the Bitnami kafka container
kafka  | kafka 09:33:29.54 INFO  ==> Subscribe to project updates by watching https://github.com/bitnami/containers
kafka  | kafka 09:33:29.54 INFO  ==> Submit issues and feature requests at https://github.com/bitnami/containers/issues
kafka  | kafka 09:33:29.54 INFO  ==> Upgrade to Tanzu Application Catalog for production environments to access custom-configured and pre-packaged software components. Gain enhanced features, including Software Bill of Materials (SBOM), CVE scan result reports, and VEX documents. To learn more, visit https://bitnami.com/enterprise
kafka  | kafka 09:33:29.55 INFO  ==> 
kafka  | kafka 09:33:29.55 INFO  ==> ** Starting Kafka setup **
kafka  | kafka 09:33:29.61 WARN  ==> Kafka has been configured with a PLAINTEXT listener, this setting is not recommended for production environments.
kafka  | kafka 09:33:29.62 INFO  ==> Initializing Kafka...
kafka  | kafka 09:33:29.62 INFO  ==> No injected configuration files found, creating default config files
kafka  | kafka 09:33:29.74 INFO  ==> Initializing KRaft storage metadata
kafka  | kafka 09:33:29.75 INFO  ==> Formatting storage directories to add metadata...
kafka  | Error: Could not find or load main class '-javaagent:.bitnami.kafka.agents.jmx_prometheus_javaagent-1.0.1.jar=7071:.bitnami.kafka.agents.config.yml'
kafka  | Caused by: java.lang.ClassNotFoundException: '-javaagent:.bitnami.kafka.agents.jmx_prometheus_javaagent-1.0.1.jar=7071:.bitnami.kafka.agents.config.yml'
kafka exited with code 0

Additional information

Came across this bug when i wanted to add the jmx exporter inside the container for prometheus metrics.

@GuardMoony GuardMoony added the tech-issues The user has a technical issue about an application label Oct 23, 2024
@github-actions github-actions bot added the triage Triage is needed label Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
tech-issues The user has a technical issue about an application triage Triage is needed
Projects
None yet
Development

No branches or pull requests

2 participants