Memory leak issue when running with systemd n send to kafka partition with key

Open
#423 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
go, kafka, ubuntu

Research direction

Start by examining the Kafka transport’s partition key handling and the NetFlow template processing path; the report gives no source files or tests to locate them. Reproduce with the supplied systemd and mapping configuration while replaying traffic, then check whether memory keeps growing, the Kafka partition key is correct, and template warnings stop.

Written by the indexing model from the issue text.

Description

bug

Describe the bug

  1. Memory Leak
  2. kafka partition key coming as 8�(� in kafka
  3. few warning coming => Sep 06 13:36:01 ccs-122 goflow2[3961852]: time=2025-09-06T13:36:01.765Z level=WARN msg="template error" scheme=netflow hostname="" port=8057 count=1 workers=2 blocking=false queue_size=1000000

** Configs **
Systemd config

[Unit]
Description=GoFlow2 NetFlow Collector on port 8057
After=network.target

[Service]
ExecStart=/opt/netflow/bin/goflow2
-mapping=/opt/netflow/config/mapping_8057.yaml
-transport=kafka
-transport.kafka.brokers=10.10.10.122:9093
-transport.kafka.topic=netflow
-transport.kafka.hashing
-listen=netflow://:8057
-addr=:18057

WorkingDirectory=/opt/netflow
Restart=always
RestartSec=5
User=root
Group=root
LimitNOFILE=65536

[Install]
WantedBy=multi-user.target

cat /opt/netflow/config/mapping_8057.yaml

formatter:
type: json
key:
- sampler_address

mapping:

  • output: sampler_address
    value: "$sampler_address"

To Reproduce
Steps to reproduce the behavior:

  1. Run systemd service with systemctl commands
  2. run traffic using tcp replay or actual router via some other machine
  3. check : systemd-cgtop => memory keep growing

Expected behavior
A clear and concise description of what you expected to happen.

  1. kafka patition key should be correct
  2. no memory leak

GoFlow2:

  • Version: latest: v2.2.3
  • Environment: systemd
  • OS: Ubuntu 22.04 jammy
Dominant language
Go
Stars
817
Forks
182
Avg merge
4h 18m
Merged PRs (30d)
6

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from netsampler/goflow2

All issues in netsampler/goflow2

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.