spencerlambert / mysql-events

A node meteor package that watches a MySQL database and runs callbacks on matched events.
Other
87 stars 74 forks source link

RangeError: Maximum call stack size exceeded #21

Closed SquishyOleo closed 6 years ago

SquishyOleo commented 7 years ago

mysql-events version 0.0.8 zongji version 0.4.3

Experienced the unhandled exception error with mysql-events 0.0.7 when the MySQL database closed the connection so I updated to the latest version. Ran my node.js script overnight (since the error always occurred 8 hours after the last database transaction) to see if the solution was fixed and encountered this error:

C:\wamp64\www\ldnpush\node_modules\mysql-events\index.js:20 newInst.child.on('child', child => newInst.emit('child', child)); (this arrow points at "emit")---------------^

RangeError: Maximum call stack size exceeded at ZongJi. (C:\wamp64\www\ldnpush\node_modules\mysql-events\index.js:20:68) at emitOne (events.js:77:13) at ZongJi.emit (events.js:169:7) at ZongJi. (C:\wamp64\www\ldnpush\node_modules\mysql-events\index.js:20:68) at emitOne (events.js:77:13) at ZongJi.emit (events.js:169:7) at ZongJi. (C:\wamp64\www\ldnpush\node_modules\mysql-events\index.js:20:68) at emitOne (events.js:77:13) at ZongJi.emit (events.js:169:7) at ZongJi. (C:\wamp64\www\ldnpush\node_modules\mysql-events\index.js:20:68)

spencerlambert commented 7 years ago

You could try using the old version of mysql-events along with my fork of zongji.

https://github.com/spencerlambert/zongji

I added some reconnect code to zongji, when the mysql connection is dropped. mysql-events version 0.0.8 does help with dropped database connections, but I like use my zongji fork, as the reconnect is handled within the code that does the mysql connect. This has been the most reliable for me.

SquishyOleo commented 7 years ago

What would be the proper way to tie your ZongJi module in with the mysql-events module so it uses that one instead of the original? Is there anything wrong with using the latest mysql-events module with your ZongJi module?

spencerlambert commented 7 years ago

I simply clone the repo and copy the modules into the standard node module folder.

SquishyOleo commented 7 years ago

I cloned your ZongJi module and replaced all of the files in the original ZongJi folder of mysql-events leaving the node_modules folder with the mysql and iconv-lite dependencies. I then changed the version of the ZongJi dependency in the mysql-events package.json to match the version of your ZongJi module (0.3.2). When I then ran my script I immediately got the following errors - which probably means I did something incorrectly:

C:\wamp64\www\ldnpush\node_modules\mysql-events\node_modules\zongji\node_modules \mysql\lib\protocol\Parser.js:77 throw err; // Rethrow non-MySQL errors ^

TypeError: Cannot read property 'query' of undefined at Query._callback (C:\wamp64\www\ldnpush\node_modules\mysql-events\node_mod ules\zongji\index.js:189:17) at Query.Sequence.end (C:\wamp64\www\ldnpush\nodemodules\mysql-events\node modules\zongji\node_modules\mysql\lib\protocol\sequences\Sequence.js:96:24) at Query._handleFinalResultPacket (C:\wamp64\www\ldnpush\node_modules\mysql- events\node_modules\zongji\node_modules\mysql\lib\protocol\sequences\Query.js:14 4:8) at Query.EofPacket (C:\wamp64\www\ldnpush\node_modules\mysql-events\node_mod ules\zongji\node_modules\mysql\lib\protocol\sequences\Query.js:128:8) at Protocol._parsePacket (C:\wamp64\www\ldnpush\node_modules\mysql-events\no de_modules\zongji\node_modules\mysql\lib\protocol\Protocol.js:280:23) at Parser.write (C:\wamp64\www\ldnpush\node_modules\mysql-events\node_module s\zongji\node_modules\mysql\lib\protocol\Parser.js:73:12) at Protocol.write (C:\wamp64\www\ldnpush\node_modules\mysql-events\node_modu les\zongji\node_modules\mysql\lib\protocol\Protocol.js:39:16) at Socket. (C:\wamp64\www\ldnpush\nodemodules\mysql-events\node modules\zongji\node_modules\mysql\lib\Connection.js:96:28) at emitOne (events.js:77:13) at Socket.emit (events.js:169:7)

Abyssmal commented 7 years ago

When my mysql server disconnects due to timeout setting zongji just crashes and mysql-events does not work anymore. It's not giving an error even.

I've tried your fork of zongji but to no avail. Same error as @SquishyOleo described.

Please elaborate on using the fork. I'm desperate.

spencerlambert commented 7 years ago

The fork is a drop-in replacement for zongj. It's a couple of year old so I don't know if it runs on the newer versions of stuff.