node-mariasql icon indicating copy to clipboard operation
node-mariasql copied to clipboard

Query packet size limit in version ^0.2.0 ?

Open anderfjord opened this issue 10 years ago • 3 comments

My app uses phantomjs to take a screenshot and then stores the resulting base64 string in mysql. This had been working fine with node-mariasql v0.1.22 running on node v0.12, but now I'm getting the following error with node-mariasql ^0.2.0 running on node v4.2.1:

mysql error, reconnecting.. -> Error: MySQL server has gone away

This seems to point to either a timeout or packet size limitation. I suspect it's a size limitation, since smaller screenshots don't trigger the problem, only larger ones. I have reviewed the breaking changes list [https://github.com/mscdex/node-mariasql/wiki/Upgrading-v0.1.x-to-v0.2.x] and appear to have accounted for all other factors.

I'd really appreciate any help with this. Thanks very much.

anderfjord avatar Nov 05 '15 01:11 anderfjord

Do you have a simple, reproducible test case? As far as I know nothing has changed packet size-wise. If anything, it might be that the keepalive mechanism changed somewhat.

mscdex avatar Nov 05 '15 03:11 mscdex

I've added a small repo to reproduce this. The readme should be pretty self explanatory, but let me know if you have any questions.

https://github.com/wreckloose/mariasql-query-size-test

You'll have to use the screenshots.sql file to add a test table to one of your databases. Modify the db config in run.js to point to your database.

Usage: node run.js -f small.txt node run.js -f medium.txt node run.js -f large.txt

Only the first test case runs successfully. Note that the unsuccessful test cases die almost immediately. In other words, they don't run for a long time and then die.

Thanks again for your help.

anderfjord avatar Nov 06 '15 16:11 anderfjord

Ok, so the problem is on the server-side and its max-allowed-packet configuration, so I'm not sure why it would have broke for you when upgrading mariasql.

For example, when I start up mariadb 10.1.8 with --no-defaults, it uses a ~4MB max-allowed-packet size. This let me execute your small and medium tests without a problem. However the large is ~5MB and is thus larger than the allowed packet size. Bumping the value up on the server side allowed the large test to complete successfully.

mscdex avatar Nov 14 '15 19:11 mscdex