#7572·workerd

Bug Report — Runtime APIs: Durable Object facet subrequest limit persists across invocations

Author: t-kouyamaCreated Sep 29, 2026Updated Sep 29, 2026

Summary

A Dynamic Worker running as a Durable Object facet appears to keep the same subrequest counter across separate invocations. With limits.subRequests: 3, three separate requests making one subrequest each succeed; the fourth and every later request fail with Too many subrequests by single Worker invocation.

I reproduced this on Workers production. It does not reproduce with local wrangler dev, where resource limits are not enforced.

Minimal reproduction

wrangler.json:

json
{
  "name": "facet-subrequest-repro",
  "main": "index.js",
  "compatibility_date": "2026-09-11",
  "durable_objects": { "bindings": [{ "name": "SUP", "class_name": "Supervisor" }] },
  "migrations": [{ "tag": "v1", "new_sqlite_classes": ["Supervisor"] }],
  "worker_loaders": [{ "binding": "LOADER" }]
}

index.js:

javascript
import { DurableObject, WorkerEntrypoint } from 'cloudflare:workers';

export class Svc extends WorkerEntrypoint {
  async ping() { return 'pong'; }
}

const facetSource = `
import { DurableObject } from 'cloudflare:workers';
export class App extends DurableObject {
  async work(n) {
    const out = [];
    for (let i = 0; i < n; i++) {
      try { await this.env.SVC.ping(); out.push('ok'); }
      catch (e) { out.push(e.message); }
    }
    return out;
  }
}`;

export class Supervisor extends DurableObject {
  facet(id, subRequests) {
    return this.ctx.facets.get(id, () => ({
      class: this.env.LOADER.get(id, () => ({
        compatibilityDate: '2026-09-11',
        mainModule: 'app.js',
        modules: { 'app.js': facetSource },
        ...(subRequests ? { limits: { subRequests } } : {}),
        env: { SVC: this.ctx.exports.Svc({ props: {} }) },
      })).getDurableObjectClass('App'),
    }));
  }
  facetWork(id, subRequests, n) {
    return this.facet(id, subRequests).work(n);
  }
  resetFacet(id) {
    this.ctx.facets.abort(id, new Error('reset'));
    return 'aborted';
  }
}

export default {
  async fetch(request, env) {
    const url = new URL(request.url);
    const id = url.searchParams.get('id') ?? 'a';
    const limit = Number(url.searchParams.get('limit') ?? 0);
    const n = Number(url.searchParams.get('n') ?? 1);
    const stub = env.SUP.getByName(id);
    if (url.pathname === '/facet') return Response.json(await stub.facetWork(id, limit, n));
    if (url.pathname === '/abort') return Response.json(await stub.resetFacet(id));
    return new Response('not found', { status: 404 });
  },
};

Deploy with wrangler deploy, then make six separate HTTP requests:

bash
for i in 1 2 3 4 5 6; do curl -s "$URL/facet?id=a&limit=3&n=1"; echo; done

The first three return ["ok"]. Calls 4–6 return ["Too many subrequests by single Worker invocation. ..."].

Observed behavior

  • With subRequests: 3, five subrequests within one facet call produce three successes followed by errors, so the per-call limit is enforced.
  • With one subrequest in each of six separate requests, calls 1–3 succeed and calls 4–6 fail.
  • The same cumulative failure occurs when the supervisor is reached through HTTP stub.fetch(), when the facet is reached through facet.fetch(), and when the facet's subrequest uses fetch() through globalOutbound.
  • Calling ctx.facets.abort() after exhaustion resets the budget: three calls succeed again, then the fourth fails.
  • Without a custom facet limit, calls making 4,000 subrequests each complete 4,000, 4,000, then 2,000 before hitting the default 10,000 total.
  • The supervisor Durable Object itself receives a fresh subrequest budget on each incoming call.

Expected behavior

Custom resource limits are documented as applying per invocation. Each new call into a facet should start with a full subrequest budget, as a regular Durable Object call does.

Suspected cause

IncomingRequest::delivered() calls limitEnforcer->topUpActor() for actors in src/workerd/io/io-context.c++. Calls into a facet appear not to receive the corresponding top-up, leaving the facet's counter tied to its lifetime rather than to an invocation.

Impact

A facet that remains active eventually loses the ability to make any subrequests. In our case, a once-per-minute task with subRequests: 50 began failing on every run exactly 50 minutes after deployment.

Environment

  • Workers Paid plan, production; measured 2026-09-29
  • compatibility_date: 2026-09-11
  • Wrangler 4.131.0