Some solution about segmentation fault
Hey guys, I'm running a large installation of 1.6 ST on Linux with Apache 2.2.3 + PHP 5.1.6. After months of normal operation, the web server crash with the following errors when accessing the tickets page (scp/tickets.php).
child pid 11194 exit signal Segmentation fault (11)
child pid 11196 exit signal Segmentation fault (11)
child pid 11195 exit signal Segmentation fault (11)
The system could get email without any problems but it seems failed to generate ticket ID. When there're many tickets in the database (e.g. > 15K), the code will fall into stack overflow error.
The function genExtRandID() in include/class.ticket.php is changed as follows:
From:
function genExtRandID() {
global $cfg;
//We can allow collissions...extId and email must be unique ...so same id with diff emails is ok..
// But for clarity...we are going to make sure it is unique.
$id=Misc:(EXT_TICKET_ID_LEN);
if(db_num_rows(db_query('SELECT ticket_id FROM '.TICKET_TABLE.' WHERE ticketID='.db_input($id))))
return Ticket:();
return $id;
}
To:
function genExtRandID() {
global $cfg;
//We can allow collissions...extId and email must be unique ...so same id with diff emails is ok..
// But for clarity...we are going to make sure it is unique.
$id=Misc:(EXT_TICKET_ID_LEN);
$sql = 'SELECT t1.ticketID + 1 FROM '.TICKET_TABLE.' t1 WHERE NOT EXISTS ( SELECT * FROM '.TICKET_TABLE.' t2 WHERE t2.ticketID = t1.ticketID + 1 ) LIMIT 1';
$res=db_query($sql);
if($res && db_num_rows($res)) {
list($id)=db_fetch_row($res);
return $id;
} else return NULL;
}