node-minecraft-protocol icon indicating copy to clipboard operation
node-minecraft-protocol copied to clipboard

Fix serialization issue in old version for mc server test

Open rom1504 opened this issue 1 year ago • 7 comments

  1. mc-server 1.12.2v kicks clients when invalid credentials: Uncaught RangeError [ERR_OUT_OF_RANGE]: The value of "offset" is out of range. It must be >= 0 and <= 45. Received -847077210 at new NodeError (node:internal/errors:405:5) at boundsError (node:internal/buffer:88:9) at Buffer.readUInt8 (node:internal/buffer:254:5) at readVarInt (node_modules/protodef/src/datatypes/utils.js:68:22) at Splitter._transform (src/transforms/framing.js:63:30) at Transform._write (node_modules/readable-stream/lib/internal/streams/transform.js:153:8)

rom1504 avatar Oct 12 '24 21:10 rom1504

fyi @extremeheat

rom1504 avatar Oct 12 '24 21:10 rom1504

I think this is likely caused by recent node protodef changes https://github.com/ProtoDef-io/node-protodef/commits/master/

rom1504 avatar Nov 02 '24 10:11 rom1504

Only change in ProtoDef was how the compiler inlined anonymous containers (treats them as normal containers then merges object into parent), so I don't think it would affect anything big.

Would need to see what packet specifically is causing the error and the dumped buffer to reproduce (the stack trace here is limited to only a few lines it seems)

extremeheat avatar Nov 02 '24 10:11 extremeheat

https://github.com/ProtoDef-io/node-protodef/commit/fcf3ca0568eb8cc0d0167c79db454572165da3f7 was also recently released

rom1504 avatar Nov 02 '24 12:11 rom1504

https://github.com/PrismarineJS/mineflayer/issues/3492 mentions packet advancement

rom1504 avatar Nov 02 '24 12:11 rom1504

For 1.21 wonder if it could be https://github.com/PrismarineJS/node-minecraft-protocol/blob/master/src/datatypes/compiler-minecraft.js#L44

rom1504 avatar Nov 03 '24 21:11 rom1504

Looks like the tests are flaky, might be a timing issue

extremeheat avatar Dec 22 '24 01:12 extremeheat