Skip to content

Commit

Permalink
Fix EZP-26907: avoid 'mysql has gone away' errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Gaetano Giunta committed Jan 26, 2017
1 parent 20f281e commit 8be7dd5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions bin/php/updatesearchindexsolr.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,22 @@ protected function forkAndExecute( $nodeID, $offset, $limit )
// Prepare DB-based cluster handler for fork (it will re-connect DB automatically).
eZClusterFileHandler::preFork();

$conn = false;
$ezpKernelContainer = ezpKernel::instance()->getServiceContainer();
if ( $ezpKernelContainer ) // in case we are in pure-legacy mode
{
$conn = $ezpKernelContainer->get('doctrine')->getConnection();
$conn->close();
}

$pid = pcntl_fork();

// reinitialize DB after fork
$this->initializeDB();
if ( $conn )
{
$conn->connect();
}

if ( $pid == -1 )
{
Expand Down

0 comments on commit 8be7dd5

Please sign in to comment.