WordPress.org

Ready to get started?Download WordPress

Forums

Mysql Queries / processes Hanging, Causing connection Errors, Help! (14 posts)

  1. remotay
    Member
    Posted 6 years ago #

    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.

  2. remotay
    Member
    Posted 6 years ago #

    No one? This seems like a pretty serious bug. I never really tampered too much with the wordpress code and all.

  3. remotay
    Member
    Posted 6 years ago #

    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.

  4. remotay
    Member
    Posted 6 years ago #

    This is causing server crashes, and lots of headaches, No one knows how to resolve this?

  5. remotay
    Member
    Posted 6 years ago #

    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?

  6. 2me
    Member
    Posted 6 years ago #

    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.

  7. mdev05
    Member
    Posted 6 years ago #

    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

  8. cliffski
    Member
    Posted 6 years ago #

    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).

  9. Anonymous
    Unregistered
    Posted 6 years ago #

    Same here. Sleeps. And it worked at start, but not working now. Any ideas how to fix?

  10. Anonymous
    Unregistered
    Posted 6 years ago #

    And btw, it`s WP problem, since all works perfectly with regular query.

  11. Anonymous
    Unregistered
    Posted 6 years ago #

    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.

  12. thAAAnos
    Member
    Posted 6 years ago #

    I had a similar problem, Solved only with backuping database and a clean reinstall, restore.

  13. Samuel Wood (Otto)
    Tech Ninja
    Posted 6 years ago #

    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.

  14. vinegar
    Member
    Posted 5 years ago #

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic