Skip to content

RxJS asapScheduler stops working in 7.5.1 #6747

Closed
@arobinson

Description

@arobinson

Describe the bug

While trying to upgrade from RxJS6 to RxJS7 I noticed that sometimes our observables were not being executed. After debugging I found that at least asapScheduler did not always run the passed in callback function.

Expected behavior

asapScheduler should always run

Reproduction code

See the stackblitz

See the instructions in the stackblitz:

// To reproduce the issue (rxjs @ 7.5.1):
// 1. load this in stackblitz
// 2. observe that the logs up to '))) n 4' are printed
// 3. make a change to this file, note that it does not work (nothing runs)
// 4. reload the stackblitz page, you will see it work again

// To have it always work (rxjs @ 6.6.7):
// 1. load this in stackblitz
// 2. in the "Dependencies" on the left, enter rxjs@6.6.7
// 2. observe that the logs up to '))) n 4' are printed
// 3. make a change to this file, note that it still works

In our own application, this stops working after ~135 calls to the asapScheduler. The same two calls were failing, but I could cause it to fail sooner if I used asapScheduler more frequently. I managed to get it to fail in stackblitz, but only while changing the stackblitz file. I'm not 100% sure this reproduces the issue in our own application, but the symptoms are the same, and in both 6.6.7 works

Reproduction URL

https://stackblitz.com/edit/rxjs-htf8tz?file=index.ts

Version

7.5.1

Environment

7.5.1 is causing the issue, but 6.6.7 works as expected

Additional context

Experienced in our corporate Angular 13 application

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugConfirmed bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions