cPanel – Webmail (cpanelro) Highload
From cPanel Forum:
CPU Process has a high load, with many cpanelro user taking the cpu time. Below is script to kill cpanelro’s process
#!/bin/sh
for ROUND in `ps aux | grep roundcube | awk -F " " '{print $10}' | awk -F ":" '{print $1}'`;
do
if [ $ROUND -ge 20 ]; then
pkill -u cpanelroundcube
echo "kill roundcube process roundcube";
fi
done
Put in crontab and run it every 15 or 30minutes. Or you can edit RoundCube file to fix a never ending loop caused when trying to log in with an invalid account
edit file /usr/local/cpanel/base/3rdparty/roundcube/program/lib/imap.inc
and introduced a counter in function iil_C_Login (line 416).
Bellow are the modifications i made in order to stop the loop from taking over the server.
function iil_C_Login(&$conn, $user, $password) {
iil_PutLine($conn->fp, 'a001 LOGIN "'.iil_Escape($user).'" "'.iil_Escape($password).'"');
$counter = 0;
do {
$line = iil_ReadReply($conn->fp);
if ($line === false) {
break;
}else if($counter > 0){
break;
}
$counter = $counter + 1;
} while (!iil_StartsWith($line, 'a001 ', true));
// process result
$result = iil_ParseResult($line);
if ($result == 0) {
$conn->error .= '';
$conn->errorNum = 0;
return $conn->fp;
}
fclose($conn->fp);
$conn->error .= 'Authentication for ' . $user . ' failed (LOGIN): "';
$conn->error .= htmlspecialchars($line)."\"";
$conn->errorNum = $result;
return $result;
}
With these modifications an error is returned to the user after a short while letting him know there was a problem connecting to the IMAP server. If you want to return a “Login failed” you have to modify the function iil_ParseResult (line 288) like so:
function iil_ParseResult($string) {
$a = explode(' ', $string);
if (count($a) > 2) {
if (strcasecmp($a[1], 'OK') == 0) {
return 0;
} else if (strcasecmp($a[1], 'NO') == 0) {
return -1;
} else if (strcasecmp($a[1], 'BAD') == 0) {
return -2;
} else if (strcasecmp($a[1], 'BYE') == 0) {
return -3;
}
}else if(!$string){
return -1;
}
return -4;
}

Related posts:
- PHP with SuPHP on cPanel When you activated SuPHP on cPanel servers, this is the...
- Disk Space Usage on cPanel shows incorrect size After you delete some big files on your cpanel hosting...