<p dir="auto">When my site gets a lot of traffic, I will get a lot of errors like this</p>
<p dir="auto">request.CRITICAL: Uncaught PHP Exception PDOException: "SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction" at /var/www/symfony/vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php line 336</p>
<p dir="auto">The problem is that I have the lock_mode set to 0 so there shouldn't be any transactions involved in my sessions.</p>
<p dir="auto">After upgrading to 2.6.3 and switching to the new PdoSessionHandler schema I have been getting these errors in my log sporadically:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="[2015-01-12 13:28:59] request.CRITICAL: Uncaught PHP Exception PDOException: &quot;SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction&quot; at /../vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php line 513 {&quot;exception&quot;:&quot;[object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction at /../vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php:513)&quot;} []"><pre class="notranslate"><code class="notranslate">[2015-01-12 13:28:59] request.CRITICAL: Uncaught PHP Exception PDOException: "SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction" at /../vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php line 513 {"exception":"[object] (PDOException(code: HY000): SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction at /../vendor/symfony/symfony/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php:513)"} []
</code></pre></div>
<p dir="auto">It doesn't appear to be affecting the end users. Seems like it is happening silently.</p>
<p dir="auto">I followed the updated cookbook article: <a href="http://symfony.com/doc/current/cookbook/configuration/pdo_session_storage.html" rel="nofollow">http://symfony.com/doc/current/cookbook/configuration/pdo_session_storage.html</a></p>
<p dir="auto">The <code class="notranslate">sessions</code> table is in the same <a href="http://symfony.com/doc/current/cookbook/configuration/pdo_session_storage.html#sharing-your-database-connection-information" rel="nofollow">database as my app</a>. Could that be causing the problem? Reading the comments for <code class="notranslate">PdoSessionHandler::LOCK_TRANSACTIONAL</code> this should not use the same connection but this wouldn't be the case, would it?</p>
<p dir="auto">I am using MySQL.</p>