Title: Mysql Queries / processes Hanging, Causing connection Errors, Help!
Last modified: August 18, 2016

---

# Mysql Queries / processes Hanging, Causing connection Errors, Help!

 *  [remotay](https://wordpress.org/support/users/remotay/)
 * (@remotay)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/)
 * I Asked my host to look into the situation, and Heres what I got from them
    “
   The reason you are getting those errors is that your wordpress install is leaving
   connections open with the mysql server after it has finished its query, these
   are taking up the open connections:
 * [root@anime ~]# mysqladmin proc
    +——-+———–+———–+—————-+———+——+——-+——————+ | Id
   | User | Host | db | Command | Time | State | Info | +——-+———–+———–+—————-+———
   +——+——-+——————+ | 2858 | eximstats | localhost | eximstats | Sleep | 7575 | |
   | | 28369 | animetha | localhost | animetha_wrdp1 | Sleep | 491 | | | | 28590
   | animetha | localhost | animetha_wrdp1 | Sleep | 384 | | | | 28808 | animetha
   | localhost | animetha_wrdp1 | Sleep | 297 | | | | 28894 | animetha | localhost
   | animetha_wrdp1 | Sleep | 253 | | | | 29346 | animetha | localhost | animetha_wrdp1
   | Sleep | 67 | | |
 * See? There are threads that have been idle for 491 seconds. No apache thread 
   or php script should need to be connected for that long.
    “
 * I Was told to post here, as It’s entirely wordpress related. Anyone have any 
   ideas on what I can do to remedy the situation? My wordpress has 340 or so categories,
   and 5.5k+ Posts, if it means anything It’s also running on a high end dedicated.
 * I need the connects to close after they finish their queries. But it’s not happening,
   thats the problem. I don’t need them to remain persistently open, just need them
   to close after their queries are done. Thanks for the reply though Steve.
 * Any Devs know the problem here? Im using 2.2x version I believe, Not the latest
   one, but the previous version of wordpress.

