Server Error 500 --> session which are beeing locked / timedout?

Hi,
We have a recurrent issue ( Shopware 5.4.6 Build Rev 201807181357) when for example I open a preview of a product file from
the back-end and then all the shop (all pages) is producing a Server Error 500.

For some minutes the web site is in ‚black out‘ :open_mouth:
In the server log we have found
<<
[Thu Aug 12 00:00:35.185338 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…/php5-fcgi-*-80-tux21.trendhosting-net.ch“ stderr: PHP message: PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction in /home/…/Shopware/Components/Session/PdoSessionHandler.php:536, referer: htt …/

[Thu Aug 12 00:00:35.185382 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…“ stderr: Stack trace:, referer: htt …/

[Thu Aug 12 00:00:35.185405 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…s/php5-fcgi-*-80-tux21.trendhosting-net.ch“ stderr: #0 /home/…/htdocs/engine/Shopware/Components/Session/PdoSessionHandler.php(536): PDOStatement->execute(), referer: htt …/

[Thu Aug 12 00:00:35.185412 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…/php5-fcgi-*-80-tux21.trendhosting-net.ch“ stderr: #1 /home/…/htdocs/engine/Shopware/Components/Session/PdoSessionHandler.php(291): Shopware\Components\Session\PdoSessionHandler->doRead(‚15d45683c996c31…‘), referer: htt …/

[Thu Aug 12 00:00:35.185417 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…/php5-fcgi-*-80-tux21.trendhosting-net.ch“ stderr: #2 [internal function]: Shopware\Components\Session\PdoSessionHandler->read(‚15d45683c996c31…‘), referer: htt …/

[Thu Aug 12 00:00:35.185423 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…/php5-fcgi-*-80-tux21.trendhosting-net.ch“ stderr: #3 /home/…/htdocs/engine/Library/Zend/Session.php(481): session_start(), referer: htt …/

[Thu Aug 12 00:00:35.185428 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…“ stderr: #4 /home/…/htdocs/engine/Shopware/Components/DependencyInjection/Bridge/Session.php(105): Zend_Session::start(Array), referer: htt …/

[Thu Aug 12 00:00:35.185435 2021] [:error] [pid 20936:tid 140645385074432] [client 2a01:cb10:113:2400:68fd:ad30:ec9a:c67f:58756] FastCGI: server „/home/…/php5-fcgi-*-80-tux21.trendhosting-net.ch“ stderr: #5 /home/…/var/cache/production_201807181357/proxies/ShopwareProduction47d1dce28dbd034a3cb7a3f576d693fce18c6df8ProjectContainer.php(1303): Shopware\…, referer: htt …/

so we think the solution can be (not sure at all) to disable session locking in shopware.

In the official documentation:

​#### Disable lockingAnchor link for: disable locking

As of Shopware 5.2.13, you can disable the session locking for the database handler:

'session' => [    'save_handler' => 'db',    'locking' => false]

but if I include this code to config.php the site crashed.

Any clue/help please?
Thanks a lot

Hello rtomas,

If there are many calls on a session, a deadlock error can appear. Disabling the session locking could lead to race conditions, so it is not suited to be a permanent solution.

  • Check for third party plugins which negatively affect your shop
  • Using a faster session handler, for example Redis: Shopware Session handling
  • Not recommended: Temporarily disabling the session locking (Danger: race conditions can appear): config.php settings

While adding content in the config.php, you have to ensure that the code added is valid, or the site will no longer be reachable. Example:

<?php
return [
    'db' => [
        'username' => 'yourUsername',
        'password' => 'yourPassword',
        'dbname' => 'yourDbname',
        'host' => 'yourHost',
        'port' => 'yourPort'
    ],

   'session' => [
        'locking' => false,
    ],
];

If you do not have a lot of traffic, the issue is most likely caused by a plugin which is causing too many calls on the session.

1 „Gefällt mir“