Bug #82192
closedosd: an EC CALL op that runs again after an async read does its sync read on the handles of a finished coroutine
0%
Description
On a pool with EC optimizations, PrimaryLogPG::do_op() runs a CALL op in
a coroutine, so that a sync read in the class method (cls_cxx_read) can
yield. The op keeps the coroutine's handles in OpRequest::coro_handles.
The handles point into the coroutine's stack.
When an op of the request starts an async read, as a CHECKSUM before
the CALL does, the coroutine finishes before that read completes.
OpContext::finish_read() then runs the op again with execute_ctx(),
outside the coroutine. The CALL's read runs again, and its sync read
yields on the handles of the finished coroutine. Those handles point
into a stack that is gone, or that tracker #81777 leaks.
PrimaryLogPG::on_shutdown() also does not free a suspended coroutine
before the backend cancels its reads.
#81777 is the stack leak of a coroutine that completes without
yielding, the first bug of #79515. Its fix is
https://github.com/ceph/ceph/pull/72704, which does not fix the
handles, the run outside the coroutine, or the shutdown.
Fix¶
- on_coroutine_complete() clears the handles of the op.
- The coroutine waits for the async reads of the op, and runs the op
again itself, where the sync read can yield. - on_shutdown() frees a suspended coroutine first.
The new unittest_ec_coroutines tests the stack and the handles. The
librados test LibRadosMiscECPP.ClassReadAfterAsyncRead runs a CHECKSUM
and then a CALL that reads the object.
Affected versions: main
KB Updated by Kyle Bader about 1 month ago
- Pull request ID set to 73174
MW Updated by Matty Williams about 1 month ago
- Pull request ID deleted (
73174)
MW Updated by Matty Williams about 1 month ago
- Is duplicate of Bug #81777: osd: EC CALL op coroutine that completes without yielding leaks its stack added
MW Updated by Matty Williams about 1 month ago
- Status changed from New to Duplicate