apache / apache/shenyu

[BUG] Kafka producer sends a junk record into the log topic on every init

Open Beginner friendly
#6,560 1 comment 0 reactions 0 assignees View on GitHub
plugin: logging-elasticSearch priority: medium type: bug
Dominant language
Java
Stars
8.8k
Forks
3.1k
Avg merge
7d 1h
Merged PRs (30d)
85

Description

## Description
During `initClient0`, a `ProducerRecord` is constructed via the 3-arg `(topic, key, value)` constructor with **both key and value set to `StringSerializer.class.getName()`**, then `producer.send(record)` is invoked. This is the serializer class-name string, not a log payload. Each per-selector client created in multi-client mode sends one such record into the configured log topic.

## Location
```
shenyu-plugin-logging-kafka/.../client/KafkaLogCollectClient.java:99-102
```

## Impact
Downstream consumers expecting JSON `ShenyuRequestLog` records hit a parse failure on these junk messages; the log topic is polluted on every config refresh.

## Suggested fix
Remove the warm-up `send` entirely (or use `producer.partitionsFor(topic)` to validate connectivity without producing a data record).

## Related existing issue(s)
None

_Identified during the 2026-08-02 audit; full list in [`docs/issue-candidates-2026-08-02.md`](docs/issue-candidates-2026-08-02.md)._

Contributor guide

No contributing guide indexed for this repository

Research direction

Open shenyu-plugin-logging-kafka/.../client/KafkaLogCollectClient.java around lines 99-102 and trace the warm-up logic in initClient0. Confirm that client initialization no longer produces a serializer-class-name record, while configured log messages remain valid ShenyuRequestLog records and the log topic is not polluted on refresh.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, kafka
Domain
backend, observability-sre
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.