nearform / cloudwatchlogs-stream

Stream interfacet to CloudWatch Logs
MIT License
11 stars 2 forks source link

stream without any events causes exception (iojs 2) #4

Open tomyan opened 9 years ago

tomyan commented 9 years ago

When testing with iojs 2.0.0 (not sure if it's limited to this), everything works if there are events coming through. However, when there is no input the the stream it causes this exception:

timers.js:368
      immediate._onImmediate();
                ^
TypeError: immediate._onImmediate is not a function
    at processImmediate [as _immediateCallback] (timers.js:368:17)

Will try to come up with a simple test case and add it here, but thought I would post the bug first in case you've seen it before.

Thanks

Tom

tomyan commented 9 years ago

In further testing it seems to happen in iojs 2.0.1, but not in 2.0.0. I was using this script to reproduce the problem:

var AWS = require('aws-sdk');
var CloudWatchLogsStream = require('cloudwatchlogs-stream');

AWS.config.update({ region: 'eu-west-1' });

var cwlStream = new CloudWatchLogsStream({
    logGroupName: 'test-log-group',
    logStreamName: 'test-log-stream',
    bulkIndex: 10,
    timeout: 5
});

process.stdin.pipe(cwlStream);

Just stop typing and you should see the message. Seems like it could be an issue with iojs itself.

Regards

Tom

tomyan commented 9 years ago

Although bizarrely it happens with iojs 2.0.0 from the iojs:2.0.0-onbuild docker image (https://registry.hub.docker.com/_/iojs/), but not on iojs 2.0.0 on my mac (from the official installer). Continuing to investigate...

tomyan commented 9 years ago

This doesn't happen in node.js 0.10.38 (the version in the node:0.10.38-onbuild docker image).

dberesford commented 9 years ago

We haven't tested on anything but 0.10.38 (that's what we're running in production) - sounds like it will be a while before we upgade too! :-|

tomyan commented 9 years ago

I've stopped looking at this now, without getting to the bottom of the problem :-(. We had another issue, where the amount of memory consumed rose steadily when under load. Have a brief look into that, but didn't see an obvious way to prevent it - let me know if you know of anything (switched to looking into logspout for our use-case for now).

Thanks

Tom

ztripez commented 9 years ago

I get the same problem when I try to write a simple json object to cloudwatch.

Using node v0.12.2

var stream = new CloudWatchLogsStream(opts);
stream.write(JSON.stringify(logdata));

The data is sent, but throws an exception.

undefined is not a function,     at processImmediate [as _immediateCallback] (timers.js:358:17)]