Skip to content

osd: initialize readable_interval at PeeringState construction - #72799

Open
ronen-fr wants to merge 1 commit into
ceph:mainfrom
ronen-fr:wip-rf-81851
Open

ronen-fr wants to merge 1 commit into
ceph:mainfrom
ronen-fr:wip-rf-81851

Conversation

@ronen-fr

Copy link
Copy Markdown
Contributor

readable_interval is only set at the end of PeeringState::advance_map().
A PG created via OSD::handle_pg_create_info() can go active as primary
before any map is advanced, so it runs with readable_interval == 0.

With a zero interval, schedule_renew_lease() arms the renewal timer with
no delay. proc_renew_lease() then re-schedules itself right away and
floods the replicas with zero-interval MOSDPGLease messages (~96K in
1.5s in the reported run). Such leases can never move readable_until
ahead of now, so the PG stays laggy, and the replica's queue is
backlogged long enough to stall scrub (WaitReplicas).

Fix:

  • set readable_interval from the pool in the PeeringState constructor;
  • in schedule_renew_lease(), never re-arm with a non-positive interval:
    fall back to the pool interval, or to 1s if that is also non-positive
    (e.g. a negative read_lease_interval pool option, or a non-positive
    osd_heartbeat_grace * osd_pool_default_read_lease_ratio), and log at
    level 0.

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

Comment thread src/osd/PeeringState.cc
// flooding the replicas with MOSDPGLease messages
readable_interval = pool.get_readable_interval(cct->_conf);
if (readable_interval <= ceph::signedspan::zero()) {
readable_interval = std::chrono::seconds(1);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK.

Comment thread src/osd/PeeringState.cc
{
// advance_map() refreshes this on every map, but a PG created via
// handle_pg_create_info() may go active before any map is advanced.
readable_interval = pool.get_readable_interval(cct->_conf);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK.

@SrinivasaBharath

Copy link
Copy Markdown
Contributor

This PR has been added to wip-bharath1-testing-20261114.051618-main.

@adam-lj

adam-lj commented Nov 27, 2026

Copy link
Copy Markdown
Contributor

This apparently caused several jobs in the QA run to fail, with the following error:
2026-11-15T00:21:43.480 INFO:tasks.workunit.client.0.trial057.stderr:Invalid command: read_lease_interval not in allow_ec_optimizations|allow_ec_overwrites|bulk|cache_min_evict_age...
e.g. /a/skanta-2026-11-14_23:55:47-rados-wip-bharath1-testing-20261114.051618-main-distro-default-trial/765726/
Maybe read_lease_interval needs to be added to src/mon/MonCommands.h?

@ronen-fr

Copy link
Copy Markdown
Contributor Author

Thank you, @adam-lj . There is indeed an error in the test code. I am dropping that commit altogether.

readable_interval is only set at the end of PeeringState::advance_map().
A PG created via OSD::handle_pg_create_info() can go active as primary
before any map is advanced, so it runs with readable_interval == 0.

With a zero interval, schedule_renew_lease() arms the renewal timer with
no delay. proc_renew_lease() then re-schedules itself right away and
floods the replicas with zero-interval MOSDPGLease messages (~96K in
1.5s in the reported run). Such leases can never move readable_until
ahead of now, so the PG stays laggy, and the replica's queue is
backlogged long enough to stall scrub (WaitReplicas).

Fix:
- set readable_interval from the pool in the PeeringState constructor;
- in schedule_renew_lease(), never re-arm with a non-positive interval:
  fall back to the pool interval, or to 1s if that is also non-positive
  (e.g. a negative read_lease_interval pool option, or a non-positive
  osd_heartbeat_grace * osd_pool_default_read_lease_ratio), and log at
  level 0.

Fixes: https://tracker.ceph.com/issues/81851
Assisted-by: Claude
Signed-off-by: Ronen Friedman <[email protected]>
@ronen-fr

Copy link
Copy Markdown
Contributor Author

@SrinivasaBharath - can you rerun with the updated branch? thanks

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.

4 participants