microsoft / IIS.ServiceMonitor

An entrypoint process for running IIS in Windows containers
MIT License
126 stars 42 forks source link

Many environment variables lead to `APPCMD failed with error code 259` error #76

Open Ne4to opened 3 years ago

Ne4to commented 3 years ago

Running a container with many environment variables leads to following error:

Service 'w3svc' has been stopped APPCMD failed with error code 259 Failed to update IIS configuration

Service monitor builds a command for appcmd.exe limited to 30000 symbols. When there are many variables appcmd.exe is executed several times. First run on my environment finishes in about 0.3 second. Each subsequent run takes increased time and eventually exceeds 5 seconds limit (GetExitCodeProcess returns STILL_ACTIVE 259).

Workaround: Set enableServiceLinks: false in pod’s spec.

EnableServiceLinks indicates whether information about services should be injected into pod's environment variables, matching the syntax of Docker links. Optional: Defaults to true.

It will remove set of variables like:

Saibamen commented 3 years ago

This same for me in Docker for Windows. I added only one additional ENV

Saibamen commented 3 years ago

CC @sujitnayak @jhkimnew

ppozeti commented 3 years ago

Having same issue... When I run the docker container in my machine it works fine, but when I try to use it in Azure Container Instance I get the 259 code. Not always though. In my case, I have 15 additional environment variables. In total, the container have 55 env vars.

RexMorgan commented 3 years ago

I've attempted to work around this issue with #79.

Any chance that could potentially get merged as a workaround until a proper solution can be found?

I'm passing 7 environment variables to my container and my container fails to start ~50% of the time in AWS, but works fine locally.