Skip to content

Custom limits for dynamic workers#6399

Open
git-bruh wants to merge 1 commit intomainfrom
pkhanna/custom-dynamic-worker-limits
Open

Custom limits for dynamic workers#6399
git-bruh wants to merge 1 commit intomainfrom
pkhanna/custom-dynamic-worker-limits

Conversation

@git-bruh
Copy link
Copy Markdown

No description provided.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@git-bruh
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

github-actions bot added a commit that referenced this pull request Mar 24, 2026
Copy link
Copy Markdown
Contributor

@ask-bonk ask-bonk bot left a comment

Choose a reason for hiding this comment

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

I'm Bonk, and I've done a quick review of your PR.

This PR adds a ResourceLimits struct (with cpuMs and subRequests) and plumbs it through the dynamic worker loading and entrypoint/actor-class APIs. I found three issues, two of which are high severity.

  1. [HIGH] Build break: WorkerStubImpl in server.c++:4107-4114 does not accept the new limits parameter, so the override keyword will fail to compile against the updated pure virtual interface in WorkerStubChannel.
  2. [HIGH] Bug in DynamicWorkerSource::clone(): The new .limits field is not propagated by the clone() method (io-channels.h:361-372), so cloned sources silently lose their limits. This code path is exercised by WorkerLoader::load(), which calls source.clone() inside a closure that may be invoked multiple times.
  3. [LOW] No tests: There are no tests covering the new limits plumbing — neither for WorkerCode.limits flowing into DynamicWorkerSource, nor for EntrypointOptions.limits flowing into getEntrypoint()/getActorClass().

This review was generated by an AI assistant and may contain inaccuracies.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 24, 2026

The generated output of @cloudflare/workers-types matches the snapshot in types/generated-snapshot 🎉

@ask-bonk
Copy link
Copy Markdown
Contributor

ask-bonk bot commented Mar 24, 2026

Review posted successfully on PR #6399. Here's a summary of the findings:

  1. [HIGH] Build break: WorkerStubImpl in server.c++ overrides getEntrypoint and getActorClass with the old two-parameter signatures, but the base class WorkerStubChannel now requires a third kj::Maybe<ResourceLimits> limits parameter. The override keyword will cause a compilation failure.

  2. [HIGH] DynamicWorkerSource::clone() drops limits: The clone() method does not include the new .limits field in its designated-initializer list, so cloned sources silently lose their resource limits. This affects the WorkerLoader::load() path.

  3. [LOW] No tests for the new limits plumbing.

github run

@git-bruh git-bruh force-pushed the pkhanna/custom-dynamic-worker-limits branch from 6dcfdce to 7588383 Compare March 24, 2026 16:39
@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Mar 24, 2026

Merging this PR will not alter performance

✅ 70 untouched benchmarks
⏩ 129 skipped benchmarks1


Comparing pkhanna/custom-dynamic-worker-limits (d1dbd0f) with main (0f907f5)

Open in CodSpeed

Footnotes

  1. 129 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.


JSG_STRUCT(cpuMs, subRequests);

ResourceLimits clone() const {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

We probably don't need a clone() method since the struct is trivially copyable anyway.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, I'd actually shifted the struct out of edgeworker and this method was being used in quite a few places so I let it be as-is for consistency

@git-bruh git-bruh force-pushed the pkhanna/custom-dynamic-worker-limits branch 2 times, most recently from 0f4f880 to 77f9e20 Compare March 25, 2026 07:01
@git-bruh git-bruh marked this pull request as ready for review March 25, 2026 07:02
@git-bruh git-bruh requested review from a team as code owners March 25, 2026 07:02
@git-bruh git-bruh requested a review from edmundhung March 25, 2026 07:02
@git-bruh git-bruh force-pushed the pkhanna/custom-dynamic-worker-limits branch from 77f9e20 to d1dbd0f Compare March 27, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants