Skip to content

CAS: an 8-second S3 503 fences the mount lease while the lease budget remains #2431

Closed

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

An 8-second burst of S3 503s on PUT and POST fences the CAS mount lease. The renew period is 10 seconds and the lease TTL is 30 seconds, so that window can overlap at most one renewal. The renewal that hits it should recover. Instead CasMountLeaseRenewer fences in about 2 seconds and reports classification=external_lease_deadline while remaining_confirmed_budget_ms is still about 17000. The next INSERT fails with Code 210, mount lease not held.

This showed up while rechecking the short fault in the S39 soak card, after #2423. That issue was a stale log line on a 40-second fault, which is supposed to fence. This one is the 8-second fault.

This issue:

  • Fences on a fresh pool, with no earlier fenced after line in system.text_log
  • Leaves about 17 seconds of confirmed budget at the moment of the fence
  • Reproduced on two wiped clusters. The first time both replicas fenced. The second time clickhouse2 fenced and clickhouse1 logged recovered after

How to reproduce the behavior

Environment

  • Version: 26.6.4.20001.altinityantalya
  • Build type: release
  • Image: altinity/clickhouse-server:26.6.4.20001.altinityantalya

Steps

  1. Start two replicas with a fresh ca disk and an empty object-store prefix. Point the disk through an S3 fault proxy. The proxy is disarmed (rate 0). writer_epoch in these runs is 2 because the server restarts once to attach the proxy. There is no prior fence.

  2. Create a replicated table on the ca disk and insert some rows.

  3. Arm the proxy for 8 seconds: every PUT and POST returns 503. Then set the rate back to 0.

  4. Read the renewer log and the CAS log for that window.

SELECT event_time, level, message
FROM system.text_log
WHERE logger_name = 'CasMountLeaseRenewer'
ORDER BY event_time;

SELECT event_time, outcome, detail
FROM system.cas_log
WHERE event_type = 'watermark_renew'
ORDER BY event_time;

Expected behavior

A renewal that overlaps the 8-second fault logs recovered after and keeps the lease. A renewal that misses the 10-second beat logs nothing. The following INSERT succeeds. The lease fences only when the fault is held past the 30-second TTL.


Actual behavior

On release builds

Run 1, both replicas, fence at 23:03:35, seven seconds after the window opened at 23:03:28.

clickhouse1:

CAS mount renewal 'ca_soak_clickhouse1' fenced after 5 physical attempts in 2255 ms (classification=external_lease_deadline, confirmed_deadline_boot_ms=146964336)

watermark_renew outcome=failed, elapsed_ms=2255, remaining_confirmed_budget_ms=17745, writer_epoch=2.

clickhouse2: fenced after 5 physical attempts in 1803 ms, remaining_confirmed_budget_ms=18197.

The next INSERT failed:

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)

Run 2, fresh pool. The short window opened at 23:06:41.

clickhouse1 recovered at 23:06:49: recovered after 8 physical attempts in 3576 ms (classification=committed_after_retry), remaining_confirmed_budget_ms=16424.

clickhouse2 fenced at 23:06:49: fenced after 6 physical attempts in 2634 ms (classification=external_lease_deadline), remaining_confirmed_budget_ms=17366, writer_epoch=2.

The S39 card only queries clickhouse1, so this run passed the short-fault check.


Additional context

The same classification also fires a few seconds into the 40-second fault, again with about 17 seconds of budget left (clickhouse1 at 23:06:58, elapsed_ms=2527, remaining_confirmed_budget_ms=17473). A fault that long is supposed to fence after the TTL. Fencing in 2.5 seconds is the same early deadline.

Related: #2423 (closed; the 40-second fault does emit the new renewer records).

Activity

  1. added
    bug
    on Sep 24, 2026
  2. DimensionWieldr commented on Sep 24, 2026

    @DimensionWieldr
    CollaboratorAuthor

    The clickhouse-server.log from run 2 shows the renewal PUT itself getting the 503, then the renewer giving up while the object is still present.

    clickhouse2, during the 8-second window. Each attempt writes soak_pool/gc/server-roots/ca_soak_clickhouse2/mount and gets SlowDown:

    2026.09.24 23:06:46.791563 [ 1457 ] {} <Debug> WriteBufferFromS3: S3Exception name SlowDown, Message: Please reduce your request rate., bucket warehouse, key soak_pool/gc/server-roots/ca_soak_clickhouse2/mount, object size 312
    2026.09.24 23:06:46.972921 [ 1457 ] {} <Debug> AWSClient: Retrying S3 request to: http://s3proxy:9000/warehouse/soak_pool/gc/server-roots/ca_soak_clickhouse2/mount, aws sdk attempt: 1, clickhouse attempt: 2, kind: Write
    2026.09.24 23:06:47.250968 [ 1457 ] {} <Debug> AWSClient: Retrying S3 request to: http://s3proxy:9000/warehouse/soak_pool/gc/server-roots/ca_soak_clickhouse2/mount, aws sdk attempt: 1, clickhouse attempt: 3, kind: Write
    2026.09.24 23:06:47.573021 [ 1457 ] {} <Debug> AWSClient: Retrying S3 request to: http://s3proxy:9000/warehouse/soak_pool/gc/server-roots/ca_soak_clickhouse2/mount, aws sdk attempt: 1, clickhouse attempt: 4, kind: Write
    2026.09.24 23:06:48.213160 [ 1457 ] {} <Debug> AWSClient: Retrying S3 request to: http://s3proxy:9000/warehouse/soak_pool/gc/server-roots/ca_soak_clickhouse2/mount, aws sdk attempt: 1, clickhouse attempt: 5, kind: Write
    2026.09.24 23:06:49.376068 [ 1457 ] {} <Debug> AWSClient: Retrying S3 request to: http://s3proxy:9000/warehouse/soak_pool/gc/server-roots/ca_soak_clickhouse2/mount, aws sdk attempt: 1, clickhouse attempt: 6, kind: Write
    2026.09.24 23:06:49.377667 [ 1457 ] {} <Debug> WriteBufferFromS3: S3Exception name SlowDown, Message: Please reduce your request rate., bucket warehouse, key soak_pool/gc/server-roots/ca_soak_clickhouse2/mount, object size 312
    2026.09.24 23:06:49.423121 [ 1459 ] {} <Warning> CasWriteRetryLater: CAS write could not be committed (CAS mount-lease renewal for key 'soak_pool/gc/server-roots/ca_soak_clickhouse2/mount' did not retain the lease (external_lease_deadline, at least one attempt sent, last observation: present (etag:"0eb40892635b29006c484268e5e1aba6"))); retrying later
    2026.09.24 23:06:49.423358 [ 1459 ] {} <Warning> CasMountLeaseRenewer: CAS mount renewal 'ca_soak_clickhouse2' fenced after 6 physical attempts in 2634 ms (classification=external_lease_deadline, confirmed_deadline_boot_ms=147157682)
    

    The last observation is present with an etag, so the mount object was still there when the renewer fenced.

    clickhouse1 in the same window took the other path. Same 503s on .../ca_soak_clickhouse1/mount, then:

    2026.09.24 23:06:49.795251 [ 1452 ] {} <Information> CasMountLeaseRenewer: CAS mount renewal 'ca_soak_clickhouse1' recovered after 8 physical attempts in 3576 ms (classification=committed_after_retry, confirmed_deadline_boot_ms=147157112)
    
  3. filimonov commented on Oct 1, 2026

    @filimonov
    Member

    Confirmed. Real bug.

    Working on a fix.

  4. self-assigned this
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CASantalyabug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions