WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#8258 closed defect (bug) (worksforme)

Wordpress Connections not closing

Reported by: mallyo Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: General Keywords: open connections has-patch reporter-feedback
Focuses: 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 (1)

wp-db.php.diff (321 bytes) - added by vladimir_kolesnikov 6 years ago.
Forcefully close mysql connection on shutdown

Download all attachments as: .zip

Change History (19)

comment:1 @jacobsantos6 years ago

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.

comment:2 @DD326 years ago

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

comment:3 @jacobsantos6 years ago

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.

comment:4 @DD326 years ago

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.

comment:5 @ryan6 years ago

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

comment:6 @mallyo6 years ago

thanks for your assistance.

php5
MySQL client version: 4.1.22

comment:7 @mallyo6 years ago

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.

comment:8 @mrmist6 years ago

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?

comment:9 @mallyo6 years ago

Hello

Any advice or suggestions how to fix this?

comment:10 @ryan6 years ago

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.

comment:11 @mallyo6 years ago

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

comment:12 @mallyo6 years ago

Hello

Any further advise or questions?

comment:13 @mallyo6 years ago

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

Can anyone suggest a fix please?

@vladimir_kolesnikov6 years ago

Forcefully close mysql connection on shutdown

comment:14 @vladimir_kolesnikov6 years ago

  • Keywords has-patch reporter-feedback added

comment:15 @Denis-de-Bernardy6 years ago

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

comment:16 @Denis-de-Bernardy6 years ago

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

comment:17 @Denis-de-Bernardy6 years ago

It could also be due to the sitemap generation scripts.

comment:18 @ryan6 years ago

  • Milestone 2.8 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

Reopen with requested feedback.

Note: See TracTickets for help on using tickets.