Discussion:
Database connection drops
David Anderson
2013-12-10 08:59:43 UTC
Permalink
Hi,

It's amazing how slow some people's web hosting is. I'm currently
looking at a log file of a backup of a site which takes over an hour to
create a single 150Mb zip file (which does have 26,000 files in it).

It appears that after somewhere around 3000 seconds, the database
connection is dropped, and all commands that result in talking to the
database silently fail. For example, this returns no results:

$all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);

As another example, the option which my code is using to save its state
isn't updated after that time. The saved state is out-of-date. (At this
point, that's not a huge problem, as I have lots of checks and balances).

If I use the scheduler to schedule a restart of the task a few seconds
later, then everything works. $wpdb isn't getting over-written, as that
would lead to fatal errors for methods not found instead of silent failure.

Has anyone come across something like that before? Does anyone know
where in WordPress core this happens...

... and the important question: how to detect it/refresh the connection
when it happens? At the moment I've thrown in a quick check at a key
point, but on the test case I've seen, that comes about 10 minutes late.
That's no problem, as everything in the code I've written is resumable
and can detect and recover from failures like this. It'd just be good to
not waste 10 minutes though.

Many thanks,
David
--
UpdraftPlus - Best WordPress backups - http://updraftplus.com
WordShell - WordPress fast from the CLI - http://wordshell.net
J.D. Grimes
2013-12-10 13:38:08 UTC
Permalink
Have a look at this ticket (tagged 3.9-early, too): https://core.trac.wordpress.org/ticket/5932

-J.D.
Hi,
It's amazing how slow some people's web hosting is. I'm currently looking at a log file of a backup of a site which takes over an hour to create a single 150Mb zip file (which does have 26,000 files in it).
$all_tables = $wpdb->get_results("SHOW TABLES", ARRAY_N);
As another example, the option which my code is using to save its state isn't updated after that time. The saved state is out-of-date. (At this point, that's not a huge problem, as I have lots of checks and balances).
If I use the scheduler to schedule a restart of the task a few seconds later, then everything works. $wpdb isn't getting over-written, as that would lead to fatal errors for methods not found instead of silent failure.
Has anyone come across something like that before? Does anyone know where in WordPress core this happens...
... and the important question: how to detect it/refresh the connection when it happens? At the moment I've thrown in a quick check at a key point, but on the test case I've seen, that comes about 10 minutes late. That's no problem, as everything in the code I've written is resumable and can detect and recover from failures like this. It'd just be good to not waste 10 minutes though.
Many thanks,
David
--
UpdraftPlus - Best WordPress backups - http://updraftplus.com
WordShell - WordPress fast from the CLI - http://wordshell.net
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...