Hello! My application where crashing after I updated my node to the 6.4.0 version. It was an error in the sails-mysql module, when using the mysql inner module. Here is the error:
buffer.js:761
return this.utf8Write(string, offset, length);
RangeError: Offset is out of bounds
at RangeError (native)
at Buffer.write (buffer.js:761:21)
at PacketWriter.writeString (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/protocol/PacketWriter.js:79:16)
at ComQueryPacket.write (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/protocol/packets/ComQueryPacket.js:9:10)
at Protocol._emitPacket (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:293:10)
at Query.<anonymous> (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:154:12)
at emitOne (events.js:96:13)
at Query.emit (events.js:188:7)
at Query.start (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Query.js:29:8)
at Protocol._startSequence (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:355:14)
at Protocol._enqueue (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:186:10)
at PoolConnection.query (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/mysql/lib/Connection.js:201:25)
at /home/axius/sh-central-server/src/node_modules/sails-mysql/lib/adapter.js:806:26
at /home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/async/lib/async.js:181:20
at Object.async.forEachOf.async.eachOf (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/async/lib/async.js:233:13)
at Object.async.forEach.async.each (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/async/lib/async.js:209:22)
at Array.async.auto.processChildren (/home/axius/sh-central-server/src/node_modules/sails-mysql/lib/adapter.js:748:23)
at listener (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/async/lib/async.js:605:42)
at /home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/async/lib/async.js:544:17
at _arrayEach (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/async/lib/async.js:85:13)
at Immediate.taskComplete (/home/axius/sh-central-server/src/node_modules/sails-mysql/node_modules/async/lib/async.js:543:13)
at runCallback (timers.js:574:20)
After some triyng it could be fixed when I updated the sails-mysql package.json to use the most recent version of the mysql module (2.11.1) then it were no more crashing. So I'd suggest to update this in the lib, because it can crash with someonelse. I am using the most recend version of sails anjd sails-mysql (0.12.2)
@alexnum Thanks for posting, we'll take a look as soon as possible. In the meantime, if you haven鈥檛 already, please carefully read the issue contribution guidelines and double-check for any missing information above. In particular, please ensure that this issue is about a stability or performance bug with a documented feature; and make sure you鈥檝e included detailed instructions on how to reproduce the bug from a clean install. Finally, don鈥檛 forget to include the version of Node.js you tested with, as well as your version of Sails or Waterline, and of any relevant standalone adapters/generators/hooks.
Thank you!
+1 I am also having this same issue.
Ok I think I have found something. This only happens at least on my end when there are collections and the parent is empty. So if a user has collection of something, and there are no users, When you call /user it will throw the error. If I add a user, and call /user, then everything works fine. Should it not return an empty result set reguardless of if there is a collection attached.
after rereading the initial post and doing some testing on my side i created a pull request with updated package.json
I'm having the same problem, I'll try your patch @matuck , thanks for posting!
Can confirm that this patch fixes the problem I was having.
Thanks again @matuck !
buffer.js:761
return this.utf8Write(string, offset, length);
^
RangeError: Offset is out of bounds
at RangeError (native)
at Buffer.write (buffer.js:761:21)
at PacketWriter.writeString (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/protocol/PacketWriter.js:79:16)
at ComQueryPacket.write (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/protocol/packets/ComQueryPacket.js:9:10)
at Protocol._emitPacket (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:293:10)
at Query.<anonymous> (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:154:12)
at emitOne (events.js:96:13)
at Query.emit (events.js:188:7)
at Query.start (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/protocol/sequences/Query.js:29:8)
at Protocol._startSequence (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:355:14)
at Protocol._enqueue (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/protocol/Protocol.js:186:10)
at PoolConnection.query (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/mysql/lib/Connection.js:201:25)
at /home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/lib/adapter.js:806:26
at /home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/async/lib/async.js:181:20
at Object.async.forEachOf.async.eachOf (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/async/lib/async.js:233:13)
at Object.async.forEach.async.each (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/async/lib/async.js:209:22)
at Array.async.auto.processChildren (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/lib/adapter.js:748:23)
at listener (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/async/lib/async.js:605:42)
at /home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/async/lib/async.js:544:17
at _arrayEach (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/async/lib/async.js:85:13)
at Immediate.taskComplete (/home/dvitali/Documents/work/coelis/p/htc16/node_modules/sails-mysql/node_modules/async/lib/async.js:543:13)
at runCallback (timers.js:574:20)
@alexnum,@sailsbot,@matuck,@denysvitali: Hello, I'm a repo bot-- nice to meet you!
It has been 30 days since there have been any updates or new comments on this page. If this issue has been resolved, feel free to disregard the rest of this message and simply close the issue if possible. On the other hand, if you are still waiting on a patch, please post a comment to keep the thread alive (with any new information you can provide).
If no further activity occurs on this thread within the next 3 days, the issue will automatically be closed.
Thanks so much for your help!
Pull request still has not been accepted
Hello @sailsbot, nice to meet you too (lol)
I think this bug is still present
It is indeed. The PR hasn't been accepted yet. I just ran into the same issue
If you want to use the module until this PR is merged, add the following to package.json
"sails-mysql": "git+https://github.com/matuck/sails-mysql.git
@denysvitali @matuck @eriedl-kiban @alexnum Thanks for providing the workaround and confirmations, guys. Just merged- and will publish sails-mysql ASAP (looking into a few other things at the same time).
No problem, glad this is being merged! (:
Most helpful comment
@denysvitali @matuck @eriedl-kiban @alexnum Thanks for providing the workaround and confirmations, guys. Just merged- and will publish sails-mysql ASAP (looking into a few other things at the same time).