I am having a problem with a website, connecting to a MySQL database using two types of connection on different parts: some PDO, some mysql_connect().
The first part of the website is requesting MySQL using the very classic ‘mysql_query()’ PHP function. This part makes some heavy queries on geographical data. Some of these requests (already optimized) take a long time.
Another part of the site is more recent, and made using Doctrine via a PDO connection.
The problem is, when one of the big processes is being ran in one browser page (can take around 1minute to process and return the page), if a user opens another page the PDO connection is in sleep mode, and holds the whole page from loading. After 60s (wait_timeout of mysql) the connection is killed, and the PDO gets an exception “The MySQL Server has gone away”.
What is strange is that other pages with only classical mysql_connect() and mysql_query() can be run without a problem in parallel, only PDO queries are holding back and eventually dying.
Any input would be really appreciated.
Closing this question, it was in fact related to the php session being held up on write, preventing the other process from running. session_write_close() resolved it.