Repository navigation
neorados/cls/log: fix infinite trim loop on empty data log shards - #68874
Merged
Merged
Conversation
…ite loop
Add two tests that calls trim() loop function directly (the
use_awaitable_t overloads) rather than the single-op wrapper used by
existing tests. Two test cases for the marker-based overload:
- trim_loop_all_entries_by_marker: writes 10 entries, trims all, verifies
the loop terminates and entries are gone.
- trim_loop_empty_log_by_marker: trims an empty log object, verifying
the loop terminates on immediate ENODATA.
Without the fix in the following commits, both tests hang indefinitely.
- start a vstart cluster
- run the test: [build] $ ./bin/ceph_test_neocls_log
- the test introduced in this commit stalls forever:
...
RUN ] neocls_log.trim_loop_all_entries_by_marker <-- stalls forever
Reproduces: https://tracker.ceph.com/issues/76563
Signed-off-by: Oguzhan Ozmen <[email protected]>
adamemerson
approved these changes
May 12, 2026
BBoozmen
marked this pull request as ready for review
May 12, 2026 20:32
The use_awaitable_t overload of trim() has the try-catch for ENODATA (no_message_available) inside the for(;;) loop. When cls_log_trim returns ENODATA (i.e., nothing left to trim), the exception is caught and silently swallowed execution falls through the catch block back to for(;;), retrying the trim forever. This should be a rare condition as 3 conditions should be met in a single-cluster (once configured as multisite): - a realm/period exists - zone endpoints are configured - data_log* objects exist Since in a properly setup multisite cluster, data churn is continious so hard to notice. In the case client reported, the multisite cluster was reverted back to single site so data_logs have no data all the time; hence, the issue is pronounced. This fix adds co_return inside the catch block so ENODATA exits the loop. Fixes: https://tracker.ceph.com/issues/76563 Signed-off-by: Oguzhan Ozmen <[email protected]>
This is essentially the same as previous commit. The time-based use_awaitable_t overload of trim() has the same issue as the marker-based overload: the try-catch for ENODATA is inside the for(;;) loop, so ENODATA is caught and swallowed, causing the loop to retry forever. Fixes: https://tracker.ceph.com/issues/76563 Signed-off-by: Oguzhan Ozmen <[email protected]>
RGWDataChangesFIFO::trim: handle ENODATA from empty FIFO: fifo::FIFO::trim() throws ENODATA (no_message_available) when the FIFO has no parts yet. This manifests on clusters with rgw_default_data_log_backing=fifo when trim_entries is called on a shard before any entries have been pushed. Signed-off-by: Oguzhan Ozmen <[email protected]>
Verify that DataLogBackends::trim_entries does not crash when called with max_marker() on a single-generation cluster. The bug causes upper_bound(head_gen)->second to dereference end() (SIGSEGV) because the only break condition checked be->gen_id == target_gen, which is never true when target_gen is UINT64_MAX as encoded by max_marker() and the cluster has only generation 0. Signed-off-by: Oguzhan Ozmen <[email protected]>
… > head_gen
When a cluster has no sync zones (single-zone), DataLogTrimCR passes
max_marker() as the trim marker, which encodes target_gen = UINT64_MAX
from gencursor(). In DataLogBackends::trim_entries, after trimming the
head (last) generation, the break condition
if (be->gen_id == target_gen)
is false (e.g. 0 != UINT64_MAX), so the loop attempts its increment
expression:
be = upper_bound(be->gen_id)->second
upper_bound(head_gen) returns end(), and dereferencing end()->second
causes crash.
Fix: also break when be->gen_id >= head_gen. Once we've trimmed the
head generation there are no further backends in the map, so the
upper_bound dereference in the loop increment will be skipped.
This is a general bug that affects any cluster using max_marker() as a
trim target (i.e. every single-zone deployment).
Signed-off-by: Oguzhan Ozmen <[email protected]>
BBoozmen
force-pushed
the
wip-oozmen-76563
branch
from
May 20, 2026 14:00
7e8d8fd to
61b6d72
Compare
Contributor
Author
Test Results:Test branch: https://github.com/ceph/ceph-ci/tree/wip-oozmen-trim-main-testing-2026-05-21-1934
Phillip also tested the fix using a tentacle build on the system which originally exposed this issue. |
|
yes, this change is deployed to a production cluster since the 20th of May and works without issues. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes: https://tracker.ceph.com/issues/76563
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.