Ticket #8258 (new defect (bug))

Opened 2 months ago

Last modified 3 weeks ago

Wordpress Connections not closing

Reported by: mallyo Assigned to: anonymous
Priority: normal Milestone: 2.8
Component: General Version:
Severity: normal Keywords: open connections has-patch reporter-feedback
Cc:

Description

Hello

I've received the following from my hosting company.

I need to find a fix before they close my account, can anyone advise?

What this means is that wordpress is opening up a connection and then not closing it before the page request is complete. This leaves the connection open which in turn causes load issues. You will need to resolve this issue immediately or the account will need to be suspended again to prevent further server issues.

Can anyone help.

I have the latest version of wordpress installed 263

I've have the following mods enabled

All in One SEO Pack 1.4.6.15

Google XML Sitemaps 3.1.0.1 Permalink Redirect 2.0 SimpleTags? 2.0 Simple Tags 1.57

Attachments

wp-db.php.diff (321 bytes) - added by vladimir_kolesnikov on 12/08/08 05:36:36.
Forcefully close mysql connection on shutdown

Change History

11/17/08 21:33:19 changed by jacobsantos

What PHP version? PHP should close the mysql connection when the page is done. However, to say it should means that it doesn't always correctly do so. It would be an easy plugin to make to close the connection manually.

11/18/08 00:50:10 changed by DD32

  • priority changed from highest omg bbq to normal.

The question is, What connections, No mention of MySQL there, so it nearly seemed like it could be related to HTTP connections, Else 2.7 wouldnt be specifically causing it.

11/18/08 03:12:41 changed by jacobsantos

DD32, it is doubtful that it is HTTP connections. I'm a good citizen, so I close the connections when I'm using fsockopen and fopen and even cURL. HTTP should close the connection when it is finished. It doesn't give any handle, so it is not possible to do it manually.

11/18/08 03:42:54 changed by DD32

I was thinking of the Cron connections, AFAIK, they're not closed?

MySQL though, is a possibility, And allthough PHP should be closing them, Ensuring they're closed would be best i guess.

11/18/08 03:53:20 changed by ryan

In < 2.7, cron requests do not do an explicit fclose(), IIRC.

11/18/08 09:44:23 changed by mallyo

thanks for your assistance.

php5 MySQL client version: 4.1.22

11/18/08 10:46:20 changed by mallyo

here is the first email complaint I received.

this account has recently been showing signs of causing stability problems on the server which appear to be due to mysql usage on the wordpress installation, it does not appear to be closing it's connections which are then hanging and causing problems for the rest of the server.

11/18/08 18:35:12 changed by mrmist

Not seeing this during normal usage of my 2.6 test or 2.7 test sites. mysql processlist is not full of stale connections, which I'd expect if this was a core problem. Maybe plugin related?

11/18/08 21:05:21 changed by mallyo

Hello

Any advice or suggestions how to fix this?

11/18/08 21:19:30 changed by ryan

WP uses one non-persistent mysql connection that is shut down when PHP script execution ends. Maybe a plugin is doing extra calls to mysql_connect() or you have a custom wp-db.php that does connection retries.

11/18/08 22:33:03 changed by mallyo

sorry, I've not modified wp-db.php and only have the mods installed above.

11/19/08 18:08:38 changed by mallyo

Hello

Any further advise or questions?

11/27/08 18:26:40 changed by mallyo

I'm sorry but I'm still having this problem.

Can anyone suggest a fix please?

12/08/08 05:36:36 changed by vladimir_kolesnikov

  • attachment wp-db.php.diff added.

Forcefully close mysql connection on shutdown

12/08/08 05:37:58 changed by vladimir_kolesnikov

  • keywords changed from open connections to open connections has-patch reporter-feedback.

12/16/08 16:53:20 changed by Denis-de-Bernardy

Based on the plugins that are active on his install, I sincerely doubt the patch will do any good.

I've had a couple of customers with similar issues, which I traced down to extraordinarily long ping lists. Having them shorten it to only a few ping servers fixed the issue.

Just FYI...

12/16/08 16:54:32 changed by Denis-de-Bernardy

@mallyo: if this is your case, rename the ticket accordingly, do not close it.