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

fix: prevent invoking destroyed injector #1500

Merged
merged 1 commit into from
Sep 8, 2023

Conversation

dhhyi
Copy link
Collaborator

@dhhyi dhhyi commented Sep 5, 2023

PR Type

[x] Bugfix

What Is the Current Behavior?

While doing performance tests, the SSR deployments regularly crash with the following stacktrace:

1 b2c /dist/b2c/server/webpack:/node_modules/@angular/core/fesm2020/core.mjs:7970
            throw new RuntimeError(205 /* RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED */, ngDevMode && 'Injector has already been destroyed.');
                  ^
1 b2c Error: NG0205
    at R3Injector.assertNotDestroyed (/dist/b2c/server/webpack:/node_modules/@angular/core/fesm2020/core.mjs:7970:19)
    at R3Injector.get (/dist/b2c/server/webpack:/node_modules/@angular/core/fesm2020/core.mjs:7877:14)
    at Object.next (/dist/b2c/server/webpack:/src/app/core/utils/module-loader/module-loader.service.ts:23:36)
    at ConsumerObserver2.next (/dist/b2c/server/webpack:/node_modules/rxjs/dist/cjs/internal/Subscriber.js:113:33)
    at SafeSubscriber2._next (/dist/b2c/server/webpack:/node_modules/rxjs/dist/cjs/internal/Subscriber.js:80:26)
    at SafeSubscriber2.next (/dist/b2c/server/webpack:/node_modules/rxjs/dist/cjs/internal/Subscriber.js:51:18)
    at onNext (/dist/b2c/server/webpack:/node_modules/rxjs/dist/cjs/internal/operators/filter.js:9:164)
    at OperatorSubscriber2._next (/dist/b2c/server/webpack:/node_modules/rxjs/dist/cjs/internal/operators/OperatorSubscriber.js:33:21)
    at OperatorSubscriber2.next (/dist/b2c/server/webpack:/node_modules/rxjs/dist/cjs/internal/Subscriber.js:51:18)
    at /dist/b2c/server/webpack:/node_modules/rxjs/dist/cjs/internal/operators/distinctUntilChanged.js:18:28

What Is the New Behavior?

Subscription in module loader is stopped.

Does this PR Introduce a Breaking Change?

[ ] Yes
[ ] No

Other Information

AB#89238

@dhhyi dhhyi added the bug Something isn't working label Sep 5, 2023
@SGrueber SGrueber self-requested a review September 6, 2023 06:18
@SGrueber
Copy link
Collaborator

SGrueber commented Sep 6, 2023

@dhhyi Would it be recommended to stop open subscriptions in other services, too if they are destroyed ?

@dhhyi
Copy link
Collaborator Author

dhhyi commented Sep 6, 2023

@dhhyi Would it be recommended to stop open subscriptions in other services, too if they are destroyed ?

Only this particular case caused some issues that showed in the error log. I wouldn't make it a rule as services are usually only destroyed at the end of life of the application.

@SGrueber SGrueber added the wait Waiting for something (e.g. new ICM release) label Sep 6, 2023
@SGrueber SGrueber requested review from shauke and removed request for SGrueber September 6, 2023 08:54
@dhhyi dhhyi removed their assignment Sep 6, 2023
@shauke shauke added this to the 4.2 milestone Sep 8, 2023
@shauke shauke merged commit 6cabc7d into develop Sep 8, 2023
24 checks passed
@shauke shauke deleted the fix/prevent-destroyed-injector-access branch September 8, 2023 13:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wait Waiting for something (e.g. new ICM release)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants