Repository navigation
Conversation
concurrent Multi Objects Delete request can run on different io_context pool threads, causing concurrent access to the shared formatter and ops_log_entries vector in send_partial_response(). this data race can lead to use-after-free during vector reallocation (detected by ASAN) add a mutex to serialize the formatter writes and ops_log_entries push_back. Fixes: https://tracker.ceph.com/issues/76725 Signed-off-by: Mark Kogan <[email protected]>
|
LGTM. but I still don't understand why the strand fails to serialize. |
2d37be7 to
76737dd
Compare
| // Lock and double-check before accessing vector | ||
| std::lock_guard<std::mutex> lock(cache_ptr->mutex); | ||
| if (!cache_ptr->valid.load(std::memory_order_relaxed) || cache_ptr->c.empty()) { |
There was a problem hiding this comment.
why is mutex/atomic necessary for a thread-local cache? do you see some access coming from a different thread?
76737dd to
2d37be7
Compare
like Shilpa, i still don't see anything unsafe about the initial coroutine from the beast frontend that calls |
|
@smanjara re:
The strand do serialize, only one fiber runs at a time, but the fibers resume on different threads (whichever pool thread picks up the completion) |
I believe this fix is bandaid to the original problem then, right? Otherwise, if the completion was indeed resuming on strand we shouldn't be seeing this race at all. The source of the issue seems to be in Objecter.h::complete->boost::asio::defer The arg is an any_completion_handler. it preserves the associated executor (the strand from the coroutine). But instead of In the same file, we have the correct usage pattern acutally: wait_for_osd_map This affects all neorados async operations, not just multi-object delete. Any code relying on strand serialization with neorados is potentially a candiate to hit this race condition then. The ASAN evidence is consistent with this theory. Two distinct pool threads were simultaneously inside the same vector storage. The trace shows T448 freed and T460 read — two different threads simultaneously inside vector::push_back(). If the strand were honored, only one thread at a time could be inside send_partial_response(). @mkogan1 / @cbodley would it make sense to fix this at the |
@BBoozmen - interesting, did not think of this option :-) |
thanks @BBoozmen, that looks believable to me. cc @adamemerson @mkogan1 can you confirm that this behavior only happens when configured for multisite? i don't think we'd interact with neorados unless the deletes were writing datalog entries |
confirm -- was NOT able to repro in SS despite considerable efforts - in the beginning we thought that its not MS related |
|
pr testing completed and approved by @ivancich , tracker details : https://tracker.ceph.com/issues/77211 |
concurrent Multi Objects Delete request can run on different io_context pool threads, causing concurrent access to the shared formatter and ops_log_entries vector in send_partial_response().
this data race can lead to use-after-free during vector reallocation (detected by ASAN)
add a mutex to serialize the formatter writes and ops_log_entries push_back.
Fixes: https://tracker.ceph.com/issues/76725
Contribution Guidelines
To sign and title your commits, please refer to Submitting Patches to Ceph.
If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.
When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an
xbetween the brackets:[x]. Spaces and capitalization matter when checking off items this way.Checklist
Show available Jenkins commands
jenkins test classic perfJenkins Job | Jenkins Job Definitionjenkins test crimson perfJenkins Job | Jenkins Job Definitionjenkins test signedJenkins Job | Jenkins Job Definitionjenkins test make checkJenkins Job | Jenkins Job Definitionjenkins test make check arm64Jenkins Job | Jenkins Job Definitionjenkins test submodulesJenkins Job | Jenkins Job Definitionjenkins test dashboardJenkins Job | Jenkins Job Definitionjenkins test dashboard cephadmJenkins Job | Jenkins Job Definitionjenkins test apiJenkins Job | Jenkins Job Definitionjenkins test docsReadTheDocs | Github Workflow Definitionjenkins test ceph-volume allJenkins Jobs | Jenkins Jobs Definitionjenkins test windowsJenkins Job | Jenkins Job Definitionjenkins test rook e2eJenkins Job | Jenkins Job DefinitionYou must only issue one Jenkins command per-comment. Jenkins does not understand
comments with more than one command.