Effect CommunityEC
Effect Community3y ago
13 replies
attila

Errors causing server shutdown in `@sqlfx/mysql` library

I'm using
@sqlfx/mysql
and I see the following errors causing my server to shut down. They occur periodically, once every 10 minutes. I use the default configuration of the library, i.e. minConnection: 1, maxConnection: 10, TTL: 45 minutes, etc. I've only found this SO discussing a similar issue where they suggested to solve it with setting minDelayValidation to
0
. However, that setting is not surfaced via the library (problem of wrapping libraries) but also, I'm not sure if it would help since the library runs its own pooling mechanism. The interesting thing is that once I integrated the app with Sentry, the errors stopped occurring. I did not expect to see the observer effect 😅 Any idea what could cause this periodic failure?
Error: uncaughtException
    at process.<anonymous> (file:///app/packages/server/dist/index.js:31:14)
    at process.emit (node:events:526:35)
    at process.emit (node:domain:488:12)
    at process._fatalException (node:internal/process/execution:159:25) {
  [cause]: SqlError: (conn=63033149, no: 45009, SQLState: 08S01) socket has unexpectedly been closed
      at module.exports.createFatalError (/app/node_modules/mariadb/lib/misc/errors.js:88:10)
      at Connection.socketErrorHandler (/app/node_modules/mariadb/lib/connection.js:1107:20)
      at Socket.emit (node:events:526:35)
      at Socket.emit (node:domain:488:12)
      at endReadableNT (node:internal/streams/readable:1408:12)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
    sqlMessage: 'socket has unexpectedly been closed',
    sql: null,
    fatal: true,
    errno: 45009,
    sqlState: '08S01',
    code: 'ER_SOCKET_UNEXPECTED_CLOSE'
  }
}
Screenshot_2023-11-06_at_09.02.39.png
Was this page helpful?