-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(node:29022) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [InterfaceStream]. Use emitter.setMaxListeners() to increase limit
#399
Comments
Scene item: {
"_id": "65905fb1ee556e336fe280da",
"name": "Schlafen",
"makros": [
{
"type": "command",
"endpoint": "6590585fed87038064218f69",
"command": "6590585fed87038064218f6b",
"_id": "659061b43a9527ccc3318e11",
"enabled": true
},
{
"type": "command",
"endpoint": "63a0ce5b33d59ec69d8ffe18",
"command": "63a0ce5b33d59ec69d8ffe1d",
"_id": "659061b43a9527ccc3318e12",
"enabled": true
},
{
"type": "command",
"endpoint": "63a1753f44427ef1a83426bf",
"command": "63a1753f44427ef1a83426c1",
"_id": "659061b43a9527ccc3318e13",
"enabled": true
},
{
"type": "command",
"endpoint": "63a1753f44427ef1a83426af",
"command": "63a1753f44427ef1a83426b1",
"_id": "659061b43a9527ccc3318e14",
"enabled": true
},
{
"type": "command",
"endpoint": "6590585ced87038064218f61",
"command": "6590585ced87038064218f63",
"_id": "659061b43a9527ccc3318e15",
"enabled": true
}
],
"timestamps": {
"created": 1703960497048,
"updated": 1704660871193
},
"labels": [],
"triggers": [
{
"type": "cronjob",
"params": {
"cron": "* * * * *"
},
"_id": "659b0f87b706a2a556b6e762",
"enabled": true
},
{
"type": "webhook",
"params": {
"_id": "647c29cb62ad0449380f0abe"
},
"_id": "659b0f87b706a2a556b6e763",
"enabled": true
}
],
"visible": true,
"icon": null
} |
Could because when no connector is available, no data can be send, but the write succeed and a event listener for "data" is added. But never called: backend/components/endpoints/class.command.js Lines 99 to 135 in c5520a7
|
When the command timesout, remove the listener. |
Two possible solutions:
Remove handler codeconst Joi = require("joi");
const mongodb = require("mongodb");
const _timeout = require("../../helper/timeout.js");
const { interfaces } = require("../../system/shared.js");
const Param = require("./class.param.js");
/**
* @description
* Single command
*
* @class Command
*
* @param {Object} obj Object that matches the item schema. See properties below:
*
* @property {String} [_id=ObjectID] MongoDB ObjectID as String
* @property {String} interface Device Interface `_id`
* @property {String} name Human friendly name
* @property {String} alias Machine friendly name, e.g.: `POWER_ON`
* @property {String} [identifier=null] Simple/custom identifiert for custom command handler
* @property {String|Buffer} payload The payload to send over the device interface
* @property {String} [description=null] Command description, displayed on the frontend
* @property {Array} params Possible parameter for the command
* @property {String} params[].key Custom key
* @property {String} params[].type Type of value: "string", "number" or "boolean"
* @property {String|Number|Boolean} params[].value Value to set
* @property {Number} [params[].min=0] Min value if param type is a number (`type=number`)
* @property {Number} [params[].max=100] Max value if param type is a number (`type=number`)
*
* @example
* ```json
{
_id: "604a75e6eb5de037846df24c",
name: "Power On", // Human redable
alias: "POWER_ON", // Something you can easy reminder, e.g for register handling callbacks
//identifier: "1", // Something your devices sets/needs
payload: "PWR01", // Payload that gets send raw to the device
description: "", // should be self-explanatory]
interface: "603fe5d18791152879a9babd"
}, {
_id: "604a75e6eb5de037846df24d",
name: "Power Off", // Human redable
alias: "POWER_OFF", // Something you can easy reminder, e.g for register handling callbacks
//identifier: "2", // Something your devices sets/needs
payload: "PWR00", // Payload that gets send raw to the device
description: "", // should be self-explanatory
interface: "603fe5d18791152879a9babd"
}, {
_id: "60546eaff7d8a2b752330b37",
name: "Master Volume", // Human redable
alias: "MASTER_VOLUME", // Something you can easy reminder, e.g for register handling callbacks
//identifier: "4", // Something your devices sets/needs
payload: "MVL${v}", // Payload that gets send raw to the device
description: "",
params: [{
key: "v",
min: 0,
max: 100,
default: 35
}],
interface: "603fe5d18791152879a9babd"
}, {
_id: "604a75e6eb5de037846df24e",
name: "Mute (Toggle)",
//alias: "",
payload: "AMTTG",
interface: "603fe5d18791152879a9babd"
} */
};
|
Quick draft: class.command.js const Joi = require("joi");
const mongodb = require("mongodb");
const _timeout = require("../../helper/timeout.js");
const { interfaces } = require("../../system/shared.js");
const Param = require("./class.param.js");
/**
* @description
* Single command
*
* @class Command
*
* @param {Object} obj Object that matches the item schema. See properties below:
*
* @property {String} [_id=ObjectID] MongoDB ObjectID as String
* @property {String} interface Device Interface `_id`
* @property {String} name Human friendly name
* @property {String} alias Machine friendly name, e.g.: `POWER_ON`
* @property {String} [identifier=null] Simple/custom identifiert for custom command handler
* @property {String|Buffer} payload The payload to send over the device interface
* @property {String} [description=null] Command description, displayed on the frontend
* @property {Array} params Possible parameter for the command
* @property {String} params[].key Custom key
* @property {String} params[].type Type of value: "string", "number" or "boolean"
* @property {String|Number|Boolean} params[].value Value to set
* @property {Number} [params[].min=0] Min value if param type is a number (`type=number`)
* @property {Number} [params[].max=100] Max value if param type is a number (`type=number`)
*
* @example
* ```json
{
_id: "604a75e6eb5de037846df24c",
name: "Power On", // Human redable
alias: "POWER_ON", // Something you can easy reminder, e.g for register handling callbacks
//identifier: "1", // Something your devices sets/needs
payload: "PWR01", // Payload that gets send raw to the device
description: "", // should be self-explanatory]
interface: "603fe5d18791152879a9babd"
}, {
_id: "604a75e6eb5de037846df24d",
name: "Power Off", // Human redable
alias: "POWER_OFF", // Something you can easy reminder, e.g for register handling callbacks
//identifier: "2", // Something your devices sets/needs
payload: "PWR00", // Payload that gets send raw to the device
description: "", // should be self-explanatory
interface: "603fe5d18791152879a9babd"
}, {
_id: "60546eaff7d8a2b752330b37",
name: "Master Volume", // Human redable
alias: "MASTER_VOLUME", // Something you can easy reminder, e.g for register handling callbacks
//identifier: "4", // Something your devices sets/needs
payload: "MVL${v}", // Payload that gets send raw to the device
description: "",
params: [{
key: "v",
min: 0,
max: 100,
default: 35
}],
interface: "603fe5d18791152879a9babd"
}, {
_id: "604a75e6eb5de037846df24e",
name: "Mute (Toggle)",
//alias: "",
payload: "AMTTG",
interface: "603fe5d18791152879a9babd"
} */
};
|
While testing a fix for #390 a cron with
* * * * *
was created, which shows after a couple of mins:(node:29022) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 data listeners added to [InterfaceStream]. Use emitter.setMaxListeners() to increase limit
The text was updated successfully, but these errors were encountered: