edsu / wikichanges

a NodeJS library for monitoring changes on Wikipedia sites
https://npmjs.org/package/wikichanges
70 stars 17 forks source link

parse message bug #8

Closed edsu closed 9 years ago

edsu commented 10 years ago
/home/ed/Projects/anon/node_modules/wikichanges/node_modules/irc/lib/irc.js:672
                    throw err;
                          ^
TypeError: Cannot read property '1' of null
  at parse_msg (/home/ed/Projects/anon/node_modules/wikichanges/wikichanges.js:59:48)
  at Client.<anonymous> (/home/ed/Projects/anon/node_modules/wikichanges/wikichanges.js:32:15)
  at Client.EventEmitter.emit (events.js:106:17)
  at Client.<anonymous> (/home/ed/Projects/anon/node_modules/wikichanges/node_modules/irc/lib/irc.js:477:22)
  at Client.EventEmitter.emit (events.js:95:17)
  at /home/ed/Projects/anon/node_modules/wikichanges/node_modules/irc/lib/irc.js:669:22
  at Array.forEach (native)
  at Socket.<anonymous> (/home/ed/Projects/anon/node_modules/wikichanges/node_modules/irc/lib/irc.js:666:15)
  at Socket.EventEmitter.emit (events.js:95:17)
  at Socket.<anonymous> (_stream_readable.js:746:14)
  at Socket.EventEmitter.emit (events.js:92:17)
  at emitReadable_ (_stream_readable.js:408:10)
  at emitReadable (_stream_readable.js:404:5)
  at readableAddChunk (_stream_readable.js:165:9)
  at Socket.Readable.push (_stream_readable.js:127:10)
  at TCP.onread (net.js:526:21)
jarib commented 10 years ago

I've seen this crash, and it was reported in Gitter today as well. The problem seems to be the assumption in this code that the 5th capture will match /([+-]\d+)/:

  // convert change in characters to a (possibly negative) integer
  if (m[5]) {
    var delta = parseInt(/([+-]\d+)/.exec(m[5])[1]);
  } else {
    var delta = null;
  }

Is it ok to have this just fail quitely, i.e. just go to the else instead?

edsu commented 10 years ago

Thanks, yes. Ideally I'd like to see why it's not matching. @jarib does yours crash quickly as well or does it continue for a bit? Mine seems to run fine for many hours before encountering an error like this.

edsu commented 9 years ago

fixed in [32d88d4e3f361a39add7ea54b60de2f008392b9c]