node-windows icon indicating copy to clipboard operation
node-windows copied to clipboard

Windows Update removing service

Open alexeightsix opened this issue 6 years ago • 9 comments

Whenever there's a automated Windows Update (Windows 10) the service that was installed will no longer be installed. Is there a way to prevent this from happening?

alexeightsix avatar Feb 05 '19 15:02 alexeightsix

I've never heard of WUS uninstalling user-installed processes, nor do I see how it would touch node-windows at all. I'd need to see more evidence that node-windows is actually related to this (i.e. I'm not even sure if this is something that can be handled or where to start troubleshooting).

coreybutler avatar Feb 24 '20 17:02 coreybutler

I can confirm the problem with disappearing services. Most services are not installed on machines that I control, but I have also linked it to Windows Update. I have one machine that had that problem last weekend and I have access to logs - I will try to search through the logs for some clues.

jszczypk avatar Feb 25 '20 14:02 jszczypk

On the second thought it might be more of https://github.com/kohsuke/winsw/ business.

https://github.com/kohsuke/winsw/issues/272

jszczypk avatar Feb 25 '20 14:02 jszczypk

I'm encountering this issue now. I have a machine which was running an installed service consistently through reboots but this morning after it automatically installed 20H2, the service is missing in the Services list.

Running the install function again emits the "alreadyinstalled" event so I'm unable to reinstall or restart the service.

Installing the same service under a different name works for the time being.

daviditsygin avatar Jul 15 '21 20:07 daviditsygin

If an attempt to reinstall triggers the alreadyinstalled event, it means the service exists. I'm not sure why Windows wouldn't display this in the list of services, but it may be as simple as running the start() method.

coreybutler avatar Jul 15 '21 21:07 coreybutler

I didn't have a chance to try that before uninstalling/re-installing the service, but the service also did not start at boot-up after a few attempts which is what prompted me to check the list.

daviditsygin avatar Jul 15 '21 21:07 daviditsygin

@daviditsygin I'd double check any logging to assure the Windows update didn't cause the app to break. If node-windows detects too many restarts (i.e. launches, fails immediately), then it will gradually back off and eventually stop attempting to restart the service. So, if there was an error in the app caused by the update, it could look like it's not starting, even if it is starting/stopping/backing off rapidly. It's a rare circumstance, but I can't think of anything else that would cause this behavior.

coreybutler avatar Jul 15 '21 21:07 coreybutler

We had to disable windows updates completely on all our workstations for the time being as it would uninstall the service that would launch our node app at boot. Unfortunately I don't have any logs but it was definitely due to updates.

alexeightsix avatar Jul 15 '21 22:07 alexeightsix

I'm encountering this issue now. I have a machine which was running an installed service consistently through reboots but this morning after it automatically installed 20H2, the service is missing in the Services list.

Running the install function again emits the "alreadyinstalled" event so I'm unable to reinstall or restart the service.

Installing the same service under a different name works for the time being.

I had the same issue recently after Windows Upgrade to 20H2, all services still there, but were unable to restart.

Cannot start service from the command line or debugger. A winwows Service must first be 
installed(using installutil.exe) and then started with the ServerExplorer, Windows Services 
Administrative tool or the NET START command.

myService.err from daemon

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module '@author.io/args'
Require stack:
- C:\Users\echoleyo\AppData\Roaming\npm\node_modules\node-windows\lib\wrapper.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (C:\Users\echoleyo\AppData\Roaming\npm\node_modules\node-windows\lib\wrapper.js:3:12)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\echoleyo\\AppData\\Roaming\\npm\\node_modules\\node-windows\\lib\\wrapper.js'
  ]
}

details are in this thread https://github.com/coreybutler/node-windows/issues/314#issuecomment-1125438703

echoleyo avatar May 12 '22 21:05 echoleyo