[Bug]: Malformed packet issue with Node serial transport
Before submitting
- [x] I have searched existing issues to make sure this bug hasn't already been reported
- [x] I have updated to the latest version of the software to verify the issue still exists
- [x] I have cleared cache/cookies/storage or tried in a private/incognito window (if applicable)
Hardware
Heltec V3
Connection Type
Serial
Local or Hosted
http://meshtastic.local
Firmware Version
2.7.4
Operating System
Linux
Browser
Node.js
Expected Behavior
Serial connection stays up and we're able to send and receive packets.
Actual Behavior
Using the serial transport, I'm seeing this failure occur after a few hours (<6) of operation. After this the socket becomes closed.
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: Error sending packet 739111562 Error: illegal tag: field no 6 wire type 6
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at BinaryReader.tag (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:1937:59)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at readMessage (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:5557:32)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at readMessageField (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:5674:2)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at readField (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:5604:23)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at readMessage (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:5569:3)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at fromBinary (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:5539:2)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at Object.write (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:12370:27)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at invokePromiseCallback (node:internal/webstreams/util:172:10)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at node:internal/webstreams/util:177:23
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at writableStreamDefaultControllerProcessWrite (node:internal/webstreams/writablestream:1129:5)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at writableStreamDefaultControllerAdvanceQueueIfNeeded (node:internal/webstreams/writablestream:12>
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at writableStreamDefaultControllerWrite (node:internal/webstreams/writablestream:1118:3)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at writableStreamDefaultWriterWrite (node:internal/webstreams/writablestream:1008:3)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at [kChunk] (node:internal/webstreams/readablestream:1587:31)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at readableStreamFulfillReadRequest (node:internal/webstreams/readablestream:2120:24)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at readableStreamDefaultControllerEnqueue (node:internal/webstreams/readablestream:2312:5)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at transformStreamDefaultControllerEnqueue (node:internal/webstreams/transformstream:508:5)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at TransformStreamDefaultController.enqueue (node:internal/webstreams/transformstream:324:5)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at Object.transform (file:///home/pi/.signalk/node_modules/@meshtastic/core/dist/mod.mjs:12251:18)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at invokePromiseCallback (node:internal/webstreams/util:172:10)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at Object.<anonymous> (node:internal/webstreams/util:177:23)
Aug 21 19:44:21 lille-oe-pi signalk-server[56700]: at transformStreamDefaultControllerPerformTransform (node:internal/webstreams/transformstream:527
The backtrace points to this line in our codebase: https://github.com/meshtastic/web/blob/32f31cb502d4b61a11f4c33c0bac9e9fb509707a/packages/core/src/utils/transform/decodePacket.ts#L14
Steps to Reproduce
Run signalk-meshtastic on Node.js 22+ Connect to a Heltec V3.2 node using USB serial connection Wait for crash
Relevant console output
Screenshots
No response
Additional Context
This happened when testing if using serial would be a way to work around https://github.com/meshtastic/firmware/issues/7706
@bergie Is this still relevant or has this been fixed with the recent node-serial updates?
I think the issue likely still occurs, but now we don't crash from it.
This also occurs with web serial transport
⚠️ Malformed packet found, discarding: 148,195 transform @ index-RAoaA17I.js:524
⚠️ Malformed packet found, discarding: 148,195,2,27,91,51,52,109,68,69,66,85,71,32,27,91,48,109,124,32,63,63,58,63,63,58,63,63,32,50,32,91,83,101,114,105,97,108,67,111,110,115,111,108,101,93,32,27,91,51,52,109,70,114,111,109,82,97,100,105,111,61,83,84,65,84,69,95,83,69,78,68,95,80,65,67,75,69,84,83,13