Skip to content
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

Crashes Homebridge: RangeError: Maximum call stack size exceeded #1240

Closed
DiggyS opened this issue Dec 26, 2021 · 21 comments
Closed

Crashes Homebridge: RangeError: Maximum call stack size exceeded #1240

DiggyS opened this issue Dec 26, 2021 · 21 comments

Comments

@DiggyS
Copy link

DiggyS commented Dec 26, 2021

Describe The Problem:
When I install this plugin, it crashes Homebridge, both with or without config details.

To Reproduce:
Yes, everytime, ongoing.

Logs:
RangeError: Maximum call stack size exceeded
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
at Function.Array.from (/homebridge/node_modules/homebridge-camera-ffmpeg/node_modules/collections/shim-array.js:31:22)
[12/26/2021, 10:46:49 PM] Got SIGTERM, shutting down Homebridge...

Show the Homebridge logs here.
Remove any sensitive information.

Homebridge Config:

{
"mdns": {
"interface": "192.168.3.20"
},
"bridge": {
"name": "",
"username": "
",
"port": 51600,
"pin": "****",
"bind": [
"bond0"
]
},
"accessories": [],
"platforms": [
{
"name": "Config",
"port": 8581,
"platform": "config"
},
{
"controllers": [
{
"address": "192.168.3.1",
"password": "*****",
"username": "homebridge"
}
],
"verboseFfmpeg": false,
"platform": "UniFi Protect"
},
{
"platform": "CoolMasterTelnet",
"ip": "192.168.3.52",
"accessories": [
{
"displayName": "Samir's Bedroom",
"uniqueId": "001"
},
{
"displayName": "Sahir's Bedroom",
"uniqueId": "002"
},
{
"displayName": "Master Bedroom",
"uniqueId": "003"
}
]
}
],
"disabledPlugins": []
}

Screenshots:

Environment:

  • Node.js Version:
  • NPM Version:
  • Homebridge Version:
  • Homebridge Camera FFmpeg Version:
  • Homebridge Config UI X Plugin Version:
  • Operating System:
@Sunoo
Copy link
Collaborator

Sunoo commented Dec 26, 2021

I don’t see any config for this plugin in what you shared, so it shouldn’t even be getting loaded… I’ve never seen this issue before, but it really doesn’t make a lot of sense to me.

Could you be using a super old version of NodeJS or something?

@DiggyS
Copy link
Author

DiggyS commented Dec 26, 2021

If I just install the plug in, it crashes Homebirdge, and puts it in a Reboot Loop.
With or without a config programmed in, even disabling it, causes it to crash Homebridge.
Once i uninstall the plug in, all is fine again.

Its a brand new install of Homebridge, only 4-5 days old from scratch.

@DiggyS
Copy link
Author

DiggyS commented Dec 26, 2021

Can you send me a copy of a working NodeJS, and I will try and manually replace the file, is that worth a try?

@dgreif
Copy link

dgreif commented Dec 27, 2021

Looks like the root cause is montagejs/collections#241. I'm having trouble tracking down exactly where the collections dependency gets pulled in, but we could probably fix this by pinning to version 5.0.0 based on info in that issue.

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 27, 2021

@dgreif Interesting that that issue is a year and a half old and it’s only just bitten us? One of the comments over there mentions it is a dependency of mqtt, which I do use. If you got bit by it too, it’s probably also somewhere else though.

I guess I’ll freshly install my plugin on something to see if I can reproduce.

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 27, 2021

Looks like collections was a new addition to mqtt in October, already at 5.1.12. mqttjs/MQTT.js@c92b877

collections 5.1.12 is also used in number-allocator from the very beginning of that package, which is also used by mqtt since June. mqttjs/MQTT.js@0eb3396

Now I’m really confused as to how this is the first report of this problem if it’s possibly been happening for this long?

Also, in case anyone happens to ever need it in the future. The best way I’ve found for figuring out the tree of dependencies is https://npm.anvaka.com/

@DiggyS
Copy link
Author

DiggyS commented Dec 27, 2021

Is there a fix, I can try?

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 27, 2021

Not yet.

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 28, 2021

I have spent a chunk of the day testing, and I have not been able to recreate this issue…

@dgreif
Copy link

dgreif commented Dec 28, 2021

Thanks for digging into it @Sunoo. I don't think the ring plugin is actually being affected directly, it just happened to show the stack overflow in the Ring logs, but the path pointed to homebridge camera ffmpeg as the source of the collections dependency

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 28, 2021

Gotcha. I didn’t see it anywhere in Ring’s dependency tree, so it probably is just a user with both plugins installed and this one is barfing all over Homebridge.

Outside of possible rolling back to mqtt 4.2.6 or older, I’m not sure what else I could do. Especially since I can’t figure out what causes the issue…

@DiggyS What are you running Homebridge on? Maybe it’s something more unique to your setup?

@NebzHB
Copy link
Contributor

NebzHB commented Dec 28, 2021

"Outside of possible rolling back to mqtt 4.2.6 or older"
Not sure, as homebridge-alexa is using mqtt >=2.18.8 (see my mention)

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 28, 2021

@NebzHB “mqtt >= 2.18.8” will currently evaluate to mqtt 4.3.1.

@DiggyS
Copy link
Author

DiggyS commented Dec 28, 2021

@DiggyS What are you running Homebridge on? Maybe it’s something more unique to your setup?

Running on Synology NAS Version 7.x

@NebzHB
Copy link
Contributor

NebzHB commented Dec 28, 2021

shouldn't we create an issue at mqtt.js ?

@NebzHB
Copy link
Contributor

NebzHB commented Dec 28, 2021

I have spent a chunk of the day testing, and I have not been able to recreate this issue…

I had to install a new system to recreate the issue.

@NorthernMan54
Copy link
Contributor

Looking thru the commit log on mqtt, collections was added as a dependency here https://github.com/mqttjs/MQTT.js/pull/1301/files

As I can recreate the issue, I’m going to try pinning the mqtt version to the one prior

@NebzHB
Copy link
Contributor

NebzHB commented Dec 28, 2021

according to mqtt changlog 4.2.8 does work too : https://github.com/mqttjs/MQTT.js/blob/master/CHANGELOG.md
don't have commit #1301 yet, so homebridge-camera-ffmpeg should not be impacted (or i'm misinterpreting ^4.2.8 ;) )

edit: indeed i think i'm misinterpreting ... 4.3.1 installed, but strangely my system doesn't crash anymore since homebridge-alexa's workaround

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 28, 2021

@DiggyS Can you try v3.1.4 of this plugin when you have a chance?

@DiggyS
Copy link
Author

DiggyS commented Dec 28, 2021

@DiggyS Can you try v3.1.4 of this plugin when you have a chance?

Works Perfectly ! No error messages !
Awesome.

Thank you!

@Sunoo
Copy link
Collaborator

Sunoo commented Dec 28, 2021

Fantastic. Glad we got that resolved.

Thanks for the assist on this, @dgreif, @NorthernMan54, and @NebzHB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants