homebridge-eufy-security / plugin

Homebridge plugin to control certain Eufy Security devices
Apache License 2.0
165 stars 24 forks source link

[Bug]: Memory leak, All RAM is eventually consumed over 24-48hrs #243

Closed streets97f closed 11 months ago

streets97f commented 1 year ago

What happened?

RAM memory is filling up slowly over 1-2 days. I've tried using different snapshot presets, different advanced video setting, period refresh rates, etc., but eventually my RAM is completely maxed out over time. This is using a Eufy dual wired doorbell and I've narrowed it down to the Eufysecurity plugin. I do have an IPad that is on most of the day with homekit open and the camera snap shots cycling every 10-30s. If I close the homekit app on the ipad, the memory leak still happens even...just a bit slower.

Device Type

Doorbell (Supported)

Plugin Version

beta (Best Effort)

HomeBridge Version

v1.4.x (Supported)

NodeJS Version

v16 (Supported)

Operating System

Ubuntu 18.04+ (Supported)

Relevant log output

(node:1072893) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 unhandledRejection listeners added to [process]. Use emitter.setMaxListeners() to increase limit

config

{
    "username": "*******",
    "password": "******",
    "country": "US",
    "deviceName": "Eufy Security",
    "cameras": [
        {
            "serialNumber": "T8203P1122290007",
            "rtsp": false,
            "enableCamera": true,
            "videoConfig": {
                "audio": true,
                "vcodec": "copy",
                "useSeparateProcesses": true
            },
            "talkback": true,
            "hsv": true,
            "snapshotHandlingMethod": 2,
            "refreshSnapshotIntervalMinutes": 10,
            "unbridge": true,
            "hsvRecordingDuration": 90,
            "hsvConfig": {
                "crop": false,
                "vcodec": "copy"
            }
        }
    ],
    "platform": "EufySecurity",
    "ignoreStations": [
        "T8203P1122290007"
    ],
    "ignoreDevices": [],
    "cleanCache": true,
    "preferLocalConnection": true,
    "CameraMaxLivestreamDuration": 240,
    "experimentalMode": false,
    "enableDetailedLogging": true,
    "omitLogFiles": false
}
github-actions[bot] commented 1 year ago

Did you check this Common Issues pages ?

thieren commented 1 year ago

Hi @streets97f

this seems to be an issue of a new dependency that comes with the latest eufy-security-client: media info.js

They already have an issue about this, but it seems they are also redirecting the responsibility to node: https://github.com/buzz/mediainfo.js/issues/89

I'll get in touch with bropat and see if this dependency is really needed.

Here's the full stack-trace:

(node:2382) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 uncaughtException listeners added to [process]. Use emitter.setMaxListeners() to increase limit
    at _addListener (node:events:601:17)
    at process.addListener (node:events:619:10)
    at MediaInfoModuleFactory (/Users/rene/dev/homebridge-plugins/homebridge-eufy-security/node_modules/mediainfo.js/build/MediaInfoModule.js:9:1764)
    at MediaInfoFactory (/Users/rene/dev/homebridge-plugins/homebridge-eufy-security/node_modules/mediainfo.js/src/mediainfo.ts:198:3)
    at /Users/rene/dev/homebridge-plugins/homebridge-eufy-security/node_modules/mediainfo.js/src/mediainfo.ts:177:45
    at new Promise (<anonymous>)
    at MediaInfoFactory (/Users/rene/dev/homebridge-plugins/homebridge-eufy-security/node_modules/mediainfo.js/src/mediainfo.ts:177:12)
    at analyzeCodec (/Users/rene/dev/homebridge-plugins/homebridge-eufy-security/node_modules/eufy-security-client/src/p2p/utils.ts:440:49)
    at P2PClientProtocol.handleDataBinaryAndVideo (/Users/rene/dev/homebridge-plugins/homebridge-eufy-security/node_modules/eufy-security-client/src/p2p/session.ts:1428:37)
github-actions[bot] commented 11 months ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] commented 11 months ago

This issue was closed because it has been stalled for 5 days with no activity.