Skip to content

[Feature] Add configurable execution deadlines and memory budgets for WASM plugins #7560

Closed

Description

@Aias00

Feature Request

Add gateway-configurable execution deadlines, cancellation, and guest memory budgets to wasm-api/wasm-base.

Is your feature request related to a problem? Please describe

Request execution and data-handler callbacks synchronously call ExportFunction.apply with no deadline or execution isolation. An erroneous infinite loop or expensive guest operation can hold the caller thread indefinitely.

Chicory 1.7.3 checks thread interruption in relevant execution paths, but ShenYu does not arrange deadline-triggered interruption. Merely timing out a downstream reactive result would not prove that the synchronous guest stopped.

Memory already has module-declared/runtime limits; this is a request for a configurable ShenYu budget, not a claim that Chicory memory is unbounded. WasmLoader instance construction currently does not configure a plugin-specific memory limit.

Describe the solution you'd like

  • Define configurable execution deadlines and plugin memory limits.
  • Execute guest work in a context where timeout/cancellation can stop it without occupying gateway request threads indefinitely.
  • Apply limits consistently to compiler, interpreter, initialization and callbacks.
  • Define observable timeout/trap behavior and the disposition of an interrupted instance.
  • Test an infinite-loop guest, memory growth beyond the configured budget, argument cleanup, and successful subsequent requests.

The mechanism should account for the actual interruption guarantees of the selected runtime and host functions.

Describe alternatives you've considered

Keep limits disabled for trusted deployments while documenting that choice. An ordinary reactive timeout around the current eager synchronous call is insufficient.

Additional context

ShenYu: 2.7.2-SNAPSHOT, commit 2dff2730ff399635b2bc657e21a903f391fb9df8; Java 17; Chicory 1.7.3.

Existing 24 module tests pass but do not exercise execution limits.

Activity

  1. github-actions commented on Oct 12, 2026

    @github-actions
    Contributor

    👋 Hello @Aias00

    A new issue has been opened by @Aias00:

    Please review when you have time. Thank you! 🙏

  2. yangjj-iso commented on Oct 12, 2026

    @yangjj-iso
    Contributor

    /assign

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions