Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Azure node expressjs app crashes randomly without error

I have built a simple node application with expressjs which applies socket.io. In order for sockets to communicate in cluster mode on azure the app uses also redis cache from azure as well.

This project has being deployed to azure under a linux web app which it uses docker container.

The problem is that i am facing a random crash of the app after 18 hours to 36 (as i have seen) and when you visit the url you see the nginx error web page.

I had used the following code to detect the error to the logs and i also deployed it to a staging environment on a linux machine i own

process
  .on('unhandledRejection', (reason, p) => {
    logger.error(reason, 'Unhandled Rejection at Promise', p)
  })
  .on('uncaughtException', err => {
    logger.error(err, 'Uncaught Exception thrown')
    process.exit(1)
  })

On the staging machine there are no crashes at all.

I am starting to think this is something to do with the docker container on the azure but i have no indication of such thing.

** Important the web app is set to be always active **

Any ideas or suggestions

like image 355
Panagiotis Vrs Avatar asked Nov 07 '22 00:11

Panagiotis Vrs


1 Answers

I had something similar before. In my case, it was because I had no log rotation, so the log file would grow into a unique giant file making it impossible for the server to write to it.

like image 58
Tourki Avatar answered Nov 09 '22 22:11

Tourki