2

I have created basic API's in node using express, Every thing works fine but suddenly some times i get 504 time out where pm2 status is online and the timeout continues till i restart the pm2 again, I have even checked the server health every thing is fine even sql server health is fine. i have checked the pm2 logs and every thing in logs is fine too.

I am checking the API's using postman with pm2 logs enabled, it takes time and shows 504 error with no logs and after pm2 restart everything works fine for some time

Srinath
  • 275
  • 3
  • 11
  • 1
    This, to me, sounds like some code path has a bug in it. Suggest you go through through your code and ensuring you have Try/Catches and where you have caught an exception you are returning that back to the API response. E.g. res.status(500).send("something broke"). In addition to looking at try/catches, are you using promises in any of your services? If so, ensure the required resolve and reject statements are correctly and logically placed as well as returning any errors. – Chris Adams Mar 15 '19 at 07:47
  • Thanks and sorry for the late reply. I have found the problem by going throuh the code, The thing was i missed MySQL connection release at some places while using connection pool limit of just 20. So, making back to back tests filled the connections and other connections remained in queue which resulted to timeout Now i have close the connections every where by increasing the limit of pool to 50 now, it's working fine – Srinath Mar 28 '19 at 09:39

0 Answers0