Skip to content

Fix GC unsafe-zone handling for server adapters#1429

Merged
proggeramlug merged 7 commits into
PerryTS:mainfrom
andrewtdiz:codex/issue-1425-gc-unsafe-zones
May 23, 2026
Merged

Fix GC unsafe-zone handling for server adapters#1429
proggeramlug merged 7 commits into
PerryTS:mainfrom
andrewtdiz:codex/issue-1425-gc-unsafe-zones

Conversation

@andrewtdiz
Copy link
Copy Markdown
Contributor

Summary

  • make automatic/deferred GC paths respect GC_UNSAFE_ZONES, matching manual gc() behavior
  • remove stale lifetime-wide unsafe-zone guards from Fastify/ws/http server adapters now that workers queue Rust data and JS dispatch runs on the main thread
  • move Fastify upgrade request-object allocation to the main-thread pump and add a regression test for automatic trigger suppression

Fixes #1425.

Verification

  • cargo fmt --all
  • git diff --check
  • PERRY_GC_TRACE=1 PERRY_GC_DIAG=1 cargo test -p perry-runtime unsafe_zone --lib -- --nocapture
  • PERRY_GC_FORCE_EVACUATE=1 PERRY_GC_VERIFY_EVACUATION=1 cargo test -p perry-ext-fastify gc_mutable_scanner_rewrites_registered_roots --lib -- --nocapture
  • PERRY_GC_FORCE_EVACUATE=1 PERRY_GC_VERIFY_EVACUATION=1 cargo test -p perry-ext-http-server gc_mutable_scanner_rewrites_server_wrapper_and_request_response_roots --lib -- --nocapture
  • PERRY_GC_FORCE_EVACUATE=1 PERRY_GC_VERIFY_EVACUATION=1 cargo test -p perry-ext-ws gc_mutable_scanner_rewrites_client_and_server_listener_roots --lib -- --nocapture

Respect GC_UNSAFE_ZONES across automatic GC paths and remove stale server-lifetime unsafe zones now that Fastify/ws/http adapters queue Rust data and dispatch JS on the main thread. Move Fastify upgrade request object allocation back to the main-thread pump and add regression coverage for automatic trigger suppression.\n\nFixes PerryTS#1425
@proggeramlug proggeramlug merged commit 3bee810 into PerryTS:main May 23, 2026
9 checks passed
proggeramlug added a commit that referenced this pull request May 23, 2026
…es (#1458)

Rolls up 22 PRs that merged to main post-v0.5.1025 without per-PR
version bumps.

- node:timers epic (#1213, 6 PRs #1449-#1455): node:timers/promises
  setTimeout/setImmediate, numeric-id clear*, namespace import, ref()
  typeof, Symbol.dispose, global setImmediate/clearImmediate.
- node:perf_hooks fan-out (10 PRs across #1320 #1327 #1337-#1340
  #1388-#1390 #1403): typeof methods, performance singleton identity,
  nodeTiming, toJSON, clearResourceTimings, structured-clone detail,
  observer arg + buffered + throw cases.
- node:json lazy-tape closes #1424 (#1447) — JSON.parse reviver on
  lazy-tape arrays no longer SIGSEGVs (test un-skip-listed).
- #1448 console.log/util.inspect on lazy-tape arrays materialises
  before formatting.
- #1429 GC unsafe-zone guards for fastify/hyper handlers.
- #1341 codegen: Any-typed .includes()/.indexOf() dynamic dispatch.
- #1370 perry/ui web driver debug noise dropped.

#1423 (AsyncLocalStorage .enterWith/.exit) remains skip-listed.
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.

GC: RSS & event-loop pause growth on long-running Fastify/ws servers (GC_UNSAFE_ZONES — manual gc() disabled, auto-GC unbounded)

2 participants