In fact, it seems that the problem come from only one site.
Indeed, when I do
strace -p xxx
of the pid(s) that are using a lot of CPU I always have the same contents
In fact when I do a strace -p xxx of the pid that use a high usage of cpu I always have the same contents :
getcwd(“/home/phpbbnet/php-bb.net/html/fr”, 4096) = 34 lstat64(“/home”, {st_mode=S_IFDIR|0711, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet”, {st_mode=S_IFDIR|S_ISGID|0751, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net”, {st_mode=S_IFDIR|S_ISGID|0711, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net/html”, {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net/html/fr”, {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, …}) = 0 getcwd(“/home/phpbbnet/php-bb.net/html/fr”, 4096) = 34 lstat64(“/home”, {st_mode=S_IFDIR|0711, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet”, {st_mode=S_IFDIR|S_ISGID|0751, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net”, {st_mode=S_IFDIR|S_ISGID|0711, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net/html”, {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net/html/fr”, {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net/html/fr/includes”, {st_mode=S_IFDIR|S_ISGID|0755, st_size=4096, …}) = 0 lstat64(“/home/phpbbnet/php-bb.net/html/fr/includes/functions_mods_settings.php”, {st_mode=S_IFREG|0644, st_size=5015, …}) = 0 open(“/home/phpbbnet/php-bb.net/html/fr/includes/functions_mods_settings.php”, O_RDONLY) = 32 fstat64(32, {st_mode=S_IFREG|0644, st_size=5015, …}) = 0 fstat64(32, {st_mode=S_IFREG|0644, st_size=5015, …}) = 0
lseek(32, 0, SEEK_CUR) = 0
lseek(32, 0, SEEK_SET) = 0
close(32) = 0
Etc…
Always a read of /home/phpbbnet/php-bb.net/html/fr/includes/functions_mods_settings.php
I’ve checked this and it is readable by all, so I do not understand
Maybe you have an idea.
Also, this client told me than since few days his webiste doesn’t work anymore (a blank page without any error, I’ve checked)
All the pid that are using a huge CPU usage has this contents, so apparently the pbm come from this website and in particular this functions_mods_settings.php
There is nothing special in this php file :
<?php
/***************************************************************************
* functions_mods_settings.php
* ---------------------------
* begin : 10/08/2003
* copyright : Ptirhiik
* email : admin@rpgnet-fr.com
* version : 1.0.4 - 26/09/2003
*
***************************************************************************/
/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/
// some standard lists
$list_yes_no = array('Yes' => 1, 'No' => 0);
define('BOARD_ADMIN', 98);
//---------------------------------------------------------------
//
// mods_settings_get_lang() : translation keys
//
//---------------------------------------------------------------
function mods_settings_get_lang($key)
{
global $lang;
return ( (!empty($key) && isset($lang[$key])) ? $lang[$key] : $key );
}
//---------------------------------------------------------------
//
// init_board_config_key() : add a key and its value to the board config table
//
//---------------------------------------------------------------
function init_board_config_key($key, $value, $force=false)
{
global $db, $board_config;
if (!isset($board_config[$key]))
{
$board_config[$key] = $value;
$sql = "INSERT INTO " . CONFIG_TABLE . " (config_name,config_value) VALUES('$key','$value')";
if ( !$db->sql_query($sql) ) message_die(GENERAL_ERROR, 'Could not add key ' . $key . ' in config table', '', __LINE__, __FILE__, $sql);
}
else if ($force)
{
$board_config[$key] = $value;
$sql = "UPDATE " . CONFIG_TABLE . " SET config_value='$value' WHERE config_name='$key'";
if ( !$db->sql_query($sql) ) message_die(GENERAL_ERROR, 'Could not add key ' . $key . ' in config table', '', __LINE__, __FILE__, $sql);
}
}
//---------------------------------------------------------------
//
// user_board_config_key() : get the user choice if defined
//
//---------------------------------------------------------------
function user_board_config_key($key, $user_field='', $over_field='')
{
global $board_config, $userdata;
// get the user fields name if not given
if (empty($user_field))
{
$user_field = 'user_' . $key;
}
// get the overwrite allowed switch name if not given
if (empty($over_field))
{
$over_field = $key . '_over';
}
// does the key exists ?
if (!isset($board_config[$key])) return;
// does the user field exists ?
if (!isset($userdata[$user_field])) return;
// does the overwrite switch exists ?
if (!isset($board_config[$over_field]))
{
$board_config[$over_field] = 0; // no overwrite
}
// overwrite with the user data only if not overwrite sat, not anonymous, and logged in
if (!intval($board_config[$over_field]) && ($userdata['user_id'] != ANONYMOUS) && $userdata['session_logged_in'])
{
$board_config[$key] = $userdata[$user_field];
}
else
{
$userdata[$user_field] = $board_config[$key];
}
}
//---------------------------------------------------------------
//
// init_board_config() : get the user choice if defined
//
//---------------------------------------------------------------
function init_board_config($mod_name, $config_fields, $sub_name='', $sub_sort=0, $mod_sort=0, $menu_name='Preferences', $menu_sort=0)
{
global $mods;
@reset($config_fields);
while ( list($config_key, $config_data) = each($config_fields) )
{
if (!isset($config_data['user_only']) || !$config_data['user_only'])
{
// create the key value
init_board_config_key($config_key, ( !empty($config_data['values']) ? $config_data['values'][ $config_data['default'] ] : $config_data['default']) );
if (!empty($config_data['user']))
{
// create the "overwrite user choice" value
init_board_config_key($config_key . '_over', 0);
// get user choice value
user_board_config_key($config_key, $config_data['user']);
}
}
// deliever it for input only if not hidden
if (!$config_data['hide'])
{
$mods[$menu_name]['data'][$mod_name]['data'][$sub_name]['data'][$config_key] = $config_data;
// sort values : overwrite only if not yet provided
if (empty($mods[$menu_name]['sort']) || ($mods[$menu_name]['sort'] == 0) )
{
$mods[$menu_name]['sort'] = $menu_sort;
}
if (empty($mods[$menu_name]['data'][$mod_name]['sort']) || ($mods[$menu_name]['data'][$mod_name]['sort'] == 0) )
{
$mods[$menu_name]['data'][$mod_name]['sort'] = $mod_sort;
}
if (empty($mods[$menu_name]['data'][$mod_name]['data'][$sub_name]['sort']) || ($mods[$menu_name]['data'][$mod_name]['data'][$sub_name]['sort'] == 0) )
{
$mods[$menu_name]['data'][$mod_name]['data'][$sub_name]['sort'] = $sub_sort;
}
}
}
}
If you have any ideas, they are welcome
Pascal