[BUG] Companion 4 Betas crash when replacing files in dev folder
Is this a bug in companion itself or a module?
- [x] I believe this to be a bug in companion
Is there an existing issue for this?
- [x] I have searched the existing issues
Describe the bug
When working on and deleting / replacing files in sub folders of the specified companion-module-dev path, Companion, including the electron loader often crashes and needs to be manually restarted. I have seen nothing in the normal companion logs after a restart. I have never observed this behaviour with builds in the 3.x.x series
Steps To Reproduce
- Delete and replace some files in a sub folder of the
companion-modules-devpath. - Sometimes, inconsistently, companion will exit with no error message. Including the electron loader.
- This occurs even if there are no active modules using the module code.
- There are inactive modules using this code.
Expected Behavior
No crash.
Environment (please complete the following information)
- OS: Windows 11
- Browser: Chrome
- Companion Version: `4.0.0+7926` but observed across many builds in the 4.0 Beta cycle
Additional context
I often set the companion-module-dev path to the companion module project folder and have it load the contents of the pkg folder. Mostly a convenience thing as I typically have 30-40 modules on my machine and I don't want to encumber Companion with loading dev versions of all of these when I am only working on one at a time.
I have no ideas on why this would be happening, and don't know where to begin on trying to reproduce this.
It looks like some error handlers were missing on the file watchers, maybe that was getting confused with rapid changes and caused this? Could you check to see if this is any better now? Its a long shot, but trying to find potential flaws in the code is the best I can do for now
I hadn't seen this happen for a while so thought we might be sorted, but I put aside some time to try and test for it and it has crashed first time.
Running 4.1.0+8116
With an instance of the telestream-prism module in the connections list but disabled, selected to use the dev version. Rebuilt the module with yarn package --dev and I get a full Houston, we have a problem! crash, including loss of the Electron loader. In all 3.x.y versions I have worked with this same process, on the same machine worked reliably. There were two other disabled connections using non dev versions of this module FWIW.
The last few entries from the logs are:
2025-06-19T04:41:08.685Z info Instance/ModuleHost Starting connection: "Prism_3" (91-wZ4vzZNOSNg0sM7gpW)
2025-06-19T04:41:08.890Z info Instance/ModuleHost Connection "Prism_3" started process 32184
2025-06-19T04:44:07.736Z info Instance/Controller Disable instance Prism_3
2025-06-19T04:44:31.217Z info Instance/Modules Attempting to reload module in: D:\companion-modules-dev\companion-module-telestream-prism\package.json
2025-06-19T04:44:31.217Z info Instance/Modules Failed to find module in: D:\companion-modules-dev\companion-module-telestream-prism\package.json
2025-06-19T04:44:48.445Z info Instance/Modules Attempting to reload module in: D:\companion-modules-dev\companion-module-telestream-prism\pkg
2025-06-19T04:44:48.446Z info Instance/Modules Failed to find module in: D:\companion-modules-dev\companion-module-telestream-prism\pkg
2025-06-19T04:44:48.447Z info Instance/Controller Reloading 0 connections:
Screen shot of the Electron loader locking up (version 4.0.0). At least in this instance the loader didnt fully exit, but was completely non response for a number of minutes, I couldnt even move the window or alt-tab to it in that time. In this case companion continued to run, but this hasnt always been the case).