Skip to content

osd: free the stack of an EC coroutine op and keep its sync reads in it - #73174

Closed
mmgaggle wants to merge 1 commit into
ceph:mainfrom
mmgaggle:wip-kbader-ec-coro-stack
Closed

mmgaggle wants to merge 1 commit into
ceph:mainfrom
mmgaggle:wip-kbader-ec-coro-stack

Conversation

@mmgaggle

Copy link
Copy Markdown
Member

Summary

An op that ended without a yield dropped the last reference to its coroutine inside the coroutine, so its 128 KiB stack leaked. Now resume_coroutine() holds a reference across the resume.

The op also kept handles into the freed stack, and a later sync read yielded on them. Now the coroutine clears them, and waits for the op's async reads itself. If an op before the CALL started those reads before any sync read, the coroutine waits for them too. At shutdown, the PG now also frees a suspended coroutine.

The open #72704 fixes the first leak in the same way. Its tracker is 81777. #72704 does not fix the handles, the async reads or the shutdown. The two conflict in Coroutines.h, PrimaryLogPG.cc and src/test/osd/CMakeLists.txt.

Fixes: https://tracker.ceph.com/issues/82192

Testing

On main 169a0fb, with the other seven P0 fixes, the new unittest_ec_coroutines passes its 5 tests:

  • FinishWithoutYieldFreesStack
  • FinishAfterYieldFreesStack
  • StoppedWhileSuspendedFreesStack
  • ManyOpsKeepNoStacks
  • NoHandlesOutliveTheCoroutine

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)

An op that ended without a yield dropped the last reference to its
coroutine inside the coroutine, so its 128 KiB stack leaked. Now
resume_coroutine() holds a reference across the resume. The op also kept
handles into the freed stack, and a later sync read yielded on them. Now
the coroutine clears them and waits for the op's async reads itself,
also when an op before the CALL started them before any sync read.

Fixes: https://tracker.ceph.com/issues/82192
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Kyle Bader <[email protected]>
@MattyWilliams22

Copy link
Copy Markdown
Contributor

This PR is a duplicate of #73193

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants