Skip to content

[Go] Fix inverted hook status in Ack/DLQ methods - #1269

Merged
RongtongJin merged 1 commit into
apache:masterfrom
guyinyou:fix/inverted-ack-dlq-hook-status
Jun 12, 2026
Merged

RongtongJin merged 1 commit into
apache:masterfrom
guyinyou:fix/inverted-ack-dlq-hook-status

Conversation

@guyinyou

@guyinyou guyinyou commented Jun 11, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • The messageHookPointsStatus in three Ack/DLQ hook locations was incorrectly initialized to ERROR and set to OK when the response code was not Code_OK β€” the exact opposite of the intended behavior.
  • Fixed by initializing to OK and switching to ERROR on failure, consistent with the pattern used in changeInvisibleDuration0.
  • Affected locations:
    • push_consumer.go: Ack() and ForwardMessageToDeadLetterQueue()
    • simple_consumer.go: Ack()

The messageHookPointsStatus was incorrectly initialized to ERROR and
set to OK when the response code was not OK, which is the opposite
of the intended behavior. This affected three locations:
- push_consumer.go: Ack()
- push_consumer.go: ForwardMessageToDeadLetterQueue()
- simple_consumer.go: Ack()

Also set status to ERROR before early return on err != nil, so that
the hook always reports the correct status on failure.
@guyinyou
guyinyou force-pushed the fix/inverted-ack-dlq-hook-status branch from e0c4c7b to b46d9a9 Compare June 11, 2026 08:57
@guyinyou guyinyou changed the title Fix inverted hook status in Ack/DLQ methods [Go] Fix inverted hook status in Ack/DLQ methods Jun 11, 2026

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review by RockteMQ-AI

Summary

Fixes inverted hook status initialization in Ack/DLQ methods.

Findings

  • [Good] golang/push_consumer.go:584 β€” Initializes status to OK instead of ERROR
  • [Good] golang/push_consumer.go:586-588 β€” Sets status to ERROR on failure (correct logic)
  • [Good] golang/push_consumer.go:591 β€” Sets status to ERROR when response code is not OK
  • [Good] golang/push_consumer.go:636-646 β€” Same fix applied to ForwardMessageToDeadLetterQueue
  • [Good] golang/simple_consumer.go:452-461 β€” Same fix applied to SimpleConsumer.Ack

Analysis

The bug was a logic inversion:

  • Original: Initialize to ERROR, set to OK when response is not OK (backwards!)
  • Fixed: Initialize to OK, set to ERROR on failure (correct!)

This aligns with the pattern used in changeInvisibleDuration0 and ensures hooks receive accurate status information for monitoring and metrics.

The fix is applied consistently across all three affected methods (PushConsumer.Ack, PushConsumer.ForwardMessageToDeadLetterQueue, SimpleConsumer.Ack).

Verdict

Approve β€” Correct fix for inverted status logic.


Automated review by RockteMQ-AI

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Java] Fix missing return after retry scheduling in process_queue
Type: Bug fix (1 file, +3/-0)

Assessment

Fixes fall-through bugs where retry scheduling functions were called but execution continued, causing premature cache eviction and potential message loss.

Verdict

βœ… Critical fix preventing message loss. Companion to Go/C# fixes (#1264, #1265, #1267, #1268).


πŸ€– Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Java] Fix missing return after retry scheduling in process_queue
Type: Bug fix (1 file, +3/-0)

Assessment

Fixes fall-through bugs where retry scheduling functions were called but execution continued, causing premature cache eviction and potential message loss.

Verdict

βœ… Critical fix preventing message loss. Companion to Go/C# fixes (#1264, #1265, #1267, #1268).


πŸ€– Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Go] Fix inverted hook status in Ack/DLQ methods
Type: Bug fix (2 files, +9/-6)

Assessment

Fixes inverted messageHookPointsStatus in Ack/DLQ hook locations. Previously initialized to ERROR and set to OK on failure β€” opposite of intended behavior.

Verdict

βœ… Critical fix for hook status correctness.


πŸ€– Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Go] Fix inverted hook status in Ack/DLQ methods
Type: Bug fix (2 files, +9/-6)

Assessment

Fixes inverted messageHookPointsStatus in Ack/DLQ hook locations. Previously initialized to ERROR and set to OK on failure β€” opposite of intended behavior.

Verdict

βœ… Critical fix for hook status correctness.


πŸ€– Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Go] Fix inverted hook status in Ack/DLQ methods
Type: Bug fix (2 files, +9/-6)

Assessment

Fixes inverted messageHookPointsStatus in Ack/DLQ hook locations. Previously initialized to ERROR and set to OK on failure β€” opposite of intended behavior.

Verdict

βœ… Critical fix for hook status correctness.


πŸ€– Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Go] Fix inverted hook status in Ack/DLQ methods
Type: Bug fix (2 files, +9/-6)

Assessment

Fixes inverted messageHookPointsStatus in Ack/DLQ hook locations. Previously initialized to ERROR and set to OK on failure β€” opposite of intended behavior.

Verdict

βœ… Critical fix for hook status correctness.


πŸ€– Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Go] Fix inverted hook status in Ack/DLQ methods
Type: Bug fix (2 files, +9/-6)

Assessment

Fixes inverted messageHookPointsStatus in Ack/DLQ hook locations. Previously initialized to ERROR and set to OK on failure β€” opposite of intended behavior.

Verdict

βœ… Critical fix for hook status correctness.


πŸ€– Automated review by oss-sentinel-ai

@RockteMQ-AI RockteMQ-AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review: Approved βœ…

PR: #1269 β€” [Go] Fix inverted hook status in Ack/DLQ methods
Type: Bug fix (2 files, +9/-6)

Assessment

Fixes inverted messageHookPointsStatus in Ack/DLQ hook locations. Previously initialized to ERROR and set to OK on failure β€” opposite of intended behavior.

Verdict

βœ… Critical fix for hook status correctness.


πŸ€– Automated review by oss-sentinel-ai

@RongtongJin
RongtongJin merged commit ec29fca into apache:master Jun 12, 2026
14 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants