Skip to content

app-patterns: promise_all_chains rejects with a resolution value at scale (Uncaught (in promise) 0) #7497

Description

@proggeramlug

Split out of #7475, which turned out to be two unrelated defects. #7495 fixes the iterator-drain rooting bug that made object_deep_clone fail; this one is untouched by it.

Repro

PERRY_RUNTIME_DIR=$PWD/target/release ./target/release/perry \
  benchmarks/app-patterns/kernels/promise_all_chains.ts -o /tmp/p && /tmp/p
link before #7495 after #7495
PERRY_NO_AUTO_OPTIMIZE=1 Uncaught (in promise) 0 Uncaught (in promise) 0
auto-optimize (default) TypeError: value is not a function Uncaught (in promise) TypeError: value is not a function

Node prints checksum: 2500050000.

Why this is a separate defect from #7475's rooting bug

#7495 roots the five live GC values js_iterator_to_array carried in bare Rust locals across an allocating .next(). That made object_deep_clone correct under both links. promise_all_chains is unchanged by it, in both configurations — which is the evidence that it is not the same family.

The PERRY_NO_AUTO_OPTIMIZE=1 message is the interesting one. Uncaught (in promise) 0 says a promise REJECTED with the value 0 — and 0 is unitOfWork(0)'s first await Promise.resolve(i) value, i.e. a resolution value arriving on the rejection path, not a rooting-shaped wild pointer.

Scale-dependent

The kernel is N_BATCHES = 1000, BATCH_SIZE = 50 — 50 000 three-deep await chains, drained 50 at a time through Promise.all. Reduced to N_BATCHES = 3, BATCH_SIZE = 5 it prints the correct checksum: 240. So it needs scale; a first look should establish whether the threshold is a count, a microtask-queue depth, or a collection.

Impact

This is the last blocker on the public benchmark artifact: run_public_baseline.sh completes all four legs and then refuses on "app-pattern component is incomplete or has a correctness failure" for this one kernel. It is also the single entry in the skip list of the new auto-opt-app-patterns gate (scripts/auto_opt_app_patterns.sh), and that list is rot-checked — a skip naming a kernel that no longer exists fails the script — so the line comes out with the fix.

The other eleven app-pattern kernels pass through the auto-optimize link on #7495's branch.

Metadata

Metadata

Assignees

No one assigned

    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