loopback-connector-mysql icon indicating copy to clipboard operation
loopback-connector-mysql copied to clipboard

I get Error: read ECONNRESET at TCP.onStreamRead after some running time

Open nehemiekoffi opened this issue 1 year ago • 1 comments

Steps to reproduce

  • Run loopback4 app using "loopback-connector-mysql": "7.0.13"
  • All endpoints work fine
  • After some time (e.g 2 hours), try to get data from an endpoint
  • I receive error 500 Request GET /settings failed with status code 500. Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20)
  • After 3 or 4 retry, then I get a good response from the server.

Current Behavior

  • I get error 500 after some running time (e.g 2 hours) with my loopback4 app
  • But I have a loopback3 (node 14) application connected to that same database that is using loopback-connector-mysql": "^5.4.3" and I do not have such error even after 24h on running

Expected Behavior

  • I should get the response from the database without error

Link to reproduction sandbox

N/A

Additional information

node -e 'console.log(process.platform, process.arch, process.versions.node)' linux x64 18.20.4

npm ls --prod --depth 0 | grep loopback +-- @loopback/[email protected] +-- @loopback/[email protected] +-- @loopback/[email protected] +-- @loopback/[email protected] +-- @loopback/[email protected] +-- @loopback/[email protected] +-- @loopback/[email protected] +-- @loopback/[email protected] +-- @loopback/[email protected] +-- [email protected]

Related Issues

See Reporting Issues for more tips on writing good issues

nehemiekoffi avatar Sep 10 '24 13:09 nehemiekoffi

I can confirm, that we are investigating similar, maybe same, issue for a few months. Up to this date we were tweaking database to fix this problem but without success.

After some up time we are seeing this error in logs:

Request GET /v2/auction/31 failed with status code 500. Error: write ECONNRESET
    at afterWriteDispatched (node:internal/stream_base_commons:160:15)
    at writeGeneric (node:internal/stream_base_commons:151:3)
    at Socket._writeGeneric (node:net:962:11)
    at Socket._write (node:net:974:8)
    at writeOrBuffer (node:internal/streams/writable:392:12)
    at _write (node:internal/streams/writable:333:10)
    at Writable.write (node:internal/streams/writable:337:10)
    at PoolConnection.write (/home/node/app/node_modules/mysql2/lib/connection.js:261:32)
    at PoolConnection.writePacket (/home/node/app/node_modules/mysql2/lib/connection.js:310:12)
    at Query.start (/home/node/app/node_modules/mysql2/lib/commands/query.js:60:16)
    at Query.execute (/home/node/app/node_modules/mysql2/lib/commands/command.js:45:22)
    at PoolConnection.handlePacket (/home/node/app/node_modules/mysql2/lib/connection.js:481:34)
    at PoolConnection.addCommand (/home/node/app/node_modules/mysql2/lib/connection.js:507:12)
    at PoolConnection.query (/home/node/app/node_modules/mysql2/lib/connection.js:575:17)
    at runQuery (/home/node/app/node_modules/loopback-connector-mysql/lib/mysql.js:224:16)
    at executeWithConnection (/home/node/app/node_modules/loopback-connector-mysql/lib/mysql.js:266:7)

AdamSmid avatar Dec 17 '24 15:12 AdamSmid