This question already has answers here:
Taskkill /f doesn't kill a process
(31 answers)
Closed 2 years ago.
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:
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:
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
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).
Related
I have deployed Centos 7 with Gnome for a use case that requires multiple users to log into the desktop environment.
I have XRDP setup to time-out after 3 days if there is no activity and end the session. This mostly works but often I have lingering sessions when I run loginctl. A quick ps and the only processes left behind that I can tie back to the sessions (based on dates) are ibus-daemon processes. This is making it hard to track the number of active sessions or enforce limits with ghost processes hanging around.
Nov03 ? 00:00:00 ibus-daemon --xim --panel disable
I have read there is a way to add an argument to the daemon to enable a timeout but I have been unable to figure out what is spinning up the ibus-daemon (parent process is 1) or where the startup string is. There is not a systemd or init file so some other process is calling these.
Any suggestions where I can track down the startup config or mitigate this would be appreciated!
I have a long running apache webserver with lots of requests after sometime I find the apache server stopped with
Killed line at the end
what can I do to solve this problem or prevent the system from killing the apache instance ??
Linux usually kills processes when resources like memory are getting low. You might want to have a look at the memory consumption of your apache process over time.
You might find some more details here:
https://unix.stackexchange.com/questions/136291/will-linux-start-killing-my-processes-without-asking-me-if-memory-gets-short
Also you can monitor your processes using the MMonit software, have a look here: https://serverfault.com/questions/402834/kill-processes-if-high-load-average
The is a utility top which shows the process consumption (e.g. Mem, CPU, User etc), you can use it to keep an eye on apache process.
Problem:
I am running 3 java processes on a server with 32GB RAM. I frequently face closed ssh sessions owing to network issues. So, I ran the command using
nohup bash script.sh >log-file 2>&1 &.
Now I am running the process using nohup and additionally I am putting them in background. Still, after 2-3 hours of processing, my java process stops writing to a log-file. I checked /proc/pid/status. It shows that the process is sleeping but actually this should not happen in my case. When I am using top, it does not show my process in the list of top processes.
My question is how can I know the reason behind the waiting process ??
When I check the freemem using top, it shows that out of 32GB space, 30 GB is being used and only 2 GB is free. This means that my process is alive and occupying space but not running.
BTW, my server mounts my home and data using a nfs server and we use kerberos for authentication. So, can this be a problem ?? I am using a krenew command for the expiring kerberos ticket.
Perhaps you should setup the 3 java procs to run as daemons, versus using no hangup.
can someone explain for me this sentence from msdn ?
Idle time-out can be helpful in the following situations:
The server has a heavy processing load.
is the idle timeout for the w3wp.exe process or each user that's connected to the website has a nested process inside the w3wp and this is the idle time for this nested process? if it's the idle process for w3wp as a whole , then what does msdn sentence mean??
It prevents a application pool worker process from hanging around when no users are hitting the web pages hosted by the worker process. When the users stop hitting the web site for a while, IIS stops the process.
This can be annoying if you have an expensive setup/teardown process for the application, such as populating a cache.
The idle timeout is per application pool. You can observe the running pools as well as in IIS in VS by Tools > Attach to Process then I click the Process column header to bring any running w3wp.exe's to the top.
You can set the timeout for each app pool in IIS7+ in Advanced Settings... Process Model section.
I ran into an issue with an IIS web app shutting down an idle worker process! The next request would then have to re-initialize the application, leading to delays.
I disabled the IIS shutdown of idle worker processes on the application pool to resolve this. Are there any issues associated with turning this off? If the process is leaking memory, I imagine it is nice to recycle the process every now and then.
Are there any other benefits to having this process shutdown?
I'm assuming that you're referring to IIS 6.
Instead of disabling shutdown altogether, maybe you can just increase the amount of time it waits before killing the process. The server is essentially conserving resources - if your server can stand the resource allocation for a process that mostly sits around doing nothing, then there isn't any harm in letting it be.
As you mentioned, setting the auto-recycling of the process on a memory limit would be a good idea, if the possibility of a memory leak is there.