Fix rm-data waiting forever when PGs go inactive during deletion #203

Open
koolkhel wants to merge 2 commits from koolkhel/vitastor:delete-wait-up-timer into master
Contributor

Description

An operation with OSD_OP_WAIT_UP_TIMEOUT that finds its PG inactive gets a deadline (wait_up_until), but in continue_rw() the retry timer is armed only for parts retried after a failure (PART_RETRY). An operation that first found its PG already inactive was left without a timer, so its deadline was checked only when something else woke the client, and it waited for an unrelated event instead of failing after client_wait_up_timeout.

rm-data hit this when OSDs died during deletion: the deletes in flight at that moment timed out after client_wait_up_timeout (Failed to remove object ... (retval=-110), one per PG), and the following deletes of the same PGs waited forever. The change arms the retry timer for client_wait_up_timeout where wait_up_until is set, and re-arms it for the remaining time while the operation still waits: reset_retry_timer() keeps a shorter timer that is already set (in rm-data, the retries of the deletes that were in flight), and after that one fires nothing else would wake the waiting operation before its deadline.

rm-data also stops sending deletes to a PG after one of them times out, and adds the PG to the inactive PG list, so it doesn't wait client_wait_up_timeout again for each remaining object of the PG (with the timer alone, a PG with many objects would take objects / iodepth * client_wait_up_timeout). Such a PG is reported in the existing "deletion is not complete: PG ..." line and in inactive_pgs of the JSON output; the line's "Failed to list some PGs" prefix is kept as is, so nothing parsing it changes.

This doesn't add a time limit to EIO retries: only operations that already carry OSD_OP_WAIT_UP_TIMEOUT (rm-data and merge) are affected, and only while their PG is inactive.

Independent of #201 (the same kind of missing timer, in PG listing).

Found: seen in a run — image removal (vitastor-cli rm, which runs rm-data) hung on a test cluster after 2 of 5 OSDs were killed with SIGKILL during deletion (one timed out delete per PG, then no progress); reproduced in 2 of 2 runs with --iodepth 1 --parallel_osds 1.

Tested: test_cluster_client (new test_wait_up_timeout_inactive_pg, with a second delete that starts waiting 0.5 s after the first, fails without the client change and also without the re-arm, passes with it, and drives the timer by the real time that passed, so a stall of the test can't fail it); image removal with 2 of 5 OSDs killed during deletion on a 5-OSD cluster in containers, replicated pool 3/2, 32 PGs: before — hung (killed after 120 s), after — exits with an error and the PGs left undeleted named, 18 s after the kill.

Contributor Name

Yury Luneff (MIND Software LLC, https://mindsw.io)

CLA

### Description An operation with `OSD_OP_WAIT_UP_TIMEOUT` that finds its PG inactive gets a deadline (`wait_up_until`), but in `continue_rw()` the retry timer is armed only for parts retried after a failure (`PART_RETRY`). An operation that first found its PG already inactive was left without a timer, so its deadline was checked only when something else woke the client, and it waited for an unrelated event instead of failing after `client_wait_up_timeout`. rm-data hit this when OSDs died during deletion: the deletes in flight at that moment timed out after `client_wait_up_timeout` (`Failed to remove object ... (retval=-110)`, one per PG), and the following deletes of the same PGs waited forever. The change arms the retry timer for `client_wait_up_timeout` where `wait_up_until` is set, and re-arms it for the remaining time while the operation still waits: `reset_retry_timer()` keeps a shorter timer that is already set (in rm-data, the retries of the deletes that were in flight), and after that one fires nothing else would wake the waiting operation before its deadline. rm-data also stops sending deletes to a PG after one of them times out, and adds the PG to the inactive PG list, so it doesn't wait `client_wait_up_timeout` again for each remaining object of the PG (with the timer alone, a PG with many objects would take `objects / iodepth * client_wait_up_timeout`). Such a PG is reported in the existing "deletion is not complete: PG ..." line and in `inactive_pgs` of the JSON output; the line's "Failed to list some PGs" prefix is kept as is, so nothing parsing it changes. This doesn't add a time limit to EIO retries: only operations that already carry `OSD_OP_WAIT_UP_TIMEOUT` (rm-data and merge) are affected, and only while their PG is inactive. Independent of https://git.yourcmc.ru/vitalif/vitastor/pulls/201 (the same kind of missing timer, in PG listing). Found: seen in a run — image removal (`vitastor-cli rm`, which runs rm-data) hung on a test cluster after 2 of 5 OSDs were killed with SIGKILL during deletion (one timed out delete per PG, then no progress); reproduced in 2 of 2 runs with `--iodepth 1 --parallel_osds 1`. Tested: test_cluster_client (new `test_wait_up_timeout_inactive_pg`, with a second delete that starts waiting 0.5 s after the first, fails without the client change and also without the re-arm, passes with it, and drives the timer by the real time that passed, so a stall of the test can't fail it); image removal with 2 of 5 OSDs killed during deletion on a 5-OSD cluster in containers, replicated pool 3/2, 32 PGs: before — hung (killed after 120 s), after — exits with an error and the PGs left undeleted named, 18 s after the kill. ### Contributor Name Yury Luneff (MIND Software LLC, https://mindsw.io) ### CLA - [x] I accept Vitastor CLA agreement: https://git.yourcmc.ru/vitalif/vitastor/src/branch/master/CLA-en.md
koolkhel added 1 commit 2026-11-29 12:46:29 +03:00
An operation with OSD_OP_WAIT_UP_TIMEOUT that finds its PG inactive gets
a deadline, but the retry timer is armed only for parts retried after a
failure. An operation that first found its PG already inactive was left
without a timer and waited for an unrelated event instead of failing
after client_wait_up_timeout. rm-data hit this when OSDs died during
deletion: the deletes in flight timed out, and the following deletes of
the same PG waited forever. Arm the timer for such operations too.

Also stop sending deletes to a PG after one of them times out, and report
the PG as not deleted, so that rm-data doesn't wait client_wait_up_timeout
again for each of its remaining objects.
vitalif requested changes 2026-11-29 14:45:31 +03:00
@@ -1243,2 +1243,3 @@
}
if (op->parts[i].flags & PART_RETRY)
// An operation waiting for its PG to come up needs the timer to see wait_up_until expire
if ((op->parts[i].flags & PART_RETRY) || op->wait_up_until.tv_sec)
Owner

Это какое-то смешение механизмов
Идея wait_up_until в том чтобы операция сдохла через это время
Ну то есть да, reset_retry_timer наверное правильно дёрнуть, но не тут а просто когда ставим // Set wait_up timer

Это какое-то смешение механизмов Идея wait_up_until в том чтобы операция сдохла через это время Ну то есть да, reset_retry_timer наверное правильно дёрнуть, но не тут а просто когда ставим // Set wait_up timer
koolkhel added 1 commit 2026-11-29 14:53:27 +03:00
Instead of polling an operation that waits for its PG to come up every
client_retry_interval, arm the retry timer for client_wait_up_timeout
when its deadline is set. Re-arm it for the remaining time while the
operation still waits: reset_retry_timer() keeps a shorter timer that is
already set, and when that one fires for another operation, nothing
would wake this one up again before its deadline.
Author
Contributor

К src/client/cluster_client.cpp:1245: перенёс в 0219f6f6 — reset_retry_timer(client_wait_up_timeout*1000) теперь там, где ставится wait_up_until, retry_after больше не трогаю; плюс пока операция ждёт, перевзвожу таймер на остаток срока: reset_retry_timer() оставляет уже взведённый более короткий таймер, и после его срабатывания для других операций (в rm-data это повторы удалений, бывших в пути при отказе OSD) эту никто не будит — тест теперь с двумя удалениями и без перевзвода падает.

К `src/client/cluster_client.cpp:1245`: перенёс в 0219f6f6 — `reset_retry_timer(client_wait_up_timeout*1000)` теперь там, где ставится `wait_up_until`, `retry_after` больше не трогаю; плюс пока операция ждёт, перевзвожу таймер на остаток срока: `reset_retry_timer()` оставляет уже взведённый более короткий таймер, и после его срабатывания для других операций (в rm-data это повторы удалений, бывших в пути при отказе OSD) эту никто не будит — тест теперь с двумя удалениями и без перевзвода падает.
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u delete-wait-up-timer:koolkhel-delete-wait-up-timer
git checkout koolkhel-delete-wait-up-timer
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: vitalif/vitastor#203
No description provided.