Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switched to mySQL - Server Crash with Error #3464

Closed
JSuenram opened this issue Jan 15, 2022 · 12 comments
Closed

Switched to mySQL - Server Crash with Error #3464

JSuenram opened this issue Jan 15, 2022 · 12 comments

Comments

@JSuenram
Copy link
Contributor

JSuenram commented Jan 15, 2022

Just imported Data with Meshcentral from neDB to mySQL, server is running but crashed after a few minutes...
Service restarted but unsure what has happened here?

-------- 15.1.2022, 21:05:58 ---- 0.9.68 --------

events.js:291
      throw er; // Unhandled 'error' event
      ^

Error: Packets out of order. Got: 0 Expected: 6
    at Parser._tryReadPacketHeader (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:470:15)
    at Parser.write (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:33:29)
    at Protocol.write (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:38:16)
    at Socket.<anonymous> (/etc/meshcentral/node_modules/mysql/lib/Connection.js:88:28)
    at Socket.<anonymous> (/etc/meshcentral/node_modules/mysql/lib/Connection.js:526:10)
    at Socket.emit (events.js:314:20)
    at addChunk (_stream_readable.js:297:12)
    at readableAddChunk (_stream_readable.js:272:9)
    at Socket.Readable.push (_stream_readable.js:213:10)
    at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Emitted 'error' event on Connection instance at:
    at Connection._handleProtocolError (/etc/meshcentral/node_modules/mysql/lib/Connection.js:423:8)
    at Protocol.emit (events.js:314:20)
    at Protocol._delegateError (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:398:10)
    at Protocol.handleParserError (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:380:10)
    at Parser._tryReadPacketHeader (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:478:10)
    at Parser.write (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:33:29)
    [... lines matching original stack trace ...]
    at Socket.emit (events.js:314:20) {
  code: 'PROTOCOL_PACKETS_OUT_OF_ORDER',
  fatal: true
}
@Ylianst
Copy link
Owner

Ylianst commented Jan 15, 2022

I have never seen this, but looking online I found this link. You need to increase mysql max_allowed_packet parameter in mysql configuration file (my.cnf):

max_allowed_packet=500M

I am not an expert with MySQL, but let us know if this works.

I also found this link that may be interesting.

@JSuenram
Copy link
Contributor Author

JSuenram commented Jan 15, 2022

max_allowed_packet=500M

We changed this in mySQL-Config and will keep an eye on this....

And damn.... that was a fast reply! :-)

@JSuenram
Copy link
Contributor Author

I am sorry, but even with this change, Server/MeshCentral still crashing with error.

`-------- 15.1.2022, 21:39:22 ---- 0.9.68 --------

events.js:291
throw er; // Unhandled 'error' event
^

Error: Connection lost: The server closed the connection.
at Protocol.end (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:112:13)
at Socket. (/etc/meshcentral/node_modules/mysql/lib/Connection.js:94:28)
at Socket. (/etc/meshcentral/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (events.js:326:22)
at endReadableNT (_stream_readable.js:1241:12)
at processTicksAndRejections (internal/process/task_queues.js:84:21)
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/etc/meshcentral/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:314:20)
at Protocol._delegateError (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Protocol.end (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:116:8)
at Socket. (/etc/meshcentral/node_modules/mysql/lib/Connection.js:94:28)
[... lines matching original stack trace ...]
at processTicksAndRejections (internal/process/task_queues.js:84:21) {
fatal: true,
code: 'PROTOCOL_CONNECTION_LOST'
}

-------- 15.1.2022, 21:40:54 ---- 0.9.68 --------

events.js:291
throw er; // Unhandled 'error' event
^

Error: Packets out of order. Got: 0 Expected: 2
at Parser._tryReadPacketHeader (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:470:15)
at Parser.write (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:33:29)
at Protocol.write (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket. (/etc/meshcentral/node_modules/mysql/lib/Connection.js:88:28)
at Socket. (/etc/meshcentral/node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (events.js:314:20)
at addChunk (_stream_readable.js:297:12)
at readableAddChunk (_stream_readable.js:272:9)
at Socket.Readable.push (_stream_readable.js:213:10)
at TCP.onStreamRead (internal/stream_base_commons.js:188:23)
Emitted 'error' event on Connection instance at:
at Connection._handleProtocolError (/etc/meshcentral/node_modules/mysql/lib/Connection.js:423:8)
at Protocol.emit (events.js:314:20)
at Protocol._delegateError (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:398:10)
at Protocol.handleParserError (/etc/meshcentral/node_modules/mysql/lib/protocol/Protocol.js:380:10)
at Parser._tryReadPacketHeader (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:478:10)
at Parser.write (/etc/meshcentral/node_modules/mysql/lib/protocol/Parser.js:33:29)
[... lines matching original stack trace ...]
at Socket.emit (events.js:314:20) {
code: 'PROTOCOL_PACKETS_OUT_OF_ORDER',
fatal: true
}`

@JSuenram
Copy link
Contributor Author

Switched back to neDB for now..... the whole ideas was to have access to the database for exporting "connection-times" more easily.... but I think, that data is encrypted anyway....

@Ylianst
Copy link
Owner

Ylianst commented Jan 17, 2022

You can look at device connection times by hovering your mouse over a connection time bar, or use the export button to export the connection data for a device.

image

Also, the connection times are not encrypted. If using NeDB, they will be in meshcentral-power.db in the meshcentral-data folder. If using another database, a power table or collection will be created for this data. If you see long random looking identifiers, they are probably the device identifiers.

@JSuenram
Copy link
Contributor Author

Bringing this back to top, as we might have a real fix for this.
We are using mySQL 8.0.26 and some digging around brought us to this "hint".
mysqljs/mysql#2534

So the way of connection for mySQL there was change. from mysql.createConnection to mysql.createPool, the error never happen again...

So far preparing a fix or maybe @Ylianst can do this faster. Currently not sure if his is only in "db.js" or somewhere else...

@JSuenram JSuenram reopened this Jan 21, 2022
@JSuenram
Copy link
Contributor Author

Staged a fix for next version... maybe...

@brodypiper
Copy link

any update here?

@dinger1986
Copy link
Contributor

Looks like the fix was merged 2 years ago

@si458
Copy link
Collaborator

si458 commented Nov 28, 2023

Looks like the fix was merged 2 years ago

i also fixed mysql8 the other month too along with mariadb?

@brodypiper
Copy link

brodypiper commented Nov 28, 2023 via email

@si458
Copy link
Collaborator

si458 commented Nov 28, 2023

@brodypiper we changes mysql to mysql2 last month? are you running the latest version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants