apache / apache/rocketmq

Avoid logging raw MessageExt bodies in LocalMessageService

Open
#10,730 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
22.6k
Forks
12k
Avg merge
3d 1h
Merged PRs (30d)
27

Description

## Problem

`LocalMessageService.popMessage` logs a full `MessageExt` when POP offset metadata is inconsistent:

```java
log.warn("Queue offset [{}] of msg is strange, not equal to the stored in msg, {}", msgQueueOffset, messageExt);
```

`MessageExt.toString()` delegates to `Message.toString()`, which prints `Arrays.toString(body)`. This warning can expose message payload bytes in proxy logs.

## Scope

Track 2 / Proxy runtime diagnostics hardening. This should only change log content, not POP offset handling behavior.

## Expected behavior

- Do not log raw `MessageExt` in `LocalMessageService`.
- Keep useful diagnostics such as topic, msgId, queueId, queueOffset, body size, and property keys.
- Add targeted test coverage for the summary helper.

## Evidence

- `proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java` logs `messageExt` directly.
- `common/src/main/java/org/apache/rocketmq/common/message/Message.java#toString` includes `Arrays.toString(body)`.

Contributor guide

Open the contributing guide

Research direction

Read proxy/src/main/java/org/apache/rocketmq/proxy/service/message/LocalMessageService.java and inspect the warning in popMessage. Add targeted coverage for the summary helper, ensuring the warning omits raw message body bytes while retaining the requested diagnostics and leaving POP offset handling unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.