SQL Error : 1153 Got a packet bigger than 'max_allowed_packet'
DELETE FROM immidb_search_results WHERE session_id NOT IN ('6f4f47328c7666e26adedd9312b5ddcf' ...
You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld gets a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by starting mysqld with the -O max_allowed_packet=# option (default 1M). The extra memory is allocated on demand, so mysqld will allocate more memory only when you issue a big query or when mysqld must return a big result row!
Src: http://www.mysql.com/doc/en/Gone_away.html
message_die(CRITICAL_ERROR, 'Error creating new session', '', __LINE__, __FILE__, $sql);
$error = TRUE;
if (SQL_LAYER == "mysql" || SQL_LAYER == "mysql4")
{
$sql_error = $db->sql_error($result);
if ($sql_error["code"] == 1114)
{
$result = $db->sql_query('SHOW TABLE STATUS LIKE "'.SESSIONS_TABLE.'"');
$row = $db->sql_fetchrow($result);
if ($row["Type"] == "HEAP")
{
if ($row["Rows"] > 2500)
{
$delete_order = (SQL_LAYER=="mysql4") ? " ORDER BY session_time ASC" : "";
$db->sql_query("DELETE QUICK FROM ".SESSIONS_TABLE."$delete_order LIMIT 50");
}
else
{
$db->sql_query("ALTER TABLE ".SESSIONS_TABLE." MAX_ROWS=".($row["Rows"]+50));
}
if ($db->sql_query($sql))
{
$error = FALSE;
}
}
}
}
if ($error)
{
message_die(CRITICAL_ERROR, "Error creating new session", "", __LINE__, __FILE__, $sql);
}