You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by "unbridled-41 (via GitHub)" <gi...@apache.org> on 2026/10/03 01:39:53 UTC

[PR] fix(dlq): truncate oversized message bodies in the Excel export [rocketmq-dashboard]

unbridled-41 opened a new pull request, #5424:
URL: https://github.com/apache/rocketmq-dashboard/pull/5424

   ## Problem / Evidence
   
   `GET /api/dlq/export-excel` returns HTTP 502 for the entire group when any single dead-letter message has a decoded body longer than 32,767 characters, instead of producing a workbook.
   
   - `instance/dlq/DLQMessageExcelRow.java:70` copied the full body into the `Body` cell.
   - `provider/apache/RocketMQDLQProvider.java:404` puts the whole decoded body into the VO (`toUtf8Text(message.getBody())`), and `:357-366` wraps any write failure as `throw new BusinessException(502, "Failed to export DLQ messages as Excel: ...")`.
   - EasyExcel 3.3.4 → POI 4.1.2 rejects cell text beyond `SpreadsheetVersion.getMaxTextLength()`. Reproduced in a unit test:
   
   ```
   WARN  RocketMQDLQProvider -- Failed to build Excel export for group group-a:
         The maximum length of cell contents (text) is 32767 characters
   BusinessException: Failed to export DLQ messages as Excel: The maximum length of cell contents (text) is 32767 characters
   ```
   
   RocketMQ allows message bodies far larger than one spreadsheet cell, so a single unlucky dead letter makes the whole group's export unusable.
   
   ## Root cause / Fix
   
   The `Body` cell was written unbounded while every other cell is naturally short. Clamp it to the spreadsheet limit with a visible `...[truncated]` marker, backing off one character when the cut would land between a surrogate pair so the cell never contains an unpaired half.
   
   ## Priority & scoring
   
   PRIORITY 57 = 影响 20 (the export of a whole group fails, and the operator cannot tell which message caused it) + 波及 6 (DLQ Excel export endpoint) + 可复现 20 (deterministic for a body over 32,767 chars) + 维护价值 11 (restores the documented export contract).
   
   FIX_CONFIDENCE 92: bounded clamp in one row mapper, with the exact POI failure reproduced before the fix and the neighbouring row asserted intact after.
   
   ## Tests
   
   ```
   cd server && mvn -o test -Dtest=RocketMQDLQProviderTest
   ```
   
   - Red before the fix: the new test errors with `BusinessException: Failed to export DLQ messages as Excel: The maximum length of cell contents (text) is 32767 characters`.
   - Green after: `Tests run: 46, Failures: 0, Errors: 0, Skipped: 0` (also `-Dtest='org.apache.rocketmq.studio.instance.dlq.*Test'` → 44 passed).
   - The regression test drives a real EasyExcel workbook read back and asserts the oversized cell is clamped, ends with the marker, contains no unpaired surrogate, and that the following row still exports its body intact.
   - `mvn -o checkstyle:check` passes.
   
   ## Risk
   
   Low. Only the `Body` cell content changes, and only when it exceeds a limit that previously aborted the request. Exported bodies that fit are byte-identical.


-- 
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: [PR] fix(dlq): truncate oversized message bodies in the Excel export [rocketmq-dashboard]

Posted by "unbridled-41 (via GitHub)" <gi...@apache.org>.
unbridled-41 commented on PR #5424:
URL: https://github.com/apache/rocketmq-dashboard/pull/5424#issuecomment-5965544129

   ### CI status of this PR
   
   `Backend Tests (Java 21)` — **pass**; the change-specific command and its result are in the Tests section of the description.
   
   The three remaining red jobs are red for every branch, including `rocketmq-studio` itself, with the same logs:
   
   - `Backend Build (Java 21)` — fails inside the `binary-license-gate` antrun step (`exec returned: 1`); it also fails on a docs-only PR of this batch, and is addressed independently by #5341.
   - `Frontend Build (Node 20)` — fails after a successful build in the license manifest check (`license gate: build artifact verification failed: assets/index-<hash>.js`); it fails identically on a docs-only PR of this batch (run 37088829422) and on trunk, and is addressed independently by #5346.
   - `Frontend Docker Build` — depends on the frontend build above.
   
   This diff touches `server/`, so none of the three can be caused by it.
   


-- 
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: [PR] fix(dlq): truncate oversized message bodies in the Excel export [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins commented on PR #5424:
URL: https://github.com/apache/rocketmq-dashboard/pull/5424#issuecomment-6078485707

   Merged as part of #5448 (squashed into `rocketmq-studio` as 4781e3ee4).
   
   It stopped the DLQ Excel export from losing message bodies to POI's 32767-character cell limit (and from cutting a surrogate pair in half), abbreviating on a character boundary instead.
   
   We are consolidating same-author changes that touch the same files into one commit rather than landing several near-identical ones on the trunk; your commit is preserved as the author of the corresponding part of that change. Closing - no action needed, and thanks for the fix.


-- 
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: [PR] fix(dlq): truncate oversized message bodies in the Excel export [rocketmq-dashboard]

Posted by "lizhimins (via GitHub)" <gi...@apache.org>.
lizhimins closed pull request #5424: fix(dlq): truncate oversized message bodies in the Excel export
URL: https://github.com/apache/rocketmq-dashboard/pull/5424


-- 
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