Skip to content

fix(js): roll back module lifecycle initialization#52

Open
GrapeBaBa wants to merge 5 commits into
mainfrom
fix/module-init-rollback
Open

fix(js): roll back module lifecycle initialization#52
GrapeBaBa wants to merge 5 commits into
mainfrom
fix/module-init-rollback

Conversation

@GrapeBaBa

@GrapeBaBa GrapeBaBa commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Summary

  • centralize lifecycle reference release for cleanup hooks and initialization failures
  • run module cleanup when export registration fails after successful initialization
  • restore the environment refcount without cleanup when initialization itself fails
  • add focused coverage for cleanup gating and refcount restoration

Motivation

Module initialization currently increments the shared environment refcount before invoking the addon initializer. If declaration registration, custom registration, or cleanup-hook registration then fails, the refcount is rolled back but initialized native state is left alive. A later retry can double-initialize or fail because the previous global state still exists.

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