Blizzard / Blizzard/node-rdkafka

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

Open
#1,127 1 comment 10 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
403
PR merge metrics
No merged PRs in 30d

Description

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.

Contributor guide

Open the contributing guide

Research direction

Start at src/producer.cc near line 559 and trace how the fifth opaque argument to produce() is checked and wrapped. Verify the null case does not retain a persistent handle, then run the relevant producer tests or add a focused regression test showing that passing null does not leak.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
api, backend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
50/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.