Repository navigation
tentacle: neorados/cls/log: fix infinite trim loop on empty data log shards - #69113
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]>
(cherry picked from commit fe1a5a5)
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]> (cherry picked from commit e1a6ed1)
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]> (cherry picked from commit 7bb4a76)
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]> (cherry picked from commit 4c5f4df)
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]> (cherry picked from commit a323441)
… > 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]>
(cherry picked from commit 61b6d72)
|
@anrao19 Please add this to a tentacle batch when you get a chance so it will be ready to merge when the window opens. |
Sure @adamemerson |
|
pr testing completed and approved by @ivancich , more details : https://tracker.ceph.com/issues/76985. |
|
@adamemerson Are you able to provide a review for this PR? It passed QA. |
|
jenkins test make check |
|
I'm also keen to see this make it into tentacle. |
@batrick would you please merge this? |
backport tracker: https://tracker.ceph.com/issues/76818
backport of #68874
parent tracker: https://tracker.ceph.com/issues/76563
this backport was staged using ceph-backport.sh version 16.0.0.6848
find the latest version at https://github.com/ceph/ceph/blob/main/src/script/ceph-backport.sh