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

Facing intermittent issues in windows container during startup #88

Open
vipul0506 opened this issue Sep 4, 2023 · 1 comment
Open

Comments

@vipul0506
Copy link

vipul0506 commented Sep 4, 2023

I'm currently running IIS app inside a windows container.
These are the three last lines of my startup script:
Invoke-Expression -Command "net start w3svc"; Invoke-Expression -Command "iisreset"; Invoke-Expression -Command "C:\\ServiceMonitor.exe w3svc"
And here are the log trail from startup script:

Attempting stop...

Restart attempt failed.

The system cannot find the file specified. (2147942402, 80070002)

ERROR: Failed to stop or query status of service 'w3svc' error [800705b4]

I've reviewed the log trail for the startup script and It seems to be failed during on iisreset not sure if ServiceMonitor is contributing anything here.
I can see this error was reported in the past - #49

Could you please confirm if this error has been fixed in the latest version of IIS.ServiceMonitor or provide guidance on how we can resolve this issue? Thank you for your assistance.

@pankajads
Copy link

Service Monitor stop and start the W3SVC. (here is the line of code that stop the W3SVC service https://github.com/microsoft/IIS.ServiceMonitor/blob/main/src/ServiceMonitor/Main.cpp#L47)

Also, it has timeout setting defined to start and stop service. Its W3SVC in your case and timeout setting set to 20 sec (hardcoded value).
https://github.com/microsoft/IIS.ServiceMonitor/blob/main/src/ServiceMonitor/ServiceMonitor.h#L26-L28

There could be a instance where service mayn't complete stop or start in 20 sec and hence you will get the same error. You could increase timeout setting maxiumum to 30 sec, otherwise it gets timed out at OS level.

If you have very slow system, where service restart may take between 30-40 sec. I would recommend you to increase the OS setting (registry one to increase service start/stop timeout) along with service monitor timeout.

How to increase OS level service timeout?

  1. Click Start, click Run, type regedit, and then click OK.
  2. Locate and then click the following registry subkey:
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control
  1. In the right pane, locate the ServicesPipeTimeout entry.

Note: If the ServicesPipeTimeout entry does not exist, you must create it. To do this, follow these steps:

  • On the Edit menu, point to New, and then click DWORD Value.
  • Type ServicesPipeTimeout, and then press ENTER.
  1. Right-click ServicesPipeTimeout, and then click Modify.
  2. Click Decimal, type 60000, and then click OK.
  • This value represents the time in milliseconds before a service times out.
  1. Restart the computer.

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

2 participants