Skip to content

Memory leak Springwolf, Kafka and Protobuf #1403

@amra

Description

@amra

Describe the bug
In my spring boot application I use kafka and springwolf. After changing message serialization from json to protobuf the app consumes all memory assigned to java process.

After the analysis the cause is springwolf library. Using springwolf.enabled: false confirms the issue.

The memory consumption is significant. The app normally consumes up to 600MB (200MB after GC). But now it's 4.5GB (everything assigned to java process) within 1-2 minutes. The app consumes 95-100% of CPU time.

Dependencies and versions used

  • springwolf-kafka version 1.15.0
  • springwolf-ui version 1.15.0

Code example
Configuration

springwolf:
    docket:
        base-package: com.company.msd
        info:
            title: ${spring.application.name}
            version: 1.0.0
        servers.kafka-server:
            protocol: kafka
            host: ${kafka.bootstrap.servers:localhost:29092}
    plugin:
        kafka:
            publishing:
                enabled: true

Stack trace and error logs
All data are created after ~1minute of starting the app.
Attached histogram is created using jcmd $PID GC.class_histogram, thread dumps using kill -3 $PID.
develop-class-histogram.txt is created on branch without google protobuf and it's attached for comparison purpose.

protobuf-class-histogram12.txt
threaddump-1.txt
threaddump-2.txt
threaddump-3.txt
develop-class-histogram.txt

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingwaiting for feedbackWaiting for user feedback/response

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions