Skip to Content

XSA Node Module Crashes when left idle for some time?

Hello All,

I have Created XSA Application(Node Module) to load/access data in HDB Container. It runs fine but if I try to access application after some time (next day), I get this error (An error occurred. Please open the SAP Web IDE Run console to view more information about the error.)

Log from SAP Web IDE

3/7/18 1:00:54.518 PM [APP/5-2] ERR    events.js:160
3/7/18 1:00:54.519 PM [APP/5-2] ERR          throw er; // Unhandled 'error' event
3/7/18 1:00:54.519 PM [APP/5-2] ERR          ^
3/7/18 1:00:54.519 PM [APP/5-2] ERR
3/7/18 1:00:54.519 PM [APP/5-2] ERR    Error: read ECONNRESET
3/7/18 1:00:54.519 PM [APP/5-2] ERR        at exports._errnoException (util.js:1018:11)
3/7/18 1:00:54.519 PM [APP/5-2] ERR        at TCP.onread (net.js:568:26)
3/7/18 2:01:44.000 PM [APP/5-2] TRC    /appcontroller.xUbWa9K2pf/AppController/node_modules/applicationcontroller/controller/proxyRequests.js:17 [] ERROR: Error occurred, Cannot proxy application requests...Error: connect ECONNREFUSED 127.0.0.1:64615

Server.js File

/*eslint no-console: 0, no-unused-vars: 0*/
"use strict";

var xsenv = require("@sap/xsenv"),
	port = process.env.PORT || 3000,
	server = require("http").createServer(),
	express = require("express"),
	app = express(),
	xsHDBConn = require("@sap/hdbext");

function initRouter() {
	return require("./router")(app, server);
}
var options = {
	anonymous: true // remove to authenticate calls
};

// configure HANA
try {
	options = Object.assign(options, xsenv.getServices({
		hana: {
			tag: "hana"
		}
	}));
} catch (err) {
	console.log("[WARN]", err.message);
}

app.use(xsHDBConn.middleware(options.hana));
// start server
var router = initRouter(app);
server.on("request", app);
server.listen(port, function() {
	console.info("HTTP Server: " + server.address().port);
});

How can I make the XSA application to be accessible all the time..??

Thanks in Advance.

Regards

Talha

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    Dec 20, 2017 at 06:15 PM

    Hi Talha,

    Thanks for reaching out to us for this issue. We have contacted a colleague from XSA team to investigate on it. Will get back to you as soon as we hear from them.

    Thanks,

    Vidya

    Add comment
    10|10000 characters needed characters exceeded

    • hi Vidhya,

      You got any update. Moreover i also noticed that this error comes only if u are running app through WEB ide. If you have deployed your app in PROD space(using xs deploy) this error will not come.

      Moreover i have a query:

      If an app crashes in prod env (app deployed using xs deploy) will it get auto restarted?

      regards,

      Himanshu

  • Dec 21, 2017 at 09:17 AM

    Hi Talha,

    Obviously, the AppContoller has lost its connection to your actual app. AppController is a proxy that WebIDE injects in front of any node.js app started from WebIDE. It is used for exchanging source code deltas so that it can be quickly restarted within seconds instead of minutes.

    You should look in the logs of your app via "xs logs" command line interface or xsa-admin UI. I would expect that you find some hint there why your app has crashed.

    Best,

    Christoph

    Add comment
    10|10000 characters needed characters exceeded