Manual & debug backups won't start, only one line in log
-
Hi,
Just installed the latest version of UpdraftPlus – 1.4.6 – on WordPress 3.4.2 (I plan to update to the latest version of WordPress, but I want to take a full backup before I do so!)
I have configured and authenticated Google Drive.
When clicking any of ‘Backup now’, ‘Debug full backup’ or ‘Debug DB backup’, nothing happens. A log file gets created that simply has one line in it, like this:
0000.000 Opened log file at time: Sat, 09 Feb 2013 11:20:41 +0000
and that’s it. Each log file differs only in the time shown on that one line.
The same happens with debug mode on or off.
I tried disabling plugins that I thought might interfere, such as the security ones, but it didn’t help.
The Google Drive status says ‘You already appear to be authenticated.’ There is nothing at all showing up in Google Drive.
Let me know if you need any more info. Any help is appreciated!
-
Hi,
Thanks for the report… how very interesting/curious… there is very, very little that happens between logging line 1 and logging line 2.
First thing – check that your disk space usage is not 100%. If not that, then proceed…
Second – do you have access to your PHP error logs? Anything recorded there?
Are you confident enough to fiddle with PHP?
Open up wp-content/plugins/updraftplus/updraftplus.php, and go to line 202. That’s the line that logs the message you have.
Then, after that line, whilst in the same function, add in lines like this changing the 1 to 2, 3, 4, etc…
$this->log(“I am here! 1”);
Also put one in at the start of the function “log” .
Then that will show us on exactly which line the error is.
If that’s too technical, then let me know and I’ll come up with an easier way.
David
Thanks David for your fast response.
I checked the available space on my server and it was quite full, but I was able to clear most of it as it was taken up by old emails (which I no longer use that server for), so there is now many times more space available than used by the site.
But now it only seems to get weirder…
I added the lines of code you suggested and then attempted to run the backup again. Now, using either ‘Backup now’ or ‘Full debug backup’, the log file is created but is 0 bytes and has NO entries at all! No PHP errors are thrown. Here is the modified code:
function logfile_open($nonce) { //set log file name and open log file $updraft_dir = $this->backups_dir_location(); $this->logfile_name = $updraft_dir. "/log.$nonce.txt"; // Use append mode in case it already exists $this->logfile_handle = fopen($this->logfile_name, 'a'); $this->opened_log_time = microtime(true); $this->log("Opened log file at time: ".date('r')); $this->log("I am here! 1"); $this->log("I am here! 2"); $this->log("I am here! 3"); $this->log("I am here! 4"); $this->log("I am here! 5"); global $wp_version; $logline = "UpdraftPlus: ".$this->version." WordPress: ".$wp_version." PHP: ".phpversion()." (".@php_uname().") PHP Max Execution Time: ".@ini_get("max_execution_time")." ZipArchive::addFile exists: "; $logline .= (method_exists('ZipArchive', 'addFile')) ? "Y" : "N"; $this->log($logline); } # Logs the given line, adding (relative) time stamp and newline function log($line) { $this->log("I am here! function log 1"); if ($this->logfile_handle) fwrite($this->logfile_handle, sprintf("%08.03f", round(microtime(true)-$this->opened_log_time, 3))." ".$line."\n"); UpdraftPlus_Options::update_updraft_option("updraft_lastmessage", $line." (".date('M d H:i:s').")"); }
I don’t seem to have access to the PHP error log – would it normally be in the server root (I’m on shared hosting)? I know the host admin so I may be able to get the error log from him if necessary.
PS. I did also try running the backup after clearing space on the server BEFORE I added the lines of code above, and the result was the same as in my first post – just the single line in the log file and nothing else.
How weird indeed… are you sure you didn’t inadvertantly introduce a PHP error somewhere? (Though I can’t see one in that snippet – maybe you hit the keyboard by mistake somewhere else?)
I removed the @ in @php_uname in the latest version, as that was not needed and could mask a problem if your system had some problem there (though I can’t think how it could).
With the adding log lines, I meant that you should intersperse them with the existing lines. That way, you could tell which line is the one where apparently everything dies.
If you can get the error logs, then that would help… but another thing that may work to help show the error is to edit your wp-config.php (in the root of your WP install) and change the WP_DEBUG setting, replacing it with this:
@ini_set(‘log_errors’,’Off’);
@ini_set(‘display_errors’,’On’);
@ini_set(‘error_reporting’, E_ALL );
define(‘WP_DEBUG’, true);
define(‘WP_DEBUG_LOG’, false);
define(‘WP_DEBUG_DISPLAY’, true);However, you’d better update to the latest UpdraftPlus first, since it seems some other error has been introduced with the adding of logging lines.
David
Thanks David.
So I:
Uninstalled the plugin and then manually installed 1.4.9 (clicking update didn’t work correctly – it kept downloading and installing the 1.4.7 package instead of 1.4.9)
Deactivated all other plugins
Tried running a backup using both methods – same thing as before, just one line in the log.
Then I added the code for the WP_DEBUG setting that you posted, and now the top of every page displays this error multiple times:
Notice: add_option was called with an argument that is deprecated since version 2.3 with no alternative available. in XXXX/wp-includes/functions.php on line 2925
as well as a similar one referring to has_cap
It also displays the first error three times after ‘Last backup log message’ on the Updraft settings page. It still shows the last log open time right underneath.
When I deactivate all the plugins, the error messages no longer appear. But if I then activate only UpDraft and try to run a backup, the same thing happens – one line in log – but there are no error messages.
Does this help provide any more clues??
edit:
All of the errors except one disappeared when I de-activated ‘Official StatCounter Plugin’ – might have to put the StatCounter code in manually instead…
Now I only have
Notice: add_contextual_help is deprecated since version 3.3! Use get_current_screen()->add_help_tab() instead. in XXXX/wp-includes/functions.php on line 2839
and I will keep deactivating plugins until I work out which one is causing it.
Well, that deepens the mystery.
All those debugging warnings must be from other plugins if they disappear when the other plugins are deactivated.
Would you be willing, as a last resort, to give me access to the server so that I can have a tinker with it myself?
David
Sorry, forgot to say – if so, then obviously don’t publish any credentials here. Email them to: [email protected].
Finally – what version of PHP are you running?
OK, found the source of the remaining error – another backup plugin, ‘WordPress Databse backup’ – and I removed the plugin completely.
Same thing happening with UpDraft.
PHP version is 5.3.21
I will send you an email David, thanks.
Your PHP installation has a major problem. PHP dies without trace if the ‘method_exists’ function is ever used. Presumably segfaulting.
I uploaded a test script:
<?php if (method_exists('Bob', 'Builder')) { echo "Yes"; } else { echo "No"; } // This line never executes - we die first echo "Still alive!"; ?>
That produces your error page, if run.
UpdraftPlus uses this function, to test what zip-file-handling capabilities are around. Every time it hits it, boom; PHP dies.
You’ll want to get that fixed, or you’re at the mercy of any WordPress component that invokes it. A quick check shows that WordPress, with no plugins, includes that call 13 times in different parts – presumably ones not used very frequently, otherwise you’d see this problem a lot.
P.S. For anyone else reading, obviously my suggestion to add a call to log() within the log() function itself was dumb, and was the cause of the site breaking when the extra logging code was added. Don’t go down that particular wormhole!
David
Looks like a known bug in PHP that’s been open for over 2 years…
https://bugs.php.net/bug.php?id=51425
You should pile into the bug report and offer to help get it nailed. They’ve closed it as not being in a current version, though people with current versions have since commented but omitted to re-open the bug. A very simple test case produces the error (see above, and in bug report), so if you follow it through it should get fixed.
I put in a fix so that people with this PHP bug should still be OK.
It would be good, however, if you can still deal with the PHP bug-tracker so that you can help them fix this bug once-and-for-all, so that nobody else has to deal with it in other projects in future.
David
Thanks for the updates David. I have tried the latest version 1.4.29 on both the site you looked at, and just recently on a new site (hosted on the same server) but the same issue exists on both – just one line in the log and that’s it. Tried normal backup and debug full backup, same thing!
This might sound naive, but how come the issue only affects some servers if the bug exists in PHP? Another thing both my sites have in common is themes from elegantthemes.com – I assume however you have other users successfully using your plugin with these themes?
It’s such a pity because I haven’t come across another backup plugin that seems as full-featured as this one.
Not sure exactly what I should do with the PHP tracker – what information do I need to post there?
Hi,
The extra code I put in caused the call that causes your PHP install to die to be bypassed if you had certain bits installed, but you must not have had those installed, so it still got called and still dies.
PHP is complex software, so has bugs. Just the same as UpdraftPlus does not fail and die for everyone, everywhere, but only for some, so it can happen for PHP too.
On the PHP bug tracker, create yourself an account. Create a new bug. Mention your PHP version, and say that the method_exists call with static parameters causes PHP to segfault. Point them to https://www.ads-software.com/support/topic/manual-debug-backups-wont-start-only-one-line-in-log?replies=14#post-3846008 as an example of the simplest possible test case that fails.
David
Hi
I had the same issue with one of hosting company PHP version there was 5.3.26 – But this issue was not there for my other hosting which ran PHP 5.3.20 – So definitely this is related to PHP versions..The issue was same – Clicking Backup does not do anything.. Also there were some javascript errors due to the fact that PHP broke in a certain part of the updraft code. (Given below) – After a long debugging, found that the issue is in the following lines of updraftplus/admin.php
if (version_compare(phpversion(), '5.2.0', '>=') && extension_loaded('zip')) { $ziparchive_exists .= __('Yes', 'updraftplus'); } else { $ziparchive_exists .= (method_exists('ZipArchive', 'addFile')) ? __('Yes', 'updraftplus') : __('No', 'updraftplus'); }
Since I could identify that updraftplus works even if ZipArchive::addFile is not there (may be using the native php zip), I just commented out that code and hardcoded ‘No’ to that variable (as follows
/*if (version_compare(phpversion(), '5.2.0', '>=') && extension_loaded('zip')) { $ziparchive_exists .= __('Yes', 'updraftplus'); } else { $ziparchive_exists .= (method_exists('ZipArchive', 'addFile')) ? __('Yes', 'updraftplus') : __('No', 'updraftplus'); }*/ $ziparchive_exists .= 'No';
Guess What! UpdraftPlus worked fine! (I haven’t yet tested the cloud backup – but the regular backup is working…
- The topic ‘Manual & debug backups won't start, only one line in log’ is closed to new replies.