38331

Openshift NodeJS + MongoDB application suddenly stops

Question:

I recently started using OpenShift as a scalable platform for a NodeJS + MongoDB application. I got it all working, except that after some time (mostly within a few hours or days) my application suddenly gets inaccesible. I think there are 2 causes for my app to stop. One cause is that the MongoDB connection times out, which is probably an easy fixable error by checking whether the database is still connected before using the database.

However the other cause is that NodeJS suddenly stops listening to new requests. I am not exactly sure what happens and what the reason for this behaviour is, but when this happens, I have to manually restart the application through ssh, and in a production environment this is unacceptable.

Since I dont get any errors, I can't really provide any more details, except that i (probably) have a scalable app, currently using 2 gears, one for the NodeJS app and one for the MongoDB database. I use MongooseJS to connect to the database. For the time being im still in the free plan, but once more traffic is coming, ill probably go for the silver plan (assuming that scaling actually works).

I hope someone can provide me with some advice or a solution.

Sincerely,

Hylke Bron

Answer1:

So there are a few things you should be aware of. The first being Idling, If your application does not receive any external http requests for 48 hours it will be idled. Then once a http request is made the application will come back online automatically.

If you're getting external http requests frequently then the next thing we'll need to check is the logs for your application. You can check the logs for your app but running rhc tail <yourappname>.

Recommend

  • Write JSON data from front-end to back-end in nodejs
  • Why don't we register broadcast receiver for BOOT_COMPLETED events
  • Linear gradient not applying in Webkit with d3 generated SVG
  • Is it possible to disable esc/F11 key during full screen mode of webpage, programmatically?
  • How do `pass` and `listen` work in WriterT?
  • Generating random numbers directly inside a .htaccess file
  • How to change default stop edit behavior in jtable
  • Hibernate in Glassfish - Ejb3Configuration NoClassDefFoundError
  • Javascript unload page condition
  • How to resolve dependencies from one gradle project to another gradle project in my Eclipse workspac
  • Cursor in wrong place in contenteditable
  • Deduce parent class of inherited method in C++
  • Specifying virtual keyboard type for EditText in XML
  • Receiver has no segue with identifier“***”
  • What is this strange character in chrome's resource css viewer?
  • File extension of zlib zipped html page?
  • Time out Error in send mail
  • New Firebase failed: First argument must be a valid firebase URL and the path can't contain “.”
  • Spring integration inbound-gateway Fire an event when queue is empty
  • Cloud Code function running twice
  • Hide HTML elements without javascript, only CSS
  • Trying to get the char code of ENTER key
  • Using Sax parsing to edit and write XML in VB6
  • Debug.DrawLine not showing in the GameView
  • Transactional Create with Validation in ServiceStack Redis Client
  • Yii2: Config params vs. const/define
  • Avoid links criss cross / overlap in d3.js using force layout
  • Recording logins for password protected directories
  • Exchange data b/w iOS devices using Bluetooth 4.0
  • How to extract text from Word files using C#?
  • How to check if every primary key value is being referenced as foreign key in another table
  • Sending data from AppleScript to FileMaker records
  • How to make Safari send if-modified-since header?
  • Web-crawler for facebook in python
  • VB.net deserialize, JSON Conversion from type 'Dictionary(Of String,Object)' to type '
  • Hits per day in Google Big Query
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • Linking SubReports Without LinkChild/LinkMaster
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • How to get NHibernate ISession to cache entity not retrieved by primary key