Project

General

Profile

Actions

Bug #81777

closed
AA MW

Feature #75023: Support for Erasure Coded Metadata Pools

osd: EC CALL op coroutine that completes without yielding leaks its stack

Bug #81777: osd: EC CALL op coroutine that completes without yielding leaks its stack

Added by Alex Ainscow about 2 months ago. Updated 20 days ago.

Status:
Backporting
Priority:
Normal
Category:
-
Target version:
-
Due date:
% Done:

100%

Source:
Q/A
Backport:
umbrella
Regression:
Yes
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Pull request ID:
Tags (freeform):
Fixed In:
v22.0.0-858-g780624c4c3
Released In:
Upkeep Timestamp:
2026-11-13T13:33:23+00:00

Description

`PrimaryLogPG::do_op()` runs a CALL op on a pool with EC optimizations in a coroutine owned by `coro_resumer`, and the coroutine body ends with `on_coroutine_complete()`, which resets `coro_resumer`. Since https://github.com/ceph/ceph/pull/71327, `CoroHandles` keeps only a `weak_ptr`, so when the op completes without yielding, that reset destroys the coroutine while it still runs on its own stack. The fiber is never unwound, and its 128KB stack leaks once per such op. This is the first bug described in https://tracker.ceph.com/issues/79515; PR 71327 fixed the second one (`on_change()`) but kept this reset.

`rados/verify` valgrind jobs on main report it on every OSD:

Leak_DefinitelyLost
malloc
allocate
create_control_block<boost::coroutines2::detail::push_coroutine<void>::control_block, boost::context::basic_fixedsize_stack<boost::context::stack_traits>, PrimaryLogPG::do_op(OpRequestRef&)::<lambda(yield_token_t&)> >

Teuthology reports only the first valgrind error found, which on main is usually the monitor CRYPTO_malloc leak (https://tracker.ceph.com/issues/79831), so this one is hidden. Examples with it on the OSDs behind the monitor error:
- /a/yuriw-2026-10-12_20:51:29-rados-wip-yuri10-testing-20261012.162444-main-distro-default-trial/629993
- /a/skanta-2026-10-03_10:12:06-rados-wip-bharath19-testing-20261002.123021-main-distro-default-trial/604377

With the monitor leak suppressed it is the reported failure, for example:
- https://pulpito-ng.ceph.com/aainscow-2026-10-14_13:56:33-rados:verify-wip-aainscow-rados-qa-fixes-261014-distro-default-trial/ (jobs 637177, 637178)

On a long-running cluster it costs about 128KB of OSD memory per EC CALL op that does not need an async read (for example RBD object-map updates), so OSD RSS grows without bound under such workloads.


Related issues 3 (1 open — 2 closed)

Related to RADOS - Bug #79515: osd: coroutine lifecycle bugs in PrimaryLogPG/ECBackendResolvedMatty Williams

Actions
Has duplicate RADOS - Bug #82192: osd: an EC CALL op that runs again after an async read does its sync read on the handles of a finished coroutineDuplicate

Actions
Copied to RADOS - Backport #83143: umbrella: osd: EC CALL op coroutine that completes without yielding leaks its stackFix Under ReviewMatty Williams

Actions

AA Updated by Alex Ainscow about 2 months ago Actions #1

  • Related to Bug #79515: osd: coroutine lifecycle bugs in PrimaryLogPG/ECBackend added

AA Updated by Alex Ainscow about 2 months ago Actions #2

  • Pull request ID set to 72704

AA Updated by Alex Ainscow about 2 months ago Actions #3

  • Status changed from New to Fix Under Review

MW Updated by Matty Williams about 2 months ago Actions #4

  • Assignee set to Matty Williams

MW Updated by Matty Williams about 2 months ago Actions #5

  • Parent task set to #75023

LF Updated by Laura Flores about 1 month ago Actions #6

Fix still under review.

MW Updated by Matty Williams about 1 month ago Actions #7

  • % Done changed from 0 to 80
  • Pull request ID changed from 72704 to 73193

MW Updated by Matty Williams about 1 month ago Actions #8

  • Has duplicate Bug #82192: osd: an EC CALL op that runs again after an async read does its sync read on the handles of a finished coroutine added

KS Updated by Kamoltat (Junior) Sirivadhna about 1 month ago Actions #9

Approved, needs-qa flagged.

KS Updated by Kamoltat (Junior) Sirivadhna 28 days ago Actions #10

In-QA testing

MW Updated by Matty Williams 21 days ago Actions #11

  • % Done changed from 80 to 100

UB Updated by Upkeep Bot 20 days ago Actions #12

  • Copied to Backport #83143: umbrella: osd: EC CALL op coroutine that completes without yielding leaks its stack added

UB Updated by Upkeep Bot 20 days ago Actions #13

  • Status changed from Fix Under Review to Backporting
  • Merge Commit set to 780624c4c32b13ab0cacba91318a229b00702084
  • Fixed In set to v22.0.0-858-g780624c4c3
  • Upkeep Timestamp set to 2026-11-13T13:33:23+00:00
Actions

Also available in: PDF Atom