Skip to content

Memory Leak (global handles) when passing null as opaque argument to produce() #1127

Open

Description

@lassic

https://github.com/Blizzard/node-rdkafka/blob/master/src/producer.cc#L559

We're seen a memory leak passing null as the opaque argument to produce.
This was subtle and tough to debug, and is quite surprising behavior.
I think the 5th argument check should also include !IsNull much like the 4th argument.
Otherwise, global (persistent) handles are leaked wrapping a null value, which doesn't make sense.

Activity

  1. changed the title [-]Memory Leak (global handles) when passing null as opaque to produce()[/-] [+]Memory Leak (global handles) when passing null as opaque argument to produce()[/+] on May 3, 2025
  2. Diamondlord commented on Nov 3, 2025

    @Diamondlord

    We also confirmed the memory leak occurs when an empty string ("") is passed for the opaque argument. This was discovered because opaque is before the headers argument we use for tracing propagation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions