Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX LTS] Fix cyclic module crash #20461

Merged
merged 1 commit into from May 17, 2023
Merged

[BUGFIX LTS] Fix cyclic module crash #20461

merged 1 commit into from May 17, 2023

Conversation

ef4
Copy link
Contributor

@ef4 ef4 commented May 16, 2023

@ember/engine/index and @ember/engine/instance have circular dependencies on each other.

This would be OK, except that instance.ts is eagerly copying a class off index.ts, at a point in time where it might not actually be available.

Whether this bug hits you depends on which side of the pair gets evaluated first. I only happened to hit it when testing an app with engines and fastboot on Ember 5. The exception looks like:

TypeError: Right-hand side of 'instanceof' is not an object

The fix is to not eagerly pull the class off the module.

Copy link
Contributor

@MelSumner MelSumner left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the improved clarity of the naming here as well. 👍

Copy link
Contributor

@chriskrycho chriskrycho left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. Looks like this should probably be BUGFIX LTS?

`@ember/engine/index` and `@ember/engine/instance` have circular dependencies on each other.

This would be OK, except that `instance.ts` is eagerly copying a class off `index.ts`, at a point in time where it might not actually be available.

Whether this bug hits you depends on which side of the pair gets evaluated first. I only happened hit it when testing an app with engines and fastboot on Ember 5.

This fix is to not eagerly pull the class off the module.
@ef4 ef4 changed the title Fix cyclic module crash [BUGFIX LTS] Fix cyclic module crash May 17, 2023
@ef4
Copy link
Contributor Author

ef4 commented May 17, 2023

Rewrote the commit and the PR to say "BUGFIX LTS".

@ef4 ef4 merged commit d5bf5f3 into main May 17, 2023
3 checks passed
@ef4 ef4 deleted the fix-cycle-crash branch May 17, 2023 21:17
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.

None yet

3 participants