Vserver administration: Difference between revisions
Jump to navigation
Jump to search
Content deleted Content added
| Line 1: | Line 1: | ||
==Errors== |
|||
In some situations my CPU was burning like hell for days. |
|||
<br>This was the vcontext/login process when using the command "vserver XX enter". |
|||
<br>If it happens that the process is disconnected from its terminal it eats all the CPU :-( |
|||
<br>I could reproduce the problem as follow: |
|||
* ssh to the server as normal user |
|||
* sudo su - |
|||
* vserver XX enter |
|||
* from another term, kill -9 one of the 2 su processes ("su -" or "-su") |
|||
* quit the current terminal |
|||
Now from another terminal you can see that |
|||
vps ax|grep " login" |
|||
shows a "login" process not attached to any tty (cf the "?") and using top you see it's running 100% cpu. |
|||
Actually nature of this process is a bit strange because the real process is called vcontext as seen by top, pgrep and as you can see in /proc/XXX/status but its command line was overwritten with "login\0\0\0\0\0\0\0\0\0\0\0..." and commands like vps or pgrep -f show you this name "login" as you can see in /proc/XXX/cmdline. |
|||
So I wrote a script and installed it in a cron to kill any such dandling process: |
|||
<pre> |
|||
pids=$(/usr/sbin/vps axc|\ |
|||
egrep ' ? +[RS] +[1-9][0-9]*:[0-9]+ +vcontext'|\ |
|||
sed 's/^ *\([0-9]\+\) .*$/\1/') |
|||
[ "$pids" != "" ] && \ |
|||
echo "Killing dandling login" && \ |
|||
kill $pids |
|||
</pre> |
|||
And /etc/cron.d/watch-vcontext: |
|||
<pre> |
|||
MAILTO=root |
|||
*/5 * * * * root /home/vservers/tools/kill-vcontext |
|||
</pre> |
|||
This also shows something weird: processes in vservers don't appear with ps ax, ok, they appear with vps ax. |
|||
<br>Now if I want to kill one of them from the host: |
|||
vkill 29825 |
|||
vkill: vc_ctx_kill(): No such process |
|||
chcontext --ctx 1 kill 29825 |
|||
<no error but nothing happen neither> |
|||
kill 29825 |
|||
<works!!> |
|||
===GrSec=== |
===GrSec=== |
||
* http://people.linux-vserver.org/~harry/_README_ |
* http://people.linux-vserver.org/~harry/_README_ |
||