Store v1: Fix two flusher hangs with deletions #114
Open
koolkhel
wants to merge 3 commits from
koolkhel/vitastor:v1-lost-flush into master
pull from: koolkhel/vitastor:v1-lost-flush
merge into: vitalif:master
vitalif:master
vitalif:tombstones
vitalif:primary-stickiness
vitalif:libvfn
vitalif:canceling
vitalif:immediate-repeering
vitalif:rdma-close-tcp
vitalif:use-degraded-writes
vitalif:fix-write-delete-flow
vitalif:openssl-3.0.12
vitalif:openssl-capture-secrets
vitalif:ignore-small-rdma-end
vitalif:encrypt-batch
vitalif:faster-peering-calc
vitalif:http-hello
vitalif:xxh3-bench
vitalif:create-user-etcd-based
vitalif:aesxts_streaming_nosupport
vitalif:refactor-heap-continue-write
vitalif:ston3lu-patch-0127
vitalif:rdma-credits
vitalif:heap-meta
vitalif:sendmsg-zc-no-more-error
vitalif:fix-clear-refs
vitalif:veeam-trick
vitalif:test-etcd-schizo
vitalif:test
vitalif:test1
vitalif:test2
vitalif:cow-meta
vitalif:kv-readahead
vitalif:qemu-fix-crash-idea
vitalif:eventloop-auto-init-trigger
vitalif:hugo-docs
vitalif:node-mutex-and-postpone
vitalif:check-writeback
vitalif:msgr-iothreads-v2
vitalif:antietcd
vitalif:rel-1.4
vitalif:test-fix-ec-unknown-state-51
vitalif:kv-update
vitalif:kv-debug
vitalif:hotfix-1.2.0
vitalif:rdma-simple-nodp
vitalif:zerocopy-tcp-send
vitalif:csi-staging
vitalif:hotfix-1.1.0
vitalif:hotfix-1.0.0
vitalif:fsync-feedback
vitalif:cached-reads
vitalif:qemu-send-loop
vitalif:test-double-alloc
vitalif:hier-failure-domains
vitalif:mon-self-restart
vitalif:epoch-deletions
vitalif:rdma-flow-control
vitalif:csi-use-vitastor-cli
vitalif:rdma-v2
vitalif:etcd-hide-base64
vitalif:lrc-matrix
vitalif:rm-left-on-dead
vitalif:nfs-proxy-old
vitalif:non-odp-rdma
vitalif:test-zctr
vitalif:separate-data-connections
vitalif:sec_osd_msgr
vitalif:test-assert
vitalif:nbd-vmsplice
vitalif:allow-etcd-address-option
vitalif:rdma-zerocopy
vitalif:rel-0.5
vitalif:openonload
vitalif:sync-io-test
vitalif:trace-sync
vitalif:trace-sqes
vitalif:test-submit-and-wait
vitalif:test-sq-poll
vitalif:blocking-uring-test
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
No description provided.
Delete Branch "koolkhel/vitastor:v1-lost-flush"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
This is v2 of the patches sent to you on 2026-10-21. Following your review, the flush check of patch 1 runs only with the new
--hardenedoption of test_blockstore_chaos, because it scans all of dirty_db; patch 2's subject names the option. Patches 2 and 3 are unchanged otherwise.Under sustained load, an OSD on store v1 can stop accepting writes for good: its journal fills up, every write fails with EAGAIN, and the client retries forever, so all I/O touching that OSD hangs until the OSD restarts. We hit it with an NFS server that reuses inode numbers, so the data objects of deleted files are deleted and rewritten from version 1 all the time. The gateway stalled after 4-8 minutes of S3 load. gdb on the stuck OSD showed the full journal pinned by one stable BIG_WRITE entry at used_start, which was not in the flush queue.
1. Check that stable versions get flushed in test_blockstore_chaos --hardened
--hardenedoption, the test checks after every drain that the newest stable version of every object is being flushed, or queued under a version that is still in dirty_db and not older than it.--p-delete 30finds lost flushes on master:--seed 285 --config 21,--seed 112 --config 21,--seed 118 --config 21,--seed 439 --config 18and19, all with--hardened --steps 30000 --p-delete 30.2. Store v1: Do not queue a deletion for flushing again while it is being flushed (reworked after your review, 2026-11-02)
sync_to_repeat), the write doesn't queue the deletion again but raises the repeat version, so the flush in progress requeues the object when it finishes, as it already does for versions that come up during a flush. The earlieris_gone()check is gone.3. Store v1: Wake up the flusher when journal sectors are written
--seed 5 --config 12 --steps 30000 --p-delete 30deadlocks on master.--seed 5 --config 12passes without this commit too (the flush order changes and the seed no longer reaches the hang), and it passes on master with this commit alone. A sweep of seeds 1-200 on every v1 configuration (2,400 runs,--hardened --steps 30000 --p-delete 30) without it found no hang. The missing wakeup is still in the code, so the commit stays; drop it if you want a seed for it first.3cf04530("Fix exotic hang on an unflushable deletion") does not cure either case: all the seeds above fail on master, which includes it.Testing (Ubuntu 24.04, RelWithDebInfo; the reworked series on
a7a6d5f3):--hardened, pass without it, and pass with the whole series either way.--hardenedchanges nothing measurable in the test itself: 48 seeds with default weights take 37.85 s without it and 37.87 s with it, because the check runs only at clean restarts and at the end.a7a6d5f3with the reworked series:test_blockstore_v1passes, all six seeds above pass, and so does a default 200-seed run oftest_blockstore_chaos --hardened.3e803e07):make build_tests test, as in.gitea/workflows/test.yml: 15 of 15 tests pass, includingtest_blockstore_chaos(default run, 200 seeds) andtest_pg_chaos.--steps 30000 --p-delete 30, 18,000 runs) found no lost flush and no deadlock.Not included: with
--p-delete 30the chaos test also fails on master in other ways that this series doesn't change. A deleted object comes back after a clean restart (--seed 1064 --config 12). There is "BUG: Unexpected dirty_entry ... unstable state during flush" with fsync=1 (--seed 60 --config 21). "big_write journal_entry was allocated over another object" (--seed 144 --config 15). And unexpected content after a power outage (--seed 841 --config 20). A follow-up series fixes them. It builds on this one, so it will come as a separate PR once this one is merged.Contributor Name
Yury Luneff (MIND Software LLC, https://mindsw.io)
CLA
Мне тут не нравится вот этот фикс
Сфигали в очередь flush добавляется write одновременно с уже находящимся там delete, если write произошёл ПОВЕРХ этого самого delete, и должен его дождаться? Вот это выглядит как баг и выглядит что именно это править надо, а не просто накрывать проверкой if is_gone.
Проверил все указанные сиды - они не падают.
Опции
--hardenedна master нет, она добавляется первым коммитом этого PR:80ef5486«Check that stable versions get flushed in test_blockstore_chaos --hardened». Без неё сиды ниже ничего не проверяют. Чтобы повторить, нужен этот коммит поверх master (ставится чисто) или просто ветка PR:Пять из шести сидов (285, 112, 118 на
--config 21, 439 на--config 18и19) завязаны на--hardenedиз первого коммита. Без неё они на master и не должны падать: потерянный flush тогда виден только как EAGAIN, а за 30000 шагов до него не доходит. На master этой опции нет (Unknown option --hardened), а на master + первый коммит они падают так:(112 — step 19404, 118 — step 27050, 439 — step 26602). То есть это сиды на то, что ловит проверка: stable-версия, которую flusher уже никогда не сбросит. Считать ли это настоящим багом — решать тебе. У нас из-за этого вставала запись на OSD под нагрузкой, это и было поводом для PR.
Шестой,
--seed 5 --config 12 --steps 30000 --p-delete 30, от--hardenedне зависит и на текущем master (a7a6d5f3) виснет:stuck: write 1:60000 v4 16384+77824,stuck: write 1:40000 v2 4096+16384. Нужны оба параметра: без--steps 30000или без--p-delete 30он проходит.8ac5cb9510to80cd77c09dПеределал второй коммит, как ты написал, и запушил; ветка заодно перебазирована на текущий master (
a7a6d5f3).Ты прав, баг был именно там. Трассировка
--hardened --seed 285 --config 21по объекту1:40000:unshift_stable_flush()ставит в очередь то же удаление v5 второй раз, хотя его уже сбрасывают;enqueue_flush(v1)игнорируется: вflush_versionsдля объекта висит устаревшая v5, она больше;Теперь, если объект сейчас сбрасывается (есть в
sync_to_repeat), запись поверх удаления не ставит удаление в очередь заново, а только поднимает версию повтора. После текущего flush объект перепоставится, как для любых версий, пришедших во время flush.is_gone()убран.Про третий коммит (будить flusher при записи секторов журнала):
--seed 5 --config 12 --steps 30000 --p-delete 30теперь проходит и с одним новым вторым коммитом (порядок flush другой, и до зависания seed не доходит), и на master с одним третьим. Свип seed 1–200 по всем v1-конфигурациям (2400 прогонов,--hardened --steps 30000 --p-delete 30) без третьего коммита зависаний не нашёл. Сама дыра в коде осталась: flusher откладывает записи, чей сектор журнала ещё не записан, и останавливается, а запись сектора его не будит. Поэтому коммит я оставил. Если без отдельного seed не возьмёшь, скажи, уберу его из PR.Проверено на весь PR: все шесть seed из описания,
test_blockstore_v1,test_blockstore_chaos --hardened(200 seed по умолчанию). Описание PR обновил.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.