You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "Frun1na (via GitHub)" <gi...@apache.org> on 2026/09/21 11:50:55 UTC

[I] [Bug] rmqctl silently corrupts int64 values beyond 2^53 in passthrough output [rocketmq-dashboard]

Frun1na opened a new issue, #4760:
URL: https://github.com/apache/rocketmq-dashboard/issues/4760

   ### Before Creating the Bug Report
   
   - [x] I have searched the [open issues](https://github.com/apache/rocketmq-dashboard/issues) and found no similar issue.
   
   ### What Happened
   
   `rmqctl` silently corrupts int64 values beyond 2^53 that come back from Studio. The client decodes
   the response payload into the caller's `out any` (`internal/studio/client.go`), and `encoding/json`
   represents every JSON number inside an `any` as `float64`. Any value above `Number.MAX_SAFE_INTEGER`
   loses precision before it ever reaches the output layer:
   
   ```
   server returns  "msgOffset": 9007199254740993
   rmqctl prints   "msgOffset": 9007199254740992      (table, json and yaml output alike)
   ```
   
   `types.DecodeMutationOutput` re-encodes the same decoded value to inspect it, so mutation summaries
   inherit the corrupted number as well. Nothing in `rmqctl` uses `json.Number` today.
   
   RocketMQ offsets and timestamps are the obvious int64-shaped fields; today they usually stay within
   2^53, but the JSON contract is int64 and any larger value is silently wrong rather than reported.
   
   ### Expected Behavior
   
   Numeric literals from the Studio response survive the round trip unchanged, in every output format.
   
   ### Steps to Reproduce
   
   1. Point `rmqctl` at a Studio endpoint whose payload contains an integer larger than 2^53 (a fake
      server returning `{"code":200,"data":{"items":[{"msgOffset":9007199254740993}]}}` works).
   2. Run any passthrough command, e.g. `rmqctl broker list --instance-id i1 -o json`.
   3. Observe `9007199254740992` in the output.
   
   ### Environment
   
   - RocketMQ Studio `rocketmq-studio` @ `7ce9a682`
   - `rmqctl` `internal/studio/client.go` (response decode), `internal/output` (render),
     `internal/types` (`DecodeMutationOutput` round trip)
   
   ### Are You Willing to Submit a Pull Request?
   
   Yes — #4759 fixes this.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] rmqctl silently corrupts int64 values beyond 2^53 in passthrough output [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] closed issue #4760: [Bug] rmqctl silently corrupts int64 values beyond 2^53 in passthrough output
URL: https://github.com/apache/rocketmq-dashboard/issues/4760


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] rmqctl silently corrupts int64 values beyond 2^53 in passthrough output [rocketmq-dashboard]

Posted by "RockteMQ-AI (via GitHub)" <gi...@apache.org>.
RockteMQ-AI commented on issue #4760:
URL: https://github.com/apache/rocketmq-dashboard/issues/4760#issuecomment-5760164957

   **Issue Evaluation**
   
   Category: `bug` | Status: **Confirmed**
   
   The reported issue is valid. The root cause is well-identified: `encoding/json` decodes all JSON numbers into `float64` when unmarshalling into `any`, which silently loses precision for int64 values above 2^53. This affects RocketMQ offsets and timestamps that are contractually int64.
   
   **Root Cause:** `internal/studio/client.go` decodes response payload into `out any` without using `json.Decoder.UseNumber()`, causing precision loss for large integers. `types.DecodeMutationOutput` re-encodes the already-corrupted value.
   
   **Impact:** Any Studio API response containing int64 fields (message offsets, timestamps) beyond `Number.MAX_SAFE_INTEGER` will be silently corrupted in all output formats (table, json, yaml).
   
   **Severity:** Medium — currently unlikely to trigger in production (offsets rarely exceed 2^53 today), but the JSON contract is int64 and silent corruption is unacceptable.
   
   **Fix:** PR #4759 is referenced by the author. The fix should use `json.Number` or `UseNumber()` in the decoder to preserve integer precision through the round trip.
   
   ---
   *Automated evaluation by github-manager*


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug] rmqctl silently corrupts int64 values beyond 2^53 in passthrough output [rocketmq-dashboard]

Posted by "github-actions[bot] (via GitHub)" <gi...@apache.org>.
github-actions[bot] commented on issue #4760:
URL: https://github.com/apache/rocketmq-dashboard/issues/4760#issuecomment-5881206960

   This issue has been automatically closed because there has been no activity for 7 days. If you believe this issue is still relevant, please reopen it with updated information.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org