Viewing 13 replies - 1 through 13 (of 13 total)

 *  Thread Starter [remotay](https://wordpress.org/support/users/remotay/)
 * (@remotay)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628276)
 * No one? This seems like a pretty serious bug. I never really tampered too much
   with the wordpress code and all.
 *  Thread Starter [remotay](https://wordpress.org/support/users/remotay/)
 * (@remotay)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628302)
 * This seems like a serious bug, And worth the bump. When the processes hang, The
   site becomes nearly unusable, as Database connection errors become common.
 *  Thread Starter [remotay](https://wordpress.org/support/users/remotay/)
 * (@remotay)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628339)
 * This is causing server crashes, and lots of headaches, No one knows how to resolve
   this?
 *  Thread Starter [remotay](https://wordpress.org/support/users/remotay/)
 * (@remotay)
 * [18 years, 8 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628340)
 * Additional info
    Deleting The last category i Made, Makes the server usable again,
   and Resolves the problem, But this same problem comes up randomly as I add more
   categories. [I’m at over 400 Categories now]. Any ideas?
 *  [2me](https://wordpress.org/support/users/2me/)
 * (@2me)
 * [18 years, 5 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628477)
 * Why has no one answered this thread?
    I noticed several sleeping processes on
   my blog as well and wondered if there was a connection to my server busy problems
   lately.
 *  [mdev05](https://wordpress.org/support/users/mdev05/)
 * (@mdev05)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628529)
 * I am facing this issue now. Its been 10months and no answers for this question.
   
   Please help us wordpress. I dint expect this of wordpress. This issue is being
   faced by so many people now.
 * I am on 2.6 version and have started facing this problem. every 3-4hours my mysql
   db is closing down. My support start it everytime and again it drops. Here is
   the issue:
 * root@trinculo [~]# mysqladmin processlist
    +——-+——————+———–+——————-+———+——-+————
   +——————————————————————————————————+ | Id | User | Host | db | Command | Time
   | State | Info | +——-+——————+———–+——————-+———+——-+————+——————————————————————————————————
   + | 23338 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 21098 | | | |
   26600 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 19948 | | | | 27086
   | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 19754 | | | | 28088 | gyaninc_wrdp2
   | localhost | gyaninc_wrdp2 | Sleep | 19475 | | | | 31342 | gyaninc_wrdp2 | localhost
   | gyaninc_wrdp2 | Sleep | 18413 | | | | 31411 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2
   | Sleep | 18386 | | | | 31466 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep
   | 18366 | | | | 31564 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 18325
   | | | | 31636 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 18279 | |
   | | 31676 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 18259 | | | |
   31702 | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 18241 | | | | 31740
   | gyaninc_wrdp2 | localhost | gyaninc_wrdp2 | Sleep | 18217 | | | | 31791 | gyaninc_wrdp2
   | localhost | gyaninc_wrdp2 | Sleep | 18198 | | | ——————-
 * It appears that mysql connection opening in your code is not being closed properly
   which is causing this. You need to get it checked with your developer.
 * Let us know if you need further assistance.
 * PLEASE HELP FRIENDS.
    Dev
 *  [cliffski](https://wordpress.org/support/users/cliffski/)
 * (@cliffski)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628530)
 * I have EXACTLY the same problem here. Anyone know how to fix or mitigate this?
   why is this not #1 priority for the wordpress team?
    is this fixed in the very
   latest version (after hearing horror stories I didn’t update yet).
 *  838745
 * [17 years, 10 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628531)
 * Same here. Sleeps. And it worked at start, but not working now. Any ideas how
   to fix?
 *  838745
 * [17 years, 10 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628532)
 * And btw, it`s WP problem, since all works perfectly with regular query.
 *  838745
 * [17 years, 10 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628533)
 * well. It seems i found problem. Problem is with wp_cron. It pings other servers
   through XML-RPC and if PHP could not connect with DNS server, it will sleep till
   end.
 * I checked /etc/resolv.conf and changed DNS server (my hoster changed adrress 
   to days ago) then made system reboot (problably apache reboot is enough, but 
   i prefer total reboot) and now all works.
    Hope it will help someone else.
 *  [thaaanos](https://wordpress.org/support/users/thaaanos/)
 * (@thaaanos)
 * [17 years, 10 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628534)
 * I had a similar problem, Solved only with backuping database and a clean reinstall,
   restore.
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [17 years, 10 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628535)
 * > _why is this not #1 priority for the wordpress team?_
 * Because this is not a WordPress problem.
 * WordPress does NOT create persistent connections to the database when it is not
   running. It uses mysql_connect, with NON-persistent connections.
 * If you are getting persistent connections anyway, then this is a problem with
   your PHP or webserver configuration in some way.
 * Also, if wp-cron is not finishing, then many bits of WordPress will not work.
   Your server needs working DNS capabilities and the ability to connect to external
   websites (if you’re doing pinging or anything of the sort). It also needs to 
   be able to loopback, to connect to its own hostname. These are all part of a 
   standard setup for a webserver, and if your host doesn’t support them, then a)
   they’re incompetent and b) find a new host.
 *  [vinegar](https://wordpress.org/support/users/vinegar/)
 * (@vinegar)
 * [17 years, 9 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628541)
 * i’ve got a several other services all using the same database server all set 
   up identically but for the sites running on them, but it’s the server with wordpress
   sites that leaves behind 100 sleeping connections. are you sure it’s not wordpress
   doing something here?
 * edit: for those other people having this problem, can you list what versions 
   of apache, php, and mysql you are running? we’re running apache 2.0.63, php 4.3.10,
   and mysql 4.1.11 – if anyone knows of any relevant bugs related to those versions
   that could cause mysql threads to persist in a sleep state, please let us know!

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘Mysql Queries / processes Hanging, Causing connection Errors, Help!’ 
is closed to new replies.

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [queries](https://wordpress.org/support/topic-tag/queries/)
 * [WPadvanced](https://wordpress.org/support/topic-tag/wpadvanced/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 13 replies
 * 8 participants
 * Last reply from: [vinegar](https://wordpress.org/support/users/vinegar/)
 * Last activity: [17 years, 9 months ago](https://wordpress.org/support/topic/mysql-queries-processes-hanging-causing-connection-errors-help/#post-628541)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
