Extensions timeout
Simon Ryf
simon.ryf at dualstack.ch
Thu Jan 31 16:22:19 EST 2019
Dan and Zaid – do you know that you’re still having a “bug” when using Node >=8.x on that?
https://nodejs.org/api/http.html#http_server_keepalivetimeout
you need to fix that in server.js I can give you the code I’ve added for that.
I’m not really a Node dev and therefore I didn’t yet made a pull request…
Cheers
Simon
From: Users <users-bounces at lists.genieacs.com> on behalf of Dan Morphis <dan at milkcarton.com>
Reply-To: Community support for GenieACS users <users at lists.genieacs.com>
Date: Thursday, 31 January 2019 at 20:54
To: Community support for GenieACS users <users at lists.genieacs.com>
Subject: Re: Extensions timeout
You can increase the extension timeout by adding "EXT_TIMEOUT": 30000, to the genieacs/config/config.json file. Timeout is in milliseconds.
-dan
On Tue, Jan 29, 2019 at 11:27 PM Mirek Lauš <mirek at laus.cz<mailto:mirek at laus.cz>> wrote:
Hello Genieacs users,
my extensions sometimes results in timeout without a reason giving a NodeJS
error in the log:
> 1: node::Abort(void) [/usr/local/bin/node]
> 2: node::PlatformInit(void) [/usr/local/bin/node]
> 3: node::Start(int, char**) [/usr/local/bin/node]
> 4: _start [/usr/local/bin/node]
My extension is called from Provision script:
> let genieacsId = declare("DeviceID.ID", {value: 1}).value[0];
> let externalIp = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.ExternalIPAddress", {value: 1}).value[0];
> let connReqUrl = declare("InternetGatewayDevice.ManagementServer.ConnectionRequestURL", {value: 1}).value[0];
>
> let args = {id: genieacsId, url: connReqUrl, ip: externalIp};
>
> log('remoteCallback call script');
>
> let resp = ext('remote', 'remoteCallback', JSON.stringify(args));
> log('remote response ' + genieacsId + ': ' + resp);
And the extension:
> const API_URL = 'https://remote.url/api/genieacs';
> const url = require("url");
> const http = require(API_URL.split(":", 1)[0]);
>
> const logger = require('../../lib/logger');
>
> function remoteCallback(args, callback) {
>
> let params = JSON.parse(args[0]);
>
> const uri = API_URL + "/callback.pl?id=<http://callback.pl?id=>" + params.id<http://params.id> + "&url=" + params.url + "&ip=" + params.ip;
>
> let options = url.parse(uri);
> options.headers = { accept: 'application/json', "content-type": 'application/json' };
>
> logger.info<http://logger.info>({message: 'post callback ' + params.id<http://params.id>});
>
> let request = http.get(options, function (response) {
>
> if (response.statusCode == 404) {
> return callback(null, null);
> }
>
> if (response.statusCode >= 400) {
> return callback(new Error("Unexpected error. Response Code: " +
> response.statusCode + '. Status Message: ' + response.statusMessage + '. t: ' + typeof response.statusCode));
> }
>
> let data = "";
>
> response.on("data", function(d) {
> data = data + d.toString();
> });
>
> response.on("end", function () {
> logger.info<http://logger.info>({message: 'post callback response: ' + data});
> return callback(null,data);
> });
>
> });
>
> request.on("error", function (err) {
> logger.info<http://logger.info>({message: 'post callback error: ' + err});
> callback(err);
> });
>
> }
>
> exports.remoteCallback = remoteCallback;
How to debug this?
Regards
Mirek
_______________________________________________
Users mailing list
Users at lists.genieacs.com<mailto:Users at lists.genieacs.com>
http://lists.genieacs.com/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20190131/2e6949fa/attachment-0001.html>
More information about the Users
mailing list