Skip to content

Infinite loop when zone-patch-rxjs is used #12686

Closed

Description

@cstickel

Bug

Starting with angular cdk version 6.4.3 there seems to be an incompatibility with zone-patch-rxjs which causes an infinite loop. For this reason some components, in our case the datepicker, won't work as expected.

What is the expected behavior?

When selecting a date in the datepicker (or closing it by clicking outside of the datepicker) it should not cause an error. It should also be possible to open the datepicker a second time.

What is the current behavior?

When selecting a date in the datepicker it throws a "Maximum call stack size exceeded" error. When opening the datepicker the second time it doesn't show the calendar, but an empty flyout.
Note: That's only true for angular cdk versions >= 6.4.3 and if "zone-patch-rxjs" is included. And also it's only broken for non touch-ui mode.

What are the steps to reproduce?

  • Create an angular cli project
  • Install angular material in the latest version (incl angular cdk in latest version)
  • Integrate a datepicker on the page
  • Load zone-patch-rxjs
  • Start the application
  • Open the datepicker
  • Select a date
  • Try to open the datepicker again

Example on stackblitz which is not working same example with angular cdk version 6.4.2 that is working as expected. You can get from one to the other with installing the dependencies @angular/cdk@6.4.3 @angular/material@6.4.3 @angular/material-moment-adapter@6.4.3 or the other way around with 6.4.2. That's the only difference.

Which versions of Angular, Material, OS, TypeScript, browsers are affected?

  • Chrome Version 68.0.3440.84 (official build) (64-Bit)
  • Firefox 61.0.1 (64-Bit)
  • Typescript 2.7.2
  • Angular Material (and CDK) >= 6.4.3
  • rxjs 6.2.2 (and rxjs-compat 6.2.2)
  • zone.js 0.8.26
  • Angular 6.1.2
  • Ubuntu 18.04

However, the issue doesn't seem to be browser, TypeScript, or OS related. Angular CDK, zone.js and maybe rxjs seem to be the important factors.

Activity

  1. igorivaniuk commented on Aug 19, 2018

    @igorivaniuk

    Same bug with mat-menu.
    v6.4.2 works

  2. josephperrott commented on Sep 6, 2018

    @josephperrott
    Member

    From looking through the changelog its possible that #12414 caused this change.

    I am unsure of if this is something we consider an error or simply an incompatibility with our library.

  3. added
    P4
    on Sep 6, 2018
  4. self-assigned this
    on Sep 6, 2018
  5. crisbeto commented on Sep 7, 2018

    @crisbeto
    Member

    I'm not super convinced that #12414 could've caused it. The onStable call does happen inside the NgZone, but then the callback is outside and I don't see any logic that would cause it to go back in.

  6. vitorplopes commented on Sep 11, 2018

    @vitorplopes

    @angular/cdk@6.4.7 and @angular/material@6.4.7 face the same issue.

    ERROR RangeError: Maximum call stack size exceeded at Function.get [as current] (zone.js:64) at SafeSubscriber.value [as unsubscribe] (zone-patch-rxjs.js:126) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.unsubscribe (Subscriber.js:77) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:212) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:147) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:80) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:55) at Subscriber.Subscriber.next (zone-patch-rxjs.js:163)

  7. tfernandescunha commented on Sep 11, 2018

    @tfernandescunha

    @angular/cdk@6.4.7 and @angular/material@6.4.7 face the same issue.

    ERROR RangeError: Maximum call stack size exceeded at Function.get [as current] (zone.js:64) at SafeSubscriber.value [as unsubscribe] (zone-patch-rxjs.js:126) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.unsubscribe (Subscriber.js:77) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:212) at SafeSubscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:147) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:80) at Subscriber.push../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:55) at Subscriber.Subscriber.next (zone-patch-rxjs.js:163)

  8. added a commit that references this issue on Sep 11, 2018
    c4d57d0
  9. added
    P2
    and removed
    P4
    on Sep 11, 2018
  10. added a commit that references this issue on Sep 14, 2018
    c2e502c
  11. stefan-leye commented on Jan 2, 2019

    @stefan-leye

    I still get the error with version 7.2.0

  12. stefan-leye commented on Jan 2, 2019

    @stefan-leye

    The problem seems to be the use of onStable here:
    https://github.com/angular/material2/blob/master/src/cdk/overlay/overlay-ref.ts#L133

    But putting it into ngZone.runOutsideAngular seems to breaks other stuff.

  13. wescopeland commented on Feb 7, 2019

    @wescopeland

    I'm encountering the same problem. I definitely do not believe this issue should be closed.

  14. angular-automatic-lock-bot commented on Sep 10, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  15. locked and limited conversation to collaborators on Sep 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

P2

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions