Skip to content

CQs: fix a read_rom_q_tail/4 crash when tune_read/2 rounds past end_seq_id (backport #15595)#15620

Merged
michaelklishin merged 5 commits intov4.2.xfrom
mergify/bp/v4.2.x/pr-15595
Mar 3, 2026
Merged

CQs: fix a read_rom_q_tail/4 crash when tune_read/2 rounds past end_seq_id (backport #15595)#15620
michaelklishin merged 5 commits intov4.2.xfrom
mergify/bp/v4.2.x/pr-15595

Conversation

@mergify
Copy link
Copy Markdown

@mergify mergify bot commented Mar 3, 2026

tune_read/2 may round up the read range to a segment boundary, advancing start_seq_id past end_seq_id. Guard against this in both branches of read_from_q_tail;4.

This scenario was detected by a sporadic failure in classic_queue_prop_SUITE which now passes 200 times in a row.


This is an automatic backport of pull request #15595 done by Mergify.

During recovery when all transient messages are dropped
the code could crash because the #q_tail{} resulting
from reading messages into memory had a start seqid
higher than the end seqid, due to tune_read rounding
up the read range past segment boundaries and the code
not noticing it went above the end seqid.

(cherry picked from commit ccb1e48)

# Conflicts:
#	deps/rabbit/src/rabbit_variable_queue.erl
(cherry picked from commit f43a079)
(cherry picked from commit 63c965e)
@mergify
Copy link
Copy Markdown
Author

mergify bot commented Mar 3, 2026

Cherry-pick of ccb1e48 has failed:

On branch mergify/bp/v4.2.x/pr-15595
Your branch is up to date with 'origin/v4.2.x'.

You are currently cherry-picking commit ccb1e4859.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   deps/rabbit/test/classic_queue_prop_SUITE.erl

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   deps/rabbit/src/rabbit_variable_queue.erl

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

Note that on v4.2.x, the general problem is still
present but under different conditions, namely
DeltaSeqId1 =:= DeltaSeqIdEnd.

Unlike in `main`,
DeltaSeqIdEnd cannot read past DeltaSeqId.
@michaelklishin
Copy link
Copy Markdown
Collaborator

The v4.2.x version is meaningfully different from its main counterpart: the problem is even less likely to manifest itself but with DeltaSeqId1 =:= DeltaSeqIdEnd, a comparable exception can happen, causing a CQ restart and a scary looking message.

@michaelklishin michaelklishin added this to the 4.2.5 milestone Mar 3, 2026
@michaelklishin michaelklishin merged commit 1194f75 into v4.2.x Mar 3, 2026
584 of 585 checks passed
@michaelklishin michaelklishin deleted the mergify/bp/v4.2.x/pr-15595 branch March 3, 2026 21:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant