Skip to content

CAS: a sustained S3 503 drops the mount lease without a renewal-failure log #2423

Closed as not planned

Description

@DimensionWieldr

✅ I checked the Altinity Stable Builds lifecycle table, and the Altinity Stable Build version I'm using is still supported.

Type of problem

Bug report - something's broken

Describe the situation

A sustained S3 503 on PUT and POST drops the CAS mount lease. Inserts fail with Code 210, mount lease not held. The server never logs the CasMountLeaseKeeper lines that are supposed to explain that drop: a transient renewal failure, or the mount-lease stops advancing.

A shorter 503, held for 8 seconds, is under the 10-second renew period and must not fence the lease. That window also produced none of the transient renewal lines, so the log does not show whether the renewer saw the fault.

Seen in a local soak run of scenario S39 (mount-lease resilience under a degraded-but-alive S3) on 22 Sep 2026. After the fault was cleared, writes resumed, both replicas agreed, and cas-fsck reported dangling=0. The data survived. The lease loss is invisible in the renewal log.

This issue:

  • Reproduces the lease drop with an injected 503, not with port exhaustion or a quiet SELECT FINAL
  • Loses the mount on a 40-second 503 (past the 30-second lease TTL) and returns Code 210
  • Emits zero background renewal failed transiently lines and zero the mount-lease stops advancing lines in system.text_log and clickhouse-server.log

How to reproduce the behavior

Environment

  • Version: 26.6.4.20001.altinityantalya (altinity/clickhouse-server:26.6.4.20001.altinityantalya)
  • Build type: release
  • Cluster: 2 replicas. The ca disk endpoint is an S3 proxy in front of RustFS. system.text_log is enabled.
  • Lease: mount_lease_ttl_ms=30000, mount_renew_period_ms=10000 (from the CasRequestBudget log line on startup)

Steps

  1. Create a replicated table on the ca policy and insert enough rows that the mount is live.

  2. Arm the proxy so every PUT and POST returns 503. Hold that for 8 seconds, then disarm. Search system.text_log and the server log for background renewal failed transiently, retrying while the lease is still valid.

  3. Arm the same 503 again and hold it for 40 seconds while an INSERT and OPTIMIZE run. Then disarm, wait 20 seconds, and insert again.

proxy control: {"rate": 1.0, "modes": ["503"], "methods": ["PUT", "POST"]}

Expected behavior

During the 8-second fault, the renewer logs a transient retry if the fault hits a renewal, and the lease does not fence.

During the 40-second fault, the lease fences, and the log contains background renewal failed, the mount-lease stops advancing. After the 503 stops, a new INSERT commits and both replicas match.


Actual behavior

On release builds

The 8-second window logged 0 transient renewal lines and 0 fence lines.

The 40-second window failed the in-flight INSERT with:

Code: 210. DB::Exception: content-addressed disk 'ca' -- mount lease not held;
backing may be temporarily unreachable; the operation is admitted again once
the disk recovers to Live; TRANSIENT unavailability, not damage. (NETWORK_ERROR)

The same Code 210 appears on interserver requests during that window. system.text_log and clickhouse-server.log contain 0 rows for background renewal failed, the mount-lease stops advancing. The only hits for that phrase are the SELECT that searches for it.

After a 20-second settle, the next INSERT committed. Both replicas reported 2000 rows and the same checksum. cas-fsck reported dangling=0.


Additional context

Local run, not CI. Dev scale of scenario S39 in cas/soak_tests: 2000 rows, 512-byte payload, 8-second then 40-second 503.

#2243 quotes these same CasMountLeaseKeeper lines, produced there by ephemeral-port exhaustion (EADDRNOTAVAIL). This run had no EADDRNOTAVAIL. #2332 is a lease drop with no renewal log line, triggered by concurrent SELECT FINAL on a quiet store rather than by a 503.

Activity

  1. added
    bug
    on Sep 23, 2026
  2. filimonov commented on Sep 24, 2026

    @filimonov
    Member

    Thanks for the detailed report. Two points:

    1. The log lines you searched for no longer exist in this version.
    background renewal failed transiently, retrying while the lease is still valid and background renewal failed, the mount-lease stops advancing (logger CasMountLeaseKeeper) were removed in 7f932d3 (2026-08-25), before the 26.6.4.20001.altinityantalya tag. They were quoted in #2243 and #2332 from older builds.

    In 26.6.4 the renewer logs under CasMountLeaseRenewer:

    • CAS mount renewal '<root>' physical retry attempt N ... at DEBUG level, one per retry
    • CAS mount renewal '<root>' recovered after N physical attempts in M ms ... at INFO level
    • CAS mount renewal '<root>' fenced after N physical attempts in M ms (classification=...) at WARNING level

    It also writes a watermark_renew event to system.cas_log and increments CASMountRenewalAttempts, CASMountRenewalRetries, CASMountRenewalRecovered, CASMountRenewalDeadlineExceeded and CASMountLeaseLost in system.events. The S39 card asserts on these counters, not on log text.

    2. The lease loss during the 40-second 503 is expected.
    Lease renewal is an S3 PUT. If every PUT fails for 40 seconds, the lease cannot be renewed and must fence after the 30-second TTL. The Code 210 ... TRANSIENT unavailability, not damage error, followed by recovery once the fault clears, is the designed behavior, and your run confirms it (writes resumed, replicas match, dangling=0).

    For the 8-second window, zero lines is also possible: the renew period is 10 seconds, so an 8-second fault may not overlap a renewal at all. If it does, you will see the INFO recovered line and a nonzero CASMountRenewalRetries.

    Could you rerun and check:

    SELECT * FROM system.text_log WHERE logger_name = 'CasMountLeaseRenewer' ORDER BY event_time;
    SELECT event, value FROM system.events WHERE event LIKE 'CASMountRenewal%' OR event = 'CASMountLeaseLost';
    SELECT * FROM system.cas_log WHERE event_type = 'watermark_renew' ORDER BY event_time;

    If the 40-second fault produces no fenced WARNING and no WatermarkRenew event, please reopen with that output. Otherwise I will close this as working as designed.

  3. removed
    bug
    on Sep 24, 2026
  4. DimensionWieldr commented on Sep 24, 2026

    @DimensionWieldr
    CollaboratorAuthor

    Reran S39 on 26.6.4.20001.altinityantalya (dev scale: 8s then 40s of S3 503). The 40-second fault does produce the new renewer records.

    clickhouse1 fenced:

    2026-09-24 19:14:09  Debug    CAS mount renewal 'ca_soak_clickhouse1' physical retry attempt 2 (writer_epoch=2, seq=3)
    2026-09-24 19:14:09  Debug    CAS mount renewal 'ca_soak_clickhouse1' physical retry attempt 3 (writer_epoch=2, seq=3)
    2026-09-24 19:14:09  Debug    CAS mount renewal 'ca_soak_clickhouse1' physical retry attempt 4 (writer_epoch=2, seq=3)
    2026-09-24 19:14:09  Debug    CAS mount renewal 'ca_soak_clickhouse1' physical retry attempt 5 (writer_epoch=2, seq=3)
    2026-09-24 19:14:09  Warning  CAS mount renewal 'ca_soak_clickhouse1' fenced after 5 physical attempts in 1625 ms (classification=external_lease_deadline, confirmed_deadline_boot_ms=133198636)
    
    SELECT event, value FROM system.events WHERE event LIKE 'CASMount%'
    CASMountRenewalAttempts    6
    

    system.cas_log has one watermark_renew at 19:14:09, outcome=failed, reason=CAS mount renewal ended without retained authority and fenced the mount, classification=external_lease_deadline, attempts_sent=5.

    clickhouse2 recovered on the same window instead of fencing:

    2026-09-24 19:14:12  Information  CAS mount renewal 'ca_soak_clickhouse2' recovered after 6 physical attempts in 3934 ms (classification=committed_after_retry, confirmed_deadline_boot_ms=133199157)
    

    Its watermark_renew row is at 19:14:12. CASMountRenewalAttempts is 5 there. Neither replica has CASMountRenewalRetries, CASMountRenewalRecovered, CASMountRenewalDeadlineExceeded, or CASMountLeaseLost in system.events.

    The scenario stopped when the next INSERT hit Code 210 (mount lease not held), so it did not finish the settle and recovery checks. The fenced WARNING and the watermark_renew event are both present.

  5. DimensionWieldr commented on Sep 24, 2026

    @DimensionWieldr
    CollaboratorAuthor

    Closing this. The two log lines in the report were removed before 26.6.4, and a 40-second S3 503 is supposed to fence the mount lease.

    A rerun on 26.6.4.20001.altinityantalya shows the replacement records: CasMountLeaseRenewer logs fenced after … (classification=external_lease_deadline) at Warning, and system.cas_log writes watermark_renew with outcome=failed. The Code 210 that follows is the mount refusing writes until it recovers.

    S39 now checks those. The short window no longer requires the deleted "retrying while the lease is still valid" line, because an 8-second fault can miss the 10-second renew beat. It fails only if that window logs fenced after. The long window fails unless it logs fenced after and a failed watermark_renew.

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions