Skip to content

fix: mysql2 request isolation, forwarded-array loops, parent prototypes, reactor HTTP scheduling - #8778

Merged
proggeramlug merged 1 commit into
mainfrom
merge/b42
Aug 24, 2026
Merged

fix: mysql2 request isolation, forwarded-array loops, parent prototypes, reactor HTTP scheduling#8778
proggeramlug merged 1 commit into
mainfrom
merge/b42

Conversation

@proggeramlug

@proggeramlug proggeramlug commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Lands #8765, #8767, #8768 and #8769.

  • fix(mysql2): isolate prepared operations and pool transactions #8765 — stops mysql2 prepared statements and pool transactions leaking state across requests. Each SQL string and parameter vector lives in one owned request, parameterless query() uses the text protocol, prepared statements are request-scoped, and registry-backed mutable connection references become serialized owned handles with safe close/release around in-flight work.
  • perf(codegen): admit forwarded arrays in versioned loops #8767 — admits arrays reached through one validated forwarding edge into version-stable indexed loops, canonicalizing the compiler-private local to the live array after the full header/fingerprint check. Per-iteration fingerprint guards are retained, so callback-driven growth or a GC still side-exits before the next effect, and invalid targets or longer forwarding chains fail closed to the generic loop.
  • fix(runtime): materialize ordinary parent prototypes #8768 — materializes ordinary parent prototypes (carries its own fragment).
  • fix(http): schedule shared HTTP/WS servers on reactor #8769 — schedules HTTP and HTTPS accept loops through the reactor-owned async bridge, same path for Unix round-robin fd injection, with an end-to-end regression for WebSocketServer on node:http followed by a plain fetch.

Validation (on the merged result)

  • All 30 lint-job checkers pass
  • perry-runtime --lib (RUST_TEST_THREADS=1): 2674 passed, 0 failed
  • perry-codegen --lib: 1230 passed, 0 failed (+1)
  • perry-codegen --tests (all integration suites): 0 failures
  • perry-ext-mysql2 --lib: 10 passed, 0 failedfix(mysql2): isolate prepared operations and pool transactions #8765's own subject suite
  • Squashed tree verified identical to the validated tree

Changelog fragments added for #8765, #8767 and #8769 — none carried one or a skip-changelog label. No version bump.

Summary by CodeRabbit

  • Bug Fixes
    • Improved MySQL request isolation, prepared statements, connection cleanup, and transaction handling.
    • Fixed HTTP and WebSocket server scheduling to improve shared-server reliability.
    • Corrected prototype behavior when extending runtime-valued functions.
    • Improved indexed array loops when arrays are moved during garbage collection, with safe fallback handling.
  • Tests
    • Added regression coverage for MySQL operations, HTTP/WebSocket servers, array forwarding, and prototype inheritance.
  • Documentation
    • Added changelog entries describing these fixes and improvements.

…es, reactor HTTP scheduling

Lands #8765, #8767, #8768 and #8769.

#8765 stops mysql2 prepared statements and pool transactions leaking
state across requests: each SQL string and parameter vector lives in one
owned request, a parameterless `query()` uses the text protocol, prepared
statements are request-scoped, and registry-backed mutable connection
references become serialized owned handles with safe close/release around
in-flight work.

#8767 admits arrays reached through one validated forwarding edge into
version-stable indexed loops, canonicalizing the compiler-private local
to the live array after the full header/fingerprint check. Per-iteration
fingerprint guards are retained, so callback-driven growth or a GC still
side-exits before the next effect, and invalid targets or longer chains
fail closed to the generic loop.

#8768 materializes ordinary parent prototypes.

#8769 schedules HTTP and HTTPS accept loops through the reactor-owned
async bridge, using the same path for Unix round-robin fd injection.

Changelog fragments added for #8765, #8767 and #8769; none carried one or
a skip-changelog label. No version bump.
@coderabbitai

coderabbitai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: fe892378-ac16-4f4a-931e-b7d87f5b9f23

📥 Commits

Reviewing files that changed from the base of the PR and between 921f49c and ac79b7d.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (15)
  • changelog.d/8765-mysql2-request-scoped-statements.md
  • changelog.d/8767-forwarded-arrays-versioned-loops.md
  • changelog.d/8768-runtime-parent-function-prototype.md
  • changelog.d/8769-http-ws-reactor-scheduling.md
  • crates/perry-codegen/src/codegen/index_method_clone_tests.rs
  • crates/perry-codegen/src/stmt/versioned_indexed_loop.rs
  • crates/perry-ext-http/src/server/https_server.rs
  • crates/perry-ext-http/src/server/server.rs
  • crates/perry-ext-mysql2/Cargo.toml
  • crates/perry-ext-mysql2/src/lib.rs
  • crates/perry-ext-mysql2/src/test_async_shims.rs
  • crates/perry-runtime/src/object/class_registry/state.rs
  • crates/perry/tests/issue_8747_http_ws_shared_server.rs
  • crates/perry/tests/versioned_indexed_loop_forwarding.rs
  • test-files/test_issue_8745_8746_mysql2_operation_isolation.ts

📝 Walkthrough

Walkthrough

The PR fixes MySQL request-state isolation, forwarded-array loop admission, HTTP and HTTPS reactor scheduling, and runtime function prototype resolution. It adds regression tests and test-only async shims for these changes.

Changes

MySQL request isolation

Layer / File(s) Summary
Request-owned query execution
crates/perry-ext-mysql2/src/lib.rs
Queries now use owned request state, shared mutex-backed targets, serialized access, explicit pool acquisition, and text or prepared protocol selection.
Handle lifecycle and method dispatch
crates/perry-ext-mysql2/src/lib.rs
Close and release operations wait for shared state. Generic dispatch supports prepared execution and pool-connection transactions.
MySQL validation and test runtime
crates/perry-ext-mysql2/Cargo.toml, crates/perry-ext-mysql2/src/test_async_shims.rs, crates/perry-ext-mysql2/src/lib.rs, test-files/test_issue_8745_8746_mysql2_operation_isolation.ts, changelog.d/8765-mysql2-request-scoped-statements.md
Test-only async shims and regression tests cover request isolation, prepared execution, serialized handles, and transaction behavior.

Forwarded-array indexed loops

Layer / File(s) Summary
Forwarding-aware loop admission
crates/perry-codegen/src/stmt/versioned_indexed_loop.rs, crates/perry-codegen/src/codegen/index_method_clone_tests.rs, changelog.d/8767-forwarded-arrays-versioned-loops.md
Array admission validates one forwarding edge, rejects invalid or longer chains, and stores the canonical live handle before the fast loop.
GC evacuation regression coverage
crates/perry/tests/versioned_indexed_loop_forwarding.rs
The integration test exercises array growth under normal and forced-evacuation GC and checks the expected sum and lengths.

HTTP and WebSocket reactor scheduling

Layer / File(s) Summary
Direct reactor-owned accept loops
crates/perry-ext-http/src/server/server.rs, crates/perry-ext-http/src/server/https_server.rs
HTTP and HTTPS accept loops now use perry_ffi::spawn_async instead of nested Tokio tasks inside blocking-reactor callbacks.
Shared HTTP and WebSocket regression coverage
crates/perry/tests/issue_8747_http_ws_shared_server.rs, changelog.d/8769-http-ws-reactor-scheduling.md
The end-to-end test attaches a WebSocket server to an HTTP server and verifies a successful plain HTTP request.

Runtime function prototype resolution

Layer / File(s) Summary
Function-parent prototype lookup
crates/perry-runtime/src/object/class_registry/state.rs, changelog.d/8768-runtime-parent-function-prototype.md
Function-valued class parents now resolve .prototype through js_function_prototype_value_for_read.

Estimated code review effort: 5 (Critical) | ~120 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch merge/b42

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

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.

1 participant