Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

eventTask Error with rx Observable #778

Description

@aliatsis

I ran into a critical bug when using the inquirer package when zone.js is imported.
After reading a bunch of source code, I assembled the following code snippet to reproduce the underlying issue with rx Observables and zone.

var createInterface = require('readline').createInterface;
var Observable = require('rx').Observable;
require('zone.js');
var rl = createInterface({ terminal: true, input: process.stdin, output: process.stdout });
var keypress = Observable.fromEvent(rl.input, 'keypress');
var line = Observable.fromEvent(rl, 'line');
keypress.takeUntil(line).toPromise();

When running the above code as a node script and pressing the 'enter' key as input, the following error occurs:

Error: eventTask 'ReadStream.addListener:keypress': can not transition to 'running', expecting state 'scheduled', was 'notScheduled'.
at ZoneTask._transitionTo (/Users/anthonyliatsis/projects/creditiq/ciq-cli/node_modules/zone.js/dist/zone-node.js:511:23)
at Zone.runTask (/Users/anthonyliatsis/projects/creditiq/ciq-cli/node_modules/zone.js/dist/zone-node.js:171:34)
at ReadStream.ZoneTask.invoke (/Users/anthonyliatsis/projects/creditiq/ciq-cli/node_modules/zone.js/dist/zone-node.js:476:38)
at emitTwo (events.js:92:20)
at ReadStream.emit (events.js:172:7)
at emitKeys (readline.js:1251:14)
at next (native)
at ReadStream.onData (readline.js:919:36)
at ZoneDelegate.invokeTask (/Users/anthonyliatsis/projects/creditiq/ciq-cli/node_modules/zone.js/dist/zone-node.js:414:31)
at Zone.runTask (/Users/anthonyliatsis/projects/creditiq/ciq-cli/node_modules/zone.js/dist/zone-node.js:181:47)

A proper fix is obviously ideal, but please let me know if there is any quick code fix I can do before the real fix is merged.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions