#4127 - database max connections
| Identifier | #4127 |
|---|---|
| Issue type | Major issue (breaks an entire feature) |
| Title | database max connections |
| Status | Closed (cannot reproduce) |
| Handling member | Chris Graham |
| Addon | core |
| Description | hello, i have two composr sites and recently updated one of them to the latest version. The older site works as expected but the site I updated now is having database problems, sometimes it has the cant connect, max connections errors. I uped my max connections in the mysql conf and this helped a bit but still my site is crashing for a few hours each day. I am not sure what it is but seems like the new update is not closing connections to database? Thank you for your help
|
| Steps to reproduce | |
| Funded? | No |
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Comments
localhost if_sale Query 00:00:59 UPDATE new_temp_block_permissions SET p_time=1581837407 WHERE (p_session_id='73ea523488551' AND p_block_constraints='block=side_rss,defer=1,max_entries=5,param=http\\://www\\.global\\.hokudai\\.ac\\.jp/blog/category/event/feed/,ticker=0,title=Hokkaido University Events') LIMIT 1
I'd suggest setting 'connect_timeout' in the MySQL configuration to a lower value like '30' to start with.
i plan to migrate the sites to a faster more modern server this weekend and also clean up everything and bet it will work fine.
thank you and will drop a line after the move
cheers
Here are some notes...
The latest patch release did fix block caching, which was often broken. That may have changed some of the performance characteristics (e.g. bigger but fewer queries). I doubt it though.
You probably have 1 of 3 possibilities:
i) PHP is crashing, leaving connections open when it does (unlikely)
ii) You configured to use persistent connections when installing (now in _config.php) but the pool is too big for the number of connections MySQL allows
iii) You have a lot of hits and it needs that many connections to serve the request load. Often bots can cause a problem. Check raw access logs to see if you have a lot of bots hitting the server. With deferred block loading you're putting on extra stress, as each block is a separate PHP request executed in parallel (works via AJAX).
Note that Composr leaving connections open isn't a possibility, because PHP will always close them regardless of Composr's behaviour (or add them back into the persistent connection pool).
An UPDATE query on temp_block_permissions is one of the last queries to run on a page view, so that's interesting - it makes me wonder if you are using persistent connections, and that you could try disabling them in _config.php (I think this because you might just be seeing the *last* active query on that connection before PHP added it back to its internal connection queue). Also I can confirm this query is used for deferred blocks.
What you could try is
:set_value('whitelisted_blocks', 'side_rss,main_rss');
in Commandr.
You need the leading colon.
Put whatever blocks you are deferring AND DON'T CARE IF HACKERS LOAD WITH DIFFERENT PARAMETERS, as comma-separated. My example is doing it for side_rss and main_rss. This hidden option allows you to bypass Composr having to track permissions on these across AJAX, because it will know that the blocks may always be accessed with any parameters.