Skip to content

Bound capability call's max concurrency#2074

Merged
justinkaseman merged 15 commits into
mainfrom
fix/bound-callcap-goroutines
May 23, 2026
Merged

Bound capability call's max concurrency#2074
justinkaseman merged 15 commits into
mainfrom
fix/bound-callcap-goroutines

Conversation

@justinkaseman
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings May 20, 2026 00:28
@justinkaseman justinkaseman requested a review from a team as a code owner May 20, 2026 00:28
@github-actions
Copy link
Copy Markdown

👋 justinkaseman, thanks for creating this pull request!

To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team.

Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks!

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 20, 2026

✅ API Diff Results - github.com/smartcontractkit/chainlink-common

✅ Compatible Changes (1)

pkg/workflows/wasm/host.ModuleConfig (1)
  • PendingCallsLimiter — ➕ Added

📄 View full apidiff report

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a per-execution concurrency bound for asynchronous host calls (capability calls and secrets retrieval) made from WASM workflows, to avoid unbounded goroutine growth and backpressure these operations when the limit is reached.

Changes:

  • Add ModuleConfig.MaxPendingCalls with a default value and wire it into module creation/execution.
  • Introduce a per-execution semaphore and use it to bound concurrency in callCapAsync and getSecretsAsync.
  • Update tests that directly construct execution to initialize the new semaphore field.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
pkg/workflows/wasm/host/module.go Adds MaxPendingCalls config/defaulting and initializes the per-execution semaphore.
pkg/workflows/wasm/host/execution.go Uses the semaphore to cap concurrent goroutines for capability/secrets async calls.
pkg/workflows/wasm/host/module_test.go Initializes pendingCallsSem in a concurrency-related test execution instance.
pkg/workflows/wasm/host/execution_await_order_test.go Initializes pendingCallsSem in await-ordering test execution instance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pkg/workflows/wasm/host/module.go Outdated
}

if modCfg.MaxPendingCalls == 0 {
modCfg.MaxPendingCalls = defaultMaxPendingCalls
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.

Worth being a uint maybe?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This doesn't add cleanly with the ResourcePoolLimiter. We would have to cast it everywhere.

I'll just add the guard.

Comment thread pkg/workflows/wasm/host/module.go Outdated
Comment thread pkg/workflows/wasm/host/module.go Outdated
Comment thread pkg/workflows/wasm/host/module_test.go Outdated
Comment thread pkg/workflows/wasm/host/execution_await_order_test.go Outdated
@justinkaseman justinkaseman force-pushed the fix/bound-callcap-goroutines branch from 6cead5b to b932fc6 Compare May 20, 2026 01:11
Comment thread pkg/workflows/wasm/host/execution.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment thread pkg/workflows/wasm/host/execution.go
Comment thread pkg/workflows/wasm/host/execution.go
Comment thread pkg/workflows/wasm/host/execution.go Outdated
Comment thread pkg/workflows/wasm/host/execution.go
Comment thread pkg/workflows/wasm/host/module.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.

Comment thread pkg/workflows/wasm/host/module.go Outdated
Comment thread pkg/workflows/wasm/host/module.go Outdated
Comment thread pkg/workflows/wasm/host/module.go Outdated
Comment thread pkg/workflows/wasm/host/module.go Outdated
jmank88
jmank88 previously approved these changes May 22, 2026
jmank88
jmank88 previously approved these changes May 22, 2026
bolekk
bolekk previously approved these changes May 22, 2026
@justinkaseman justinkaseman enabled auto-merge May 22, 2026 18:29
@justinkaseman justinkaseman added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
@justinkaseman justinkaseman dismissed stale reviews from bolekk and jmank88 via fbee7a6 May 22, 2026 19:24
@justinkaseman justinkaseman requested review from bolekk and jmank88 May 22, 2026 19:24
bolekk
bolekk previously approved these changes May 22, 2026
Comment thread pkg/workflows/wasm/host/execution_semaphore_test.go Outdated
jmank88
jmank88 previously approved these changes May 22, 2026
@justinkaseman justinkaseman added this pull request to the merge queue May 22, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks May 22, 2026
@justinkaseman justinkaseman dismissed stale reviews from jmank88 and bolekk via f51eeb0 May 22, 2026 21:39
@justinkaseman justinkaseman requested review from bolekk and jmank88 May 22, 2026 21:39
@justinkaseman justinkaseman added this pull request to the merge queue May 22, 2026
Merged via the queue into main with commit ce0c8e8 May 23, 2026
32 of 33 checks passed
@justinkaseman justinkaseman deleted the fix/bound-callcap-goroutines branch May 23, 2026 00:02
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.

5 participants