cmcfarlen opened a new pull request, #13923: URL: https://github.com/apache/trafficserver/pull/13923
A directory torn by a crash can pass the magic and sync-serial checks yet hold a bucket chain that runs into its segment's free list. Recovery's cleanup deletes each zero-offset entry on that chain, and `delete_entry()` pushes it back onto the same free list it is still linked from: - With no loop further down, the chain is acyclic, so the bounded walks from #13608 never trip. The walk ends, but the free list is left looped and sharing entries with a bucket. - With a loop further down the free list, the deletions churn through the same entries indefinitely. Before #13608 this spun the event thread forever. Since #13608 the walk trips the bound, and `bucket_loop_fix()` wipes the segment only if a loop happens to be reachable from the bucket at that moment. We hit the second case in production on a 10.2 build without #13608: ATS was SIGKILLed during its shutdown directory sync, and the next start sat at "waiting for cache initialization" forever. One `ET_NET` thread was pinned in `clear_range` -> `cleanup` -> `clean_segment` -> `dir_clean_bucket` on one of eight disks, in a segment whose bucket head linked into the free list. A second segment on that disk had a looped free list. This checks each segment's links once, when the directory is read from disk and before recovery modifies it. Every non-head row must be on at most one list (a bucket chain or the free list), and no list may loop, leave the segment or link to a head row. A segment failing that is reinitialised, the same repair `bucket_loop_fix()` already does, and a warning reports how many were cleared. The check is a single pass over the directory with a visited bitmap per segment. The new unit test builds both layouts and confirms they are detected and repaired, and that a full, healthy directory is left alone. With the repair disabled, `clean_segment()` alone leaves the acyclic layout corrupt. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
