0

I have web application on my IIS and weird things happen. After few days there is 4,5,6 or 7 w3wp.exe process started, and only one is working and the others are just sitting there and allocating 1GB+ memory each.

I'm unable to terminate this hanging processes:

C:\Users\administrator>taskkill /F /PID 5072 /T
ERROR: The process with PID 5072 (child process of PID 2988) could not be terminated.
Reason: Access is denied.

(pid: 2988 is svchost.exe)

It looks like IIS is unable to kill w3wp.exe process and just leaves it there. Only difference is that this web application is on Z:\ disk which is mounted NFS volume. Since this application is just communicating with SQL and save files to disk I presume some weird lock happens on NFS and process is left in some limbo state, other web apps that are on internal SSD RAID doing same thing are just fine.

Is there any way to terminate/kill such processes or find out what is causing this?

ADDED: enter image description here

manuel
  • 1,840
  • 1
  • 16
  • 16
  • You need to run `taskkill` in an elevated command prompt. IIS leaves such processes there when they are orphaned https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/failure – Lex Li Sep 01 '20 at 17:15
  • same thing (cmd run as admininstrator): taskkill /pid 4648 /f ERROR: The process with PID 4648 could not be terminated. Reason: There is no running instance of the task. – manuel Sep 02 '20 at 10:50
  • If you hit "There is no running instance of the task", then there is a bigger problem. You might find hints from https://stackoverflow.com/questions/12528963/taskkill-f-doesnt-kill-a-process that such is never an easy thing to troubleshoot. – Lex Li Sep 02 '20 at 14:26
  • @LexLi I tried with powershell still process is there. Since this is production env outgoing traffic is blocked and I do not have enough knowledge do run kernel debugger end finding root cause, I think Mark Russonovich say it all, there is kernel level "problem" – manuel Sep 04 '20 at 07:00

2 Answers2

1

You could use below command to kill the worker process:

taskkill /im processname.exe /f

taskkill /pid 1234 /f

Note: run command prompt as administrator.

The "/f" is for "force".

also try to set the iis recycling application pool setting An application pool recycle is when all of the worker processes (w3wp.exe) for an application pool are unloaded and new instances are started to serve incoming requests.

https://learn.microsoft.com/en-us/iis/configuration/system.applicationhost/applicationpools/add/recycling/

another option is set iis application pool cpu usage setting:

enter image description here

Application pool worker processes that exceed their CPU limit will be forced to shut down.

https://learn.microsoft.com/en-us/iis/configuration/system.applicationHost/applicationPools/add/cpu

if you want to know the cause of the high memory usage then you could try to generate a memory dump file and debug&analyze the issue based on the dump.

https://learn.microsoft.com/en-us/sysinternals/downloads/procdump

https://www.microsoft.com/en-sg/download/details.aspx?id=49924

https://learn.microsoft.com/en-us/iis/troubleshoot/performance-issues/troubleshooting-high-cpu-in-an-iis-7x-application-pool

Jalpa Panchal
  • 8,251
  • 1
  • 11
  • 26
0

this normally means something locked in your IIS processes, such as network (TCP connection), or failed to read physical file; it's hard to solve in your production environment, I suggest you can dump memory and look into the real cause; (Task Manager->Details->Right click on process->Create dump file).

Sean
  • 1,806
  • 1
  • 13
  • 15