Error: stream.push() after EOF

1,763 views
Skip to first unread message

Marco Ippolito

unread,
Oct 16, 2013, 10:43:13 AM10/16/13
to nod...@googlegroups.com
Hi everybody,

I'm getting this error:

node s_call

Error: stream.push() after EOF
    at readableAddChunk (_stream_readable.js:146:15)
    at Readable.push (_stream_readable.js:127:10)
    at Request.querySelector [as _callback] (/home/ubuntu/s_call.js:27:8)
    at Request.self.callback (/home/ubuntu/node_modules/request/request.js:129:22)
    at Request.EventEmitter.emit (events.js:98:17)
    at Request.<anonymous> (/home/ubuntu/node_modules/request/request.js:873:14)
    at Request.EventEmitter.emit (events.js:117:20)
    at IncomingMessage.<anonymous> (/home/ubuntu/node_modules/request/request.js:824:12)
    at IncomingMessage.EventEmitter.emit (events.js:117:20)
    at _stream_readable.js:910:16

node version: v.0.10.12

my snippet is:
var stream = require('stream');
var Readable = stream.Readable;
var rs = new Readable();

for (var i = 0; i < myArray.length; i++) {
  if (myArray[i] = some conditions) myArray.splice(i,1);
  rs.push('myArray[i]');
  rs.push(null);
  rs.pipe(process.stdout);
}


What do you suggest me to do?

Kind regards
Marco

greelgorke

unread,
Oct 17, 2013, 3:08:38 AM10/17/13
to nod...@googlegroups.com
sorry, your code doesn't make sense. at all.

1. A Readable is an abstract Stream, you have to implement rs._read method.

2. your if- you try to filter something out, right? may be Array#filter is something for you

3. your first push pushes a string 'myArray[i]' looks like a bug

4. On every look run you push null wich is an indicator that the stream is done. so on the first looprun you push null and on the second you get your EOF error, because of the first push

5. on every loop run you pipe the same stream to the same stream over and over. this is so wrong, i'm just no able to determine how wrong it is.

so far ok? i hope i haven't hurt you, sorry if i did :) no offense
Reply all
Reply to author
Forward
0 new messages