My drupal site have getting following error multiple times and the site become down . I am pretty stuck here,
[php7:notice] [pid 25618:tid 139647506151168] [client xxx.111] PDOException: SQLSTATE[HY000] [2000] in /drupal/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php on line 79 #0 /drupal/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(149): PDO->__construct()\n#1 /drupal/core/lib/Drupal/Core/Database/Database.php(376): Drupal\\Core\\Database\\Driver\\mysql\\Connection::open(Array)\n#2 /drupal/core/lib/Drupal/Core/Database/Database.php(166): Drupal\\Core\\Database\\Database::openConnection('default', 'default')\n#3 [internal function]: Drupal\\Core\\Database\\Database::getConnection('default')\n#4 /drupal/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(79): call_user_func_array('Drupal\\\\Core\\\\Dat...', Array)\n#5 /drupal/core/lib/Drupal/Component/DependencyInjection/Container.php(171): Drupal\\Component\\DependencyInjection\\PhpArrayContainer->createService(Array, 'database')\n#6 /drupal/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(260): Drupal\\Component\\DependencyInjection\\Container->get('database', 1)\n#7 /drupal/core/lib/Drupal/Component/DependencyInjection/PhpArrayContainer.php(62): Drupal\\Component\\DependencyInjection\\PhpArrayContainer->resolveServicesAndParameters(Array)\n#8 /drupal/core/lib/Drupal/Component/DependencyInjection/Container.php(171): Drupal\\Component\\DependencyInjection\\PhpArrayContainer->createService(Array, 'cache.container')\n#9 /drupal/core/lib/Drupal/Core/DrupalKernel.php(516): Drupal\\Component\\DependencyInjection\\Container->get('cache.container')\n#10 /drupal/core/lib/Drupal/Core/DrupalKernel.php(877): Drupal\\Core\\DrupalKernel->getCachedContainerDefinition()\n#11 /drupal/core/lib/Drupal/Core/DrupalKernel.php(469): Drupal\\Core\\DrupalKernel->initializeContainer()\n#12 /drupal/core/lib/Drupal/Core/DrupalKernel.php(665): Drupal\\Core\\DrupalKernel->boot()\n#13 /drupal/index.php(19): Drupal\\Core\\DrupalKernel->handle(Object(Symfony\\Component\\HttpFoundation\\Request))\n#14 {main}
And also We getting some error like
php.ERROR: Drupal\Core\Database\DatabaseExceptionWrapper: SQLSTATE[40001]: Serialization failure: 1213 Unknown error 1213: INSERT INTO {semaphore} (name, value, expire) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 0dIEdLN3F3E-gizpTgOlg31snzlsIuqwHBT6pQarz80:user [:db_insert_placeholder_1] => 6098968075d4baf4bad84e8.06341162 [:db_insert_placeholder_2] => 1565241193.7106 ) in Drupal\Core\TempStore\PrivateTempStore->set()
And a particular time instance suddenly increased the SQL connections.
Calling beolw query with continuesly
"Waiting for table metadata lock","INSERT INTO semaphore (name, value, expire) VALUES ('5203:session_entry', '13512856815d4fdbbf265ca7.26803167', '1565514717.1571')"
and increased the connections and mysql lost the connection.
Is this both are connected. Any idea on this issue?