My Environment:
Moodle 1.7.1+ Apache with MySQL with PHP 5.1.6.
my chat deamon stops working after a few hours, and we found an error. we losted ddbb conection:
this the lines we added:
while(true) {
$active = array();
//----------------------------------
//@MODIFICATION: fer que els deamon sobrevisqui a les caigudes de MySQL
//-------- ADDED:
$mypingnow->value = time();
if (!update_record('config',$mypingnow)) {
//if (!get_record ('config','name','chatd_ping')) {
$postlog[] = 'Error de connexio';
$intents = 0;
$maxintents = 600;
$dbconnected = false;
$db->Disconnect();
//implementem el timeout
while (!$dbconnected && $intents<$maxintents) {
//mirem el tmep d'espera
$waiting = ($intents<count($timeouts))?$timeouts[$intents]:$timeouts[count($timeouts)-1];
echo 'esperant '.$waiting.' segons...';
$postlog[] = "Reintent #$intents, esperant $waiting segons";
sleep($waiting);
echo "torne-m'hi\n!";
// See MDL-6760 for why this is necessary. In Moodle 1.8, once we start using NULLs properly,
// we probably want to change this value to ''.
$db->null2null = 'A long random string that will never, ever match something we want to insert into the database, I hope. \'';
error_reporting(0); // Hide errors
if (!isset($CFG->dbpersist) or !empty($CFG->dbpersist)) { // Use persistent connection (default)
$dbconnected = $db->PConnect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname,true);
} else { // Use single connection
$dbconnected = $db->Connect($CFG->dbhost,$CFG->dbuser,$CFG->dbpass,$CFG->dbname,true);
}
$intents++;
}
if (! $dbconnected) {
//@socket_shutdown($DAEMON->listen_socket, 0);
$postlog[] = "$intents intents, no es possible connetar";
foreach ($postlog as $plog) {
echo "$plog\n";
}
die("No es pot connectar a la BD");
} else {
foreach ($postlog as $plog) {
add_to_log(1, 'chat', 'chatd', "index.php?id=1", $plog);
}
add_to_log(1, 'chat', 'chatd', "index.php?id=1", "Reestablerta la connexio amb $intents intents");
}
$postlog = array();
/// Forcing ASSOC mode for ADOdb (some DBs default to FETCH_BOTH)
$db->SetFetchMode(ADODB_FETCH_ASSOC);
}
//-------- END (last)
// First of all, let's see if any of our UFOs has identified itself
if($DAEMON->conn_activity_ufo($active)) {
Server: SuSE Linux Enterprise Server 10
Apache/2.2.3
mysql Ver 14.12 Distrib 5.0.18, for suse-linux (i686) using readline 5.1
PHP 5.1.2 (cli) (built: Nov 7 2006 14:30:25) Copyright (c) 1997-2006 The PHP Group Zend Engine v2.1.0, Copyright (c) 1998-2006 Zend Technologies
Moodle chat daemon v1.0 on PHP 5.1.2 ($Id: chatd.php,v 1.31 2007/01/03 14:44:45 moodler Exp $)
Moodle 1.7.x
client: SuSE Linux Enterprise Desktop
Firefox 1.5.0.9
Server setup:
cront tab: @reboot /srv/www/htdocs/moodle/mod/chat/mdl-chat-daemon.sh
#! /bin/bash
cd /srv/www/htdocs/moodle/mod/chat/
php5 chatd.php --start >/var/log/moodlechat.log &
I am experiencing two loss of function scenarios:
1. The process, "php5 chatd.php" exits without logging an error to std_out. As you can see from my (albeit very basic) start script that I'm redirecting std_out to a file instead of using the chatd.php start script logging option.
2. The process, "php5 chatd.php -
start" as listed with ps -ef, is still running, and I can establish a telnet connection to port 9111, but the chat window within the remote Firefox broswer has stopped functioning, and more times that not, when this occurrs, Firefox hard crashes, and exits. I've never seen Firefox crash before-ever. If no one else is experiencing the Firefox crashes, or the chat window not working even though the server daemon is still accepting incoming connections, then this may be due to the XGL 3D desktop. Look at the "window open ()" function for the chat pop up window. I'm not certain, but it seems the Firefox crash usually occurs when I rotate the desktop. The Firefox crash only occurs when I have Moodle chat open. I have not tested this scenario with other browsers, or Firefox on my system with xgl disabled, so I don't know if this issue is client or server. I will do further client side testing and report back.I may file a separate bug report on #2 depending on the results of my testing.
- mdl-chat-daemon.sh
#! /bin/bash
cd /srv/www/htdocs/moodle/mod/chat/
php5 chatd.php --start >/var/log/moodlechat.log &
I am experiencing two loss of function scenarios: 1. The process, "php5 chatd.php" exits without logging an error to std_out. As you can see from my (albeit very basic) start script that I'm redirecting std_out to a file instead of using the chatd.php start script logging option. 2. The process, "php5 chatd.php -start" as listed with ps -ef, is still running, and I can establish a telnet connection to port 9111, but the chat window within the remote Firefox broswer has stopped functioning, and more times that not, when this occurrs, Firefox hard crashes, and exits. I've never seen Firefox crash before-ever. If no one else is experiencing the Firefox crashes, or the chat window not working even though the server daemon is still accepting incoming connections, then this may be due to the XGL 3D desktop. Look at the "window open ()" function for the chat pop up window. I'm not certain, but it seems the Firefox crash usually occurs when I rotate the desktop. The Firefox crash only occurs when I have Moodle chat open. I have not tested this scenario with other browsers, or Firefox on my system with xgl disabled, so I don't know if this issue is client or server. I will do further client side testing and report back. I may file a separate bug report on #2 depending on the results of my testing.