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

Error with race and sync Observables #1615

Closed
nmote opened this issue Apr 14, 2016 · 3 comments
Closed

Error with race and sync Observables #1615

nmote opened this issue Apr 14, 2016 · 3 comments

Comments

@nmote
Copy link

nmote commented Apr 14, 2016

RxJS version:

5.0.0-beta.6

Code to reproduce:

At the Node (v5.0.0) console:

rx.Observable.race(rx.Observable.of(true), rx.Observable.of(false).delay(1500)).subscribe(console.log.bind(console))

Expected behavior:

true

Actual behavior:

true
TypeError: Cannot read property 'push' of null
    at RaceSubscriber._complete (/.../node_modules/@reactivex/rxjs/dist/cjs/operator/race.js:86:35)
    at RaceSubscriber.Subscriber.complete (/.../node_modules/@reactivex/rxjs/dist/cjs/Subscriber.js:113:18)
    at ArrayObservable._subscribe (/.../node_modules/@reactivex/rxjs/dist/cjs/observable/ArrayObservable.js:116:24)
    at ArrayObservable.Observable.subscribe (/.../node_modules/@reactivex/rxjs/dist/cjs/Observable.js:52:62)
    at Observable._subscribe (/.../node_modules/@reactivex/rxjs/dist/cjs/Observable.js:109:28)
    at RaceOperator.call (/.../node_modules/@reactivex/rxjs/dist/cjs/operator/race.js:55:23)
    at Observable.subscribe (/.../node_modules/@reactivex/rxjs/dist/cjs/Observable.js:52:38)
    at repl:1:81
    at REPLServer.defaultEval (repl.js:248:27)
    at bound (domain.js:280:14)

Additional information:

If I delay both, I don't get the TypeError. If I use toPromise and then .then it, rather than calling subscribe I don't get the TypeError.

It seems clear that it's a result of one of the Observables being synchronous. However if this is expected behavior I have two questions: (1) What should I do instead, if I receive Observables that may or may not be sync? (2) Why does the error appear to be an internal error, rather than a user-facing error?

cc @matthewwithanm

@kwonoj
Copy link
Member

kwonoj commented Apr 14, 2016

I don't think this is expected behavior, Observable should not throw in this case. Let me try look into to see what's happening.

@benlesh
Copy link
Member

benlesh commented Apr 14, 2016

I was mildly excited when I thought @matthewwithanm was "Matthew with ham". Then I reread it. Can't win 'em all.

@lock
Copy link

lock bot commented Jun 7, 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 7, 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

Successfully merging a pull request may close this issue.

3 participants