coreybutler / node-windows

Windows support for Node.JS scripts (daemons, eventlog, UAC, etc).
Other
2.81k stars 356 forks source link

Windows Update removing service #231

Open alexeightsix opened 5 years ago

alexeightsix commented 5 years ago

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?

coreybutler commented 4 years ago

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).

jszczypk commented 4 years ago

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 commented 4 years ago

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

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

daviditsygin commented 3 years ago

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.

coreybutler commented 3 years ago

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.

daviditsygin commented 3 years ago

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.

coreybutler commented 3 years ago

@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.

alexeightsix commented 3 years ago

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.

echoleyo commented 2 years ago

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