Repository navigation
Fix segfault in StreamingStorageRegistry - #108810
Conversation
|
Workflow [PR], commit [a7a4c00] Summary: ❌
AI ReviewSummaryThis PR attempts to avoid a null-pointer dereference in Findings
Tests
Final VerdictStatus: ❌ Block Minimum required action: close the remaining concurrent shutdown race and add focused coverage for it. |
| DatabaseCatalog::instance().tryGetTable(storage, Context::getGlobalContextInstance())->shutdown(); | ||
| /// The StorageID may remain in `StreamingStorageRegistry::storages` while the table is gone from `DatabaseCatalog`. | ||
| if (auto table = DatabaseCatalog::instance().tryGetTable(storage, Context::getGlobalContextInstance())) | ||
| table->shutdown(); |
There was a problem hiding this comment.
This still leaves the visible-table half of the shutdown race. DROP TABLE calls table->flushAndShutdown(true) while the table is still registered in DatabaseCatalog (src/Interpreters/InterpreterDropQuery.cpp:350; DETACH has the same ordering at line 289), so this tryGetTable can return the same StorageObjectStorageQueue while its drop shutdown is already running. The second caller then enters StorageObjectStorageQueue::shutdown(false) through this line. That method is only guarded by a load-then-store (src/Storages/ObjectStorageQueue/StorageObjectStorageQueue.cpp:482-493), although IStorage::shutdown is documented as concurrently callable, so both callers can run over files_metadata and streaming_tasks; if the registry-side shutdown(false) wins, the later drop shutdown returns and never calls ObjectStorageQueueMetadataFactory::remove(..., is_drop=true, ...), leaving the queue's Keeper metadata behind.
Please make the per-storage shutdown path serialize concurrent callers and preserve the is_drop=true cleanup, or avoid invoking registry shutdown for a table already being dropped, before relying on this null check.
|
Backport labels have been automatically added based on https://github.com/clickhouse/clickhouse-core-incidents/issues/1900 Labels added:
These labels ensure backport PRs are properly created for each affected release version. The release automation will create backport PRs as needed based on these labels. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 4/4 (100.00%) | Lost baseline coverage (was covered on master, now uncovered in this PR): 1 line(s) · Uncovered code |
Backport #108810 to 26.4: Fix segfault in StreamingStorageRegistry
Backport #108810 to 26.5: Fix segfault in StreamingStorageRegistry
Backport #108810 to 26.3: Fix segfault in StreamingStorageRegistry
Backport #108810 to 26.6: Fix segfault in StreamingStorageRegistry
…gistry-shutdown-null-deref Fix segfault in StreamingStorageRegistry
Linked issues
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Fixes a null-pointer dereference segfault in
StreamingStorageRegistrythat occurs whenStreamingStorageRegistry::shutdownandStorageObjectStorageQueue::shutdownare called concurrently.Version info
26.6.5.54,26.4.5.169,26.3.18.16