-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Tracing finalTimeout
blocks Angular Zone stabilisation
#8983
Comments
Hi @henry-alakazhang thanks for writing in! The reason why we need this timeout ( A question: Is there a reason why you're not using our Angular routing instrumentation as shown in our docs? Similarly, are you using I'm curious if using routing instrumentation and TraceService change anything w.r.t to this behaviour. Otherwise, I don't think we can get rid of the Do you think starting the idle transactions outside the NgZone would make a difference here? |
Thanks for the response @Lms24.
The
Yeah, that'd be one way to fix the issue. I'm curious though if there's a reason the |
That's an interesting observation, thanks! We'll take a look at this in greater detail next week. Maybe there's something we can fix more generally here; otherwise I'll go with running outside the ngzone. |
Yeah this was done on purpose because we didn't want there to be a infinitely running transaction, so we used a timeout to hard cut it off. I wonder if we should use |
Considering the changes made in #11703 and #11748 to the Angular tracer and error handler, it should now be possible to fix all of the issues you may have been facing previously. All of the Sentry functionality is now running outside of the Angular zone, meaning Angular is unaware of any tasks being scheduled within its context. As a result, server-side rendering, hydration, and early stabilization would now only rely on tasks being scheduled explicitly by the consumer. If you're still facing any issues, I can guide you through the process of identifying which tasks are preventing the application from becoming stable and determining if Sentry is the cause of them. |
I'm gonna close this issue as to the best of my knowledge this was addressed in the PRs mentioned in the comment above. Please let me know if it should be reopened. |
Is there an existing issue for this?
How do you use Sentry?
Sentry Saas (sentry.io)
Which SDK are you using?
@sentry/angular-ivy
SDK Version
7.57.0
Framework Version
Angular 15.2.0
Link to Sentry event
No response
SDK Setup
Steps to Reproduce
pageload
ornavigation
operationExpected Result
Angular's zone should stabilize and
appRef.isStable
/testability.whenStable
should emit after network requests have finished and app is stable.eg. code like this should log:
Actual Result
NgZone doesn't stabilise because of a pending timeout from
finalTimeout
. It only stabilises after 30 seconds (the default value of the finalTimeout), even if the idle timeout and heartbeat interval have already completed.We utilise the stability API for a number of things (e2e tests, performance tracking) which have been affected by upgrading from Sentry 6 to 7. Our e2e tests against our dev environment take longer to run, and long task tracking is less accurate.
We've worked around it partially by running
Sentry.init
outside of the Angular zone (see snippet above) but this only affects thepageload
event and not future navigations.I've tested this using
@sentry/browser
,@sentry/angular
and@sentry/angular-ivy
and the behaviour is the same.Thanks.
The text was updated successfully, but these errors were encountered: