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

.repeat() causes RangeError: Maximum call stack size exceeded #2341

Closed
alancnet opened this issue Feb 7, 2017 · 5 comments
Closed

.repeat() causes RangeError: Maximum call stack size exceeded #2341

alancnet opened this issue Feb 7, 2017 · 5 comments

Comments

@alancnet
Copy link

alancnet commented Feb 7, 2017

RxJS version:
5.1.0

Code to reproduce:
require('rxjs').Observable.of(1).repeat().subscribe(() => {})

Expected behavior:
Code should block forever and do nothing.

Actual behavior:
RangeError: Maximum call stack size exceeded

Additional information:
rx 4.1.0 behaves correctly:
require('rx').Observable.just(1).repeat().subscribe(() => {})

@alancnet alancnet changed the title .repeat() causes RangeError: Maximul call stack size exceeded .repeat() causes RangeError: Maximum call stack size exceeded Feb 7, 2017
@kwonoj
Copy link
Member

kwonoj commented Feb 7, 2017

Check this issue #651 which explains in detail (especially comment #651 (comment)) for background why it's behavior's changed between two implementations. In short in v5 default scheduling strategy has changed, so if you'd like to repeat synchronous observable you need to schedule it accordingly via subscribeOn.

I believe issue itself is sufficiently explained in original issue, closing it as dupe.

@kwonoj kwonoj closed this as completed Feb 7, 2017
@alancnet
Copy link
Author

alancnet commented Feb 7, 2017

@kwonoj, it seems the proper technique would be to use .subscribeOn, but what scheduler would you use? Is the trampoline scheduler still there somewhere?

PS: This is not an edge case for me, as I often write entire programs based in RX, including a computer learning algorithm where I encountered this issue.

@kwonoj
Copy link
Member

kwonoj commented Feb 7, 2017

@alancnet check https://github.com/ReactiveX/rxjs/blob/master/MIGRATION.md#schedulers-renamed migration guide for schedulers. you may able to use asap, which is default scheduler in v4.

@trxcllnt
Copy link
Member

trxcllnt commented Feb 7, 2017

@alancnet Scheduler.queue will give you identical behavior to Rx 4

@lock
Copy link

lock bot commented Jun 6, 2018

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jun 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants