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

ReaderRdy.balance leads some uncaughtExceptions: "TypeError: Cannot read property 'bump/setConnectionRdyMax' of undefined" #99

Open
Chunlin-Li opened this issue Apr 19, 2016 · 28 comments
Labels

Comments

@Chunlin-Li
Copy link

Chunlin-Li commented Apr 19, 2016

I create some nsq.Reader as consumers, they works well but when some network error occurs, it has chance to crash my process.

I have several node process, each of them subscribe several topics from one same channel.

node version: v4.3.1
nsqjs version: v0.7.12

Error information:

[TypeError: Cannot read property 'setConnectionRdyMax' of undefined] TypeError: Cannot read property 'setConnectionRdyMax' of undefined
    at ReaderRdy.balance (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:507:28)
    at NSQDConnection.<anonymous> (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:373:20)
    at emitNone (events.js:72:20)
    at NSQDConnection.emit (events.js:166:7)
    at ConnectionState.states.CLOSED.Enter (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection.js:579:19)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)
    at callback (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state/lib/nodestate.js:84:32)
    at ConnectionState.transitions.*.* (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection.js:590:16)
    at ConnectionState.NodeState.goto (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state/lib/nodestate.js:90:16)
[TypeError: Cannot read property 'bump' of undefined] TypeError: Cannot read property 'bump
' of undefined
    at ReaderRdy.balance (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:508:42)
    at NSQDConnection.<anonymous> (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:373:20)
    at emitNone (events.js:72:20)
    at NSQDConnection.emit (events.js:166:7)
    at ConnectionState.states.CLOSED.Enter (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection
.js:579:19)
    at emitOne (events.js:77:13)
    at EventEmitter.emit (events.js:169:7)
    at callback (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state/lib/nodestate.js:84:3
2)
    at ConnectionState.transitions.*.* (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection.js:
590:16)
    at ConnectionState.NodeState.goto (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state
/lib/nodestate.js:90:16)

Can you tell me how to fix this issue? really thank you!

@dudleycarr
Copy link
Owner

Are you listening for the error event on the the Reader? If not, it's
expected that the error will takedown your process.

On Tuesday, April 19, 2016, Chunlin Li notifications@github.com wrote:

I create some nsq.Reader as consumers, they works well but when some
network error occurs, it has chance to crash my process.

I have several node process, each of them subscribe several topics from
one same channel.

Error information:

[TypeError: Cannot read property 'setConnectionRdyMax' of undefined] TypeError: Cannot read property 'setConnectionRdyMax' of undefined
at ReaderRdy.balance (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:507:28)
at NSQDConnection. (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:373:20)
at emitNone (events.js:72:20)
at NSQDConnection.emit (events.js:166:7)
at ConnectionState.states.CLOSED.Enter (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection.js:579:19)
at emitOne (events.js:77:13)
at EventEmitter.emit (events.js:169:7)
at callback (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state/lib/nodestate.js:84:32)
at ConnectionState.transitions.. (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection.js:590:16)
at ConnectionState.NodeState.goto (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state/lib/nodestate.js:90:16)

[TypeError: Cannot read property 'bump' of undefined] TypeError: Cannot read property 'bump
' of undefined
at ReaderRdy.balance (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:508:42)
at NSQDConnection. (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/readerrdy.js:373:20)
at emitNone (events.js:72:20)
at NSQDConnection.emit (events.js:166:7)
at ConnectionState.states.CLOSED.Enter (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection
.js:579:19)
at emitOne (events.js:77:13)
at EventEmitter.emit (events.js:169:7)
at callback (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state/lib/nodestate.js:84:3
2)
at ConnectionState.transitions.. (/home/test/js-nsq-to-file/node_modules/nsqjs/lib/nsqdconnection.js:
590:16)
at ConnectionState.NodeState.goto (/home/test/js-nsq-to-file/node_modules/nsqjs/node_modules/node-state
/lib/nodestate.js:90:16)

Can you tell me how to fix this issue? really thank you!


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#99

@Chunlin-Li
Copy link
Author

@dudleycarr

Yes, I listened the error event.

        nsqReader.on(nsq.Reader.ERROR, function (err) {
            console.error(new Date(), 'reader error ', err);
        });

And, the uncaughtException is not from an ErrorEvent. so I think I cannot catch the error by try catch or by add error listener on something.

@dudleycarr
Copy link
Owner

Do you have a full example I could see?

On Tuesday, April 19, 2016, Chunlin Li notifications@github.com wrote:

@dudleycarr https://github.com/dudleycarr

Yes, I listened the error event.

    nsqReader.on(nsq.Reader.ERROR, function (err) {
        console.error(new Date(), 'reader error ', err);
    });

And, the uncaughtException is not from an ErrorEvent. so I think I cannot
catch the error by try catch or by add error listener on something.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub
#99 (comment)

@Chunlin-Li
Copy link
Author

Chunlin-Li commented Apr 19, 2016

@dudleycarr

This is my code.

And I noticed, before every uncaughtException, there is a NSQD_CLOSED event been triggered.
But not every NSQD_CLOSED event follows an uncaughtException.

topics.forEach(topic => {
    let nsqReader = new (nsq.Reader)(topic, channel, {
        lookupdHTTPAddresses: hostAddr,
        maxInFlight: 200
    });
    nsqReader.on(nsq.Reader.MESSAGE, msg => {
        doprocess(topic, msg.body);
        msg.finish();
    });
    nsqReader.on(nsq.Reader.NSQD_CLOSED, () => {
        console.error(new Date(), 'NSQD_CLOSED! ' + topic);
    });
    nsqReader.on(nsq.Reader.ERROR, err => {
        console.error(new Date(), 'reader error ', err);
    });
    nsqReader.connect();
});

@dudleycarr
Copy link
Owner

It might be a bug with a connection that has gone missing and messages in-
flight. Unfortunately, I can't dig deeper right now but will take a look
today. Thanks for reporting it!

On Apr 19 2016, at 5:36 am, Chunlin Li <notifications@github.com> wrote:

@dudleycarr

This is my code.

And I noticed, before every uncaughtException, there is a NSQ_CLOSED event
been triggered.
But not every NSQ_CLOSED event follows an uncaughtException.

topics.forEach(topic => {

    let nsqReader = new (nsq.Reader)(topic, channel, {

        lookupdHTTPAddresses: hostAddr,

        maxInFlight: 200

    });

    nsqReader.on(nsq.Reader.MESSAGE, msg => {

        doprocess(topic, msg.body);

        msg.finish();

    });

    nsqReader.on(nsq.Reader.NSQD_CLOSED, () => {

        console.error(new Date(), 'NSQD_CLOSED! ' + topic);

    });

    nsqReader.on(nsq.Reader.ERROR, err => {

        console.error(new Date(), 'reader error ', err);

    });

    nsqReader.connect();

});


You are receiving this because you were mentioned.
Reply to this email directly or [view it on GitHub](https://github.com/dudleyc
arr/nsqjs/issues/99#issuecomment-211903337)![](https://github.com/notification
s/beacon/AANWyYvSHUtLOwiX1a2rLjH5QIlEsY1pks5p5MxbgaJpZM4IKgAk.gif)

@Chunlin-Li
Copy link
Author

Thank you for your rapid response, I will follow the progress.

@dudleycarr
Copy link
Owner

@Chunlin-Li Could your run your sample program with DEBUG=* node ...? That output would be very helpful.

@Chunlin-Li
Copy link
Author

@dudleycarr
I will try, but it's hard to duplicate this issue because it has some probability.
Once I get the debug output info, I will post it here.

@Chunlin-Li
Copy link
Author

@dudleycarr
I'm sorry, I tried to add DEBUG=* env, but it produce too many info logs, and my log file increase very fast (20MB/sec), because the issue comes from our production server. I thought your advice is not suit my case.
In fact. maybe you need find out why this issue occurs. but for me, I want to catch the error to prevent crash my program firstly.
Thank you!

@Chunlin-Li
Copy link
Author

@dudleycarr
Hi. I have a good news. I got a duplication of this issue, and, with the verbose of debug info.
I will collect the info and send mail to you later. Note that the whole log is very big (dozens of GB), I will send you last part of that.

@ekristen
Copy link
Contributor

ekristen commented Nov 4, 2016

I'm seeing this issue right now too. Any chance we can get a fix for it?

@dudleycarr
Copy link
Owner

@ekristen Sorry about the delay. I don't have time at the moment, but probably some time over thanksgiving to investigate.

@ekristen
Copy link
Contributor

ekristen commented Nov 7, 2016

@dudleycarr ok, this is a pretty critical bug, its not catch-able and crashes my app frequently. Could you not simply add a check to ensure that the connection object is valid before referencing the function/property.

@ekristen
Copy link
Contributor

@dudleycarr thoughts?

@dudleycarr
Copy link
Owner

dudleycarr commented Dec 21, 2016 via email

@ekristen
Copy link
Contributor

Thanks @dudleycarr its happening more frequent one one of my apps, not entirely sure why though, here is the latest stack trace ...

 /opt/node_modules/nsqjs/lib/readerrdy.js:509
           _results.push(this.connections[i].bump());
                                            ^
 TypeError: Cannot read property 'bump' of undefined
     at ReaderRdy.balance (/opt/node_modules/nsqjs/lib/readerrdy.js:509:44)
     at NSQDConnection.<anonymous> (/opt/node_modules/nsqjs/lib/readerrdy.js:373:20)
     at emitNone (events.js:91:20)
     at NSQDConnection.emit (events.js:185:7)
     at ConnectionState.Enter (/opt/node_modules/nsqjs/lib/nsqdconnection.js:579:19)
     at emitOne (events.js:96:13)
     at EventEmitter.emit (events.js:188:7)
     at callback (/opt/node_modules/node-state/lib/nodestate.js:84:32)
     at ConnectionState.* (/opt/node_modules/nsqjs/lib/nsqdconnection.js:590:16)
     at ConnectionState.NodeState.goto (/opt/node_modules/node-state/lib/nodestate.js:90:16)

@dudleycarr
Copy link
Owner

@ekristen I'm having a tough time reproducing this issue. It looks like the array of connections state management is busted in some way.

The offending line is here:
https://github.com/dudleycarr/nsqjs/blob/master/src/readerrdy.coffee#L292

It would be really helpful if you could print out what the conn object is at the time of removal and what's in the @connections array. I would recommend forking and adding the appropriate console.dir entries and then go from there. Obviously, you'll need to npm link to get your repo working against the forked version.

@dudleycarr
Copy link
Owner

dudleycarr commented Dec 22, 2016 via email

@ekristen
Copy link
Contributor

I can't reproduce it either, but I have an app that seems to trigger it at least daily, if not more. I'll try and get some console.log statements in there tonight and see if I can't have something by tomorrow morning for you.

I would be happy if we could make this error catchable in the mean time though too.

@dudleycarr
Copy link
Owner

dudleycarr commented Dec 22, 2016 via email

@ekristen
Copy link
Contributor

3 nsqd nodes, multiple workers, but in-flight is set to 1 (yes we know this is against recommended practices, but can't be avoided)

As for the number of messages, I can try and figure that out. I'm modifying the app right now to add in a console log on the connections array. Will let you know as soon as I see the crash again.

@ekristen
Copy link
Contributor

ekristen commented Dec 22, 2016

Here is the connection from the code being console.logged as well as the connections array.

 ConnectionRdy {
   conn: 
    NSQDConnection {
      nsqdHost: '10.30.30.31',
      nsqdPort: 4150,
      topic: 'worker-jobs-topic',
      channel: 'manager',
      domain: null,
      _events: 
       { connected: [Function],
         error: [Object],
         connection_error: [Function],
         closed: [Object],
         message: [Object],
         finished: [Object],
         requeued: [Object],
         ready: [Function],
         backoff: [Function] },
      _eventsCount: 9,
      _maxListeners: undefined,
      debug: 
       { [Function: debug]
         namespace: 'nsqjs:reader:worker-jobs-topic/manager:conn:10.30.30.31/4150',
         enabled: false,
         useColors: false,
         color: 1,
         inspectOpts: {} },
      config: 
       ConnectionConfig {
         authSecret: null,
         clientId: '1d3ea3bf-20bf-490d-a103-ae3a03df63ad',
         deflate: false,
         deflateLevel: 6,
         heartbeatInterval: 30,
         maxInFlight: 2,
         messageTimeout: null,
         outputBufferSize: null,
         outputBufferTimeout: null,
         requeueDelay: 90,
         sampleRate: null,
         snappy: false,
         tls: false,
         tlsVerification: true },
      frameBuffer: FrameBuffer {},
      statemachine: 
       ConnectionState {
         conn: [Circular],
         config: [Object],
         _notifier: [Object],
         disabled: true,
         states: [Object],
         transitions: [Object],
         current_state_name: 'CLOSED',
         current_state: [Object],
         current_data: undefined,
         _current_timeout: null,
         identifyResponse: [Object] },
      maxRdyCount: 2500,
      msgTimeout: 60000,
      maxMsgTimeout: 900000,
      nsqdVersion: '0.3.8',
      lastMessageTimestamp: 1482440903517,
      lastReceivedTimestamp: 1482441330530,
      conn: 
       Socket {
         connecting: false,
         _hadError: false,
         _handle: null,
         _parent: null,
         _host: null,
         _readableState: [Object],
         readable: false,
         domain: null,
         _events: [Object],
         _eventsCount: 6,
         _maxListeners: undefined,
         _writableState: [Object],
         writable: false,
         allowHalfOpen: false,
         destroyed: true,
         _bytesDispatched: 3586,
         _sockname: null,
         _pendingData: null,
         _pendingEncoding: '',
         server: null,
         _server: null,
         read: [Function],
         _consuming: true,
         _idleNext: null,
         _idlePrev: null,
         _idleTimeout: -1 },
      identifyTimeoutId: null,
      messageCallbacks: [] },
   debug: 
    { [Function: debug]
      namespace: 'nsqjs:reader:worker-jobs-topic/manager:rdy:conn:10.30.30.31/4150',
      enabled: false,
      useColors: false,
      color: 6,
      inspectOpts: {} },
   maxConnRdy: 1,
   inFlight: 0,
   lastRdySent: 1,
   availableRdy: -12,
   statemachine: 
    ConnectionRdyState {
      connRdy: [Circular],
      config: { autostart: false, initial_state: 'INIT', sync_goto: true },
      _notifier: 
       EventEmitter {
         domain: null,
         _events: [Object],
         _eventsCount: 4,
         _maxListeners: undefined },
      disabled: false,
      states: 
       { INIT: [Object],
         BACKOFF: [Object],
         ONE: [Object],
         MAX: [Object] },
      transitions: { '*': [Object] },
      current_state_name: 'MAX',
      current_state: 
       { Enter: [Function: bound Enter],
         bump: [Function: bound bump],
         backoff: [Function: bound backoff],
         adjustMax: [Function: bound adjustMax] },
      current_data: undefined,
      _current_timeout: null },
   _events: { ready: [Function] },
   _eventsCount: 1,
   idleId: null }
 [ ConnectionRdy {
     conn: 
      NSQDConnection {
        nsqdHost: '10.30.30.35',
        nsqdPort: 4150,
        topic: 'worker-jobs-topic',
        channel: 'manager',
        domain: null,
        _events: [Object],
        _eventsCount: 9,
        _maxListeners: undefined,
        debug: [Object],
        config: [Object],
        frameBuffer: FrameBuffer {},
        statemachine: [Object],
        maxRdyCount: 2500,
        msgTimeout: 60000,
        maxMsgTimeout: 900000,
        nsqdVersion: '0.3.8',
        lastMessageTimestamp: null,
        lastReceivedTimestamp: 1482441330525,
        conn: [Object],
        identifyTimeoutId: null,
        messageCallbacks: [] },
     debug: 
      { [Function: debug]
        namespace: 'nsqjs:reader:worker-jobs-topic/manager:rdy:conn:10.30.30.35/4150',
        enabled: false,
        useColors: false,
        color: 1,
        inspectOpts: {} },
     maxConnRdy: 1,
     inFlight: 0,
     lastRdySent: 1,
     availableRdy: 1,
     statemachine: 
      ConnectionRdyState {
        connRdy: [Circular],
        config: [Object],
        _notifier: [Object],
        disabled: false,
        states: [Object],
        transitions: [Object],
        current_state_name: 'MAX',
        current_state: [Object],
        current_data: undefined,
        _current_timeout: null },
     _events: { ready: [Function] },
     _eventsCount: 1 },
   ConnectionRdy {
     conn: 
      NSQDConnection {
        nsqdHost: '10.30.30.31',
        nsqdPort: 4150,
        topic: 'worker-jobs-topic',
        channel: 'manager',
        domain: null,
        _events: [Object],
        _eventsCount: 9,
        _maxListeners: undefined,
        debug: [Object],
        config: [Object],
        frameBuffer: FrameBuffer {},
        statemachine: [Object],
        maxRdyCount: 2500,
        msgTimeout: 60000,
        maxMsgTimeout: 900000,
        nsqdVersion: '0.3.8',
        lastMessageTimestamp: 1482440903517,
        lastReceivedTimestamp: 1482441330530,
        conn: [Object],
        identifyTimeoutId: null,
        messageCallbacks: [] },
     debug: 
      { [Function: debug]
        namespace: 'nsqjs:reader:worker-jobs-topic/manager:rdy:conn:10.30.30.31/4150',
        enabled: false,
        useColors: false,
        color: 6,
        inspectOpts: {} },
     maxConnRdy: 1,
     inFlight: 0,
     lastRdySent: 1,
     availableRdy: -12,
     statemachine: 
      ConnectionRdyState {
        connRdy: [Circular],
        config: [Object],
        _notifier: [Object],
        disabled: false,
        states: [Object],
        transitions: [Object],
        current_state_name: 'MAX',
        current_state: [Object],
        current_data: undefined,
        _current_timeout: null },
     _events: { ready: [Function] },
     _eventsCount: 1,
     idleId: null } ]
 ConnectionRdy {
   conn: 
    NSQDConnection {
      nsqdHost: '10.30.30.35',
      nsqdPort: 4150,
      topic: 'worker-jobs-topic',
      channel: 'manager',
      domain: null,
      _events: 
       { connected: [Function],
         error: [Object],
         connection_error: [Function],
         closed: [Object],
         message: [Object],
         finished: [Object],
         requeued: [Object],
         ready: [Function],
         backoff: [Function] },
      _eventsCount: 9,
      _maxListeners: undefined,
      debug: 
       { [Function: debug]
         namespace: 'nsqjs:reader:worker-jobs-topic/manager:conn:10.30.30.35/4150',
         enabled: false,
         useColors: false,
         color: 6,
         inspectOpts: {} },
      config: 
       ConnectionConfig {
         authSecret: null,
         clientId: '1d3ea3bf-20bf-490d-a103-ae3a03df63ad',
         deflate: false,
         deflateLevel: 6,
         heartbeatInterval: 30,
         maxInFlight: 2,
         messageTimeout: null,
         outputBufferSize: null,
         outputBufferTimeout: null,
         requeueDelay: 90,
         sampleRate: null,
         snappy: false,
         tls: false,
         tlsVerification: true },
      frameBuffer: FrameBuffer {},
      statemachine: 
       ConnectionState {
         conn: [Circular],
         config: [Object],
         _notifier: [Object],
         disabled: true,
         states: [Object],
         transitions: [Object],
         current_state_name: 'CLOSED',
         current_state: [Object],
         current_data: undefined,
         _current_timeout: null,
         identifyResponse: [Object] },
      maxRdyCount: 2500,
      msgTimeout: 60000,
      maxMsgTimeout: 900000,
      nsqdVersion: '0.3.8',
      lastMessageTimestamp: null,
      lastReceivedTimestamp: 1482441330525,
      conn: 
       Socket {
         connecting: false,
         _hadError: false,
         _handle: null,
         _parent: null,
         _host: null,
         _readableState: [Object],
         readable: false,
         domain: null,
         _events: [Object],
         _eventsCount: 6,
         _maxListeners: undefined,
         _writableState: [Object],
         writable: false,
         allowHalfOpen: false,
         destroyed: true,
         _bytesDispatched: 3325,
         _sockname: null,
         _pendingData: null,
         _pendingEncoding: '',
         server: null,
         _server: null,
         read: [Function],
         _consuming: true,
         _idleNext: null,
         _idlePrev: null,
         _idleTimeout: -1 },
      identifyTimeoutId: null,
      messageCallbacks: [] },
   debug: 
    { [Function: debug]
      namespace: 'nsqjs:reader:worker-jobs-topic/manager:rdy:conn:10.30.30.35/4150',
      enabled: false,
      useColors: false,
      color: 1,
      inspectOpts: {} },
   maxConnRdy: 2,
   inFlight: 0,
   lastRdySent: 1,
   availableRdy: 1,
   statemachine: 
    ConnectionRdyState {
      connRdy: [Circular],
      config: { autostart: false, initial_state: 'INIT', sync_goto: true },
      _notifier: 
       EventEmitter {
         domain: null,
         _events: [Object],
         _eventsCount: 4,
         _maxListeners: undefined },
      disabled: false,
      states: 
       { INIT: [Object],
         BACKOFF: [Object],
         ONE: [Object],
         MAX: [Object] },
      transitions: { '*': [Object] },
      current_state_name: 'MAX',
      current_state: 
       { Enter: [Function: bound Enter],
         bump: [Function: bound bump],
         backoff: [Function: bound backoff],
         adjustMax: [Function: bound adjustMax] },
      current_data: undefined,
      _current_timeout: null },
   _events: { ready: [Function] },
   _eventsCount: 1 }
 [ ConnectionRdy {
     conn: 
      NSQDConnection {
        nsqdHost: '10.30.30.35',
        nsqdPort: 4150,
        topic: 'worker-jobs-topic',
        channel: 'manager',
        domain: null,
        _events: [Object],
        _eventsCount: 9,
        _maxListeners: undefined,
        debug: [Object],
        config: [Object],
        frameBuffer: FrameBuffer {},
        statemachine: [Object],
        maxRdyCount: 2500,
        msgTimeout: 60000,
        maxMsgTimeout: 900000,
        nsqdVersion: '0.3.8',
        lastMessageTimestamp: null,
        lastReceivedTimestamp: 1482441330525,
        conn: [Object],
        identifyTimeoutId: null,
        messageCallbacks: [] },
     debug: 
      { [Function: debug]
        namespace: 'nsqjs:reader:worker-jobs-topic/manager:rdy:conn:10.30.30.35/4150',
        enabled: false,
        useColors: false,
        color: 1,
        inspectOpts: {} },
     maxConnRdy: 2,
     inFlight: 0,
     lastRdySent: 1,
     availableRdy: 1,
     statemachine: 
      ConnectionRdyState {
        connRdy: [Circular],
        config: [Object],
        _notifier: [Object],
        disabled: false,
        states: [Object],
        transitions: [Object],
        current_state_name: 'MAX',
        current_state: [Object],
        current_data: undefined,
        _current_timeout: null },
     _events: { ready: [Function] },
     _eventsCount: 1 } ]



 /opt/node_modules/nsqjs/lib/readerrdy.js:511
           _results.push(this.connections[i].bump());
                                            ^
 TypeError: Cannot read property 'bump' of undefined
     at ReaderRdy.balance (/opt/node_modules/nsqjs/lib/readerrdy.js:511:44)
     at NSQDConnection.<anonymous> (/opt/node_modules/nsqjs/lib/readerrdy.js:373:20)
     at emitNone (events.js:91:20)
     at NSQDConnection.emit (events.js:185:7)
     at ConnectionState.Enter (/opt/node_modules/nsqjs/lib/nsqdconnection.js:579:19)
     at emitOne (events.js:96:13)
     at EventEmitter.emit (events.js:188:7)
     at callback (/opt/node_modules/node-state/lib/nodestate.js:84:32)
     at ConnectionState.* (/opt/node_modules/nsqjs/lib/nsqdconnection.js:590:16)
     at ConnectionState.NodeState.goto (/opt/node_modules/node-state/lib/nodestate.js:90:16)

@dudleycarr
Copy link
Owner

dudleycarr commented Dec 23, 2016

@ekristen That was helpful! I think I found the issue! Basically, it needs the following at the top:

  return if @connections.length is 0

Could you please try that and let me know what you find?

@dudleycarr dudleycarr added the bug label Jan 2, 2017
@ekristen
Copy link
Contributor

Hey @dudleycarr somehow I missed this message, I'll get it added shortly and see how the next few days progress.

@dudleycarr
Copy link
Owner

@ekristen Any luck with this issue?

@ekristen
Copy link
Contributor

ekristen commented May 3, 2017

@dudleycarr I'm in the middle of testing this right now. I see you've been doing a lot of updates to your code too, any chance you want to just drop this fix in while you are at it?

@dudleycarr
Copy link
Owner

@ekristen Happy to do so. I was never able to reproduce this issue. Any chance the fix previously mentioned help solve the problem?

@ekristen
Copy link
Contributor

ekristen commented May 4, 2017

Unless I put it in the wrong spot it doesn't seem to help. I guess I could just check to make sure connections[i] is not undefined before calling bump to prevent the problem too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants