<html><head></head><body><div style="font-family: Verdana;font-size: 12.0px;"><div>Hi!</div>

<div> </div>

<div>It happens time to time on our x2go server, that the CPU usage goes almost 100% on a single CPU. The high usage is caused by the sshd process which runs the <username>@notty, in PS it looks like this:</div>

<div><span style="font-family: courier new,courier,monospace;">root     32768 25441  7 Apr28 ?        03:14:44 sshd: myuser<a href="mailto:orm@notty">@notty</a></span></div>

<div> </div>

<div>An strace of the process shows that the number of open files reached the predefined limit:</div>

<div><span style="font-family: courier new,courier,monospace;">...<br/>
accept(7, 0x7fff6d2bccb0, [128])        = -1 EMFILE (Too many open files)<br/>
socket(PF_FILE, SOCK_DGRAM|SOCK_CLOEXEC, 0) = -1 EMFILE (Too many open files)<br/>
select(4096, [3 5 7 8 9], [], NULL, NULL) = 1 (in [7])<br/>
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0<br/>
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0<br/>
...</span><br/>
 </div>

<div>Increasing the limit "nofile" solves the high CPU problem only temporarily, as the number of open files increases with the time monotonously (at a rate of ~1/20 sec).</div>

<div>Checking the files opened by the given process shows, the following</div>

<div><span style="font-family: courier new,courier,monospace;">...</span></div>

<div><span style="font-family: courier new,courier,monospace;">sshd    32768 root 8499u  IPv4 1542181459      0t0        TCP loopback:30028->loopback:51585 (CLOSE_WAIT)<br/>
...</span></div>

<div>The number of such CLOSE_WAIT entries is several thousands.</div>

<div>Netstat shows a similar view:</div>

<div><span style="font-family: courier new,courier,monospace;">...</span></div>

<div><span style="font-family: courier new,courier,monospace;">tcp        0      0 127.0.0.1:30028             127.0.0.1:38163             CLOSE_WAIT  32768/sshd</span></div>

<div><span style="font-family: courier new,courier,monospace;">...</span></div>

<div> </div>

<div>After increasing the limit of open files I logged the strace of the process during a period when the number of CLOSE_WAIT connections increases (see attached file).</div>

<div>The user is doing nothing, he is just logged in with x2go, but doesn't run any active processes, he doesn't even use the server.</div>

<div>Has anyone experienced the same problem or has any explanation for this behaviour?</div>

<div> </div>

<div>Regards</div>

<div>Swizzly</div>

<div><br/>
 </div>

<div> </div>

<div> </div>

<div> </div>

<div> </div></div></body></html>