Managed backups return a Gateway timeout error

I’m getting a “504 GATEWAY TIME-OUT nginx/1.15.5” error when trying to create a managed backup.

  • Kris

    Hi Edwin

    Hope you are doing good today.

    You last backup are very large, about 700 MB each.
    I fully review both all your chats related to this issue.
    In most cases timeout error is related to max_execution_time value which is very low in your case, only 150.

    Could you contact with you host to increase this value to at least 300 or higher?

    After you increase max_execution_time, please also add this code to your wp-config.php file:

    /* Snapshot Settings */
    define('SNAPSHOT_FILESET_CHUNK_SIZE', 50);
    define('SNAPSHOT_TABLESET_CHUNK_SIZE', 100);
    define('SNAPSHOT_FILESET_LARGE_FILE_SIZE', 104857600);
    define('SNAPSHOT_FILESET_USE_PRECACHE', true);
    define('SNAPSHOT_FORCE_ZIP_LIBRARY', 'pclzip');
    define('SNAPSHOT_ATTEMPT_SYSTEM_BACKUP', true);
    define('SNAPSHOT_IGNORE_SYMLINKS',true);
    /* End of Snapshot Settings */

    Those lines should be placed above the "/* That's all, stop editing! Happy blogging. */"

    and run managed backup again.

    Kind Regards,
    Kris

  • Kris

    Hi Edwin

    In this case we will need your additional data to take a closer look on this. Please send it through our secure contact form here https://premium.wpmudev.org/contact/#i-have-a-different-question and make sure that subject is "I have a different question" and:
    - Mark to my attention: ATTN: Krzysztof Tomczyk
    - Site access (username / password)
    - FTP credentials (host / username / password)
    - Link back to this thread

    Please confirm here in thread that you have sent that message.

    Kind Regards,
    Kris

  • Kris

    Hi Edwin

    Thank you for additional data. However ftp details you send us are incorrect. Can you double check you login and password and send us again via this guide here:
    https://premium.wpmudev.org/forums/topic/managed-backups-return-a-gateway-timeout-error#post-1350218

    Without this access I will be not able to check wordpress files and inverstigate this issue.

    thank you for your patience.

    Kind Regards,
    Kris

  • Kris

    Hi Edwin

    Thank you for all additional data.
    I made some investigation on site and server resources looks very good.

    I also made some test and simple backup of site works very good and quick. It takes about 5-7min to take network backup in Snapshot -> Snapshots. After some additional tests still Snapshot -> Managed Backup stuck at 0%.

    I flagged this issue for our SLS Team (code experts) so that they can dig into this issue further for you. We will post an update here as soon as more information is available.

    Please keep in mind that our SLS Team deals with more complicated issues, thus it may take a little longer for them to reply here. Thank you for your patience while we look into this further.

    Kind Regards,
    Kris

  • Leonidas

    Hello there Edwin ,

    after applying a patch in the form of an extra mini-plugin (named Snapshot Managed Backup Cooldown) in order to ease on the server's resources, we noticed that a scheduled backup was properly created and uploaded to the Hub(backup named full_backup-1541984984-full-664d738e.zip).

    However, our following tries to manually create a backup were unsuccessful. The manual backup is created properly but as soon as Snapshot tries to upload it in the Hub the 504 GATEWAY TIME-OUT message again shows up on the screen.

    That makes me think that there is a host-imposed timeout on ajax calls, on your site. I will continue to debug this, just wanted to let you know that scheduled backups seem to be created properly now.

    Best regards,
    Leonidas

  • Nithin

    Hi Edwin,

    Our developers were working on your website, and were running some test backups with the above mentioned patch, and we were able to notice improvements. However, during the troubleshooting process, we got logged out in the midway, and it seems like WP admin login shared for "wpmudev" user, is no longer working.

    Getting the following error:
    ERROR: The password you entered for the username wpmudev is incorrect.

    Could you please look into it, and share the correct login credentials, so that we could help get this resolve asap.

    You can send credentials by using our secure contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    - To Mark to my attention, the subject line should contain only: ATTN: Nithin Ramdas
    -WordPress admin username
    -WordPress admin password
    -link back to this thread for reference
    -any other relevant urls

    Have a nice day. :slight_smile:

    Kind Regards,
    Nithin

  • Konstantinos Xenos

    Hi Edwin ,

    I took a look again at the website but I see some issues that need attention first:
    1] I see that your Admin area within Snapshot is broken. Could you tell me if this happened recently or after installing a new plugin or so?
    2] I can't seem to be able to get any output to debug.log that is the normal process of WordPress to throw any errors out. Is there maybe a server-side cache or something that might be interfering here?
    3] Many plugins as well as WordPress itself have not been updated to their latest versions. It would be best to keep everything updated just to know that none are using any outdated code conflicting with each other.

    If we can resolve the above then I'll be able to continue and take a look at the Snapshot issue. Is there a possibility to tell me about Caching & if you can update everything to their latest versions?

    Regards,
    Konstantinos

  • Edwin

    Hi Konstantinos,

    I will try to help you with this to my best knowledge:
    First off:
    1] I see that your Admin area within Snapshot is broken. Could you tell me if this happened recently or after installing a new plugin or so?

    -This happened for some reason unknown to me a month or so ago.

    ----------------------------------------------------------------

    2] I can't seem to be able to get any output to debug.log that is the normal process of WordPress to throw any errors out. Is there maybe a server-side cache or something that might be interfering here?

    -We have had/ and still have some serious issue on this multisite with regard to caching.
    And to be honest, I am a bit lost in this as I had a guy doing some work for me on this multisite (and the VPS) and I am not sure anymore if the guy was as capable as I first thought.
    My biggest problem is that (and it has been a major issue during the development of revatis.eu (the mapped subdomain revatisstaging1.eqscience-south-africa.com)
    that it is near impossible to check your work on this network except when logged in (and using the Divi front-side editor.) otherwise the cache takes hours to update.

    I know that the VPS where this multisite is installed has Nginx installed and that seems to have some sort of a caching system.
    When I told "my guy" that we were experiencing this issue, he routed (i do not know how else to formulate it ) the site trough Cloudflare, saying that this would resolve the caching issue, because Cloudflare updates almost instantly (he said).
    When I reminded him that the server had Nginx and that I was worried that Cloudflare would only update when the server based Nginx caching system was updated he disagreed on that.
    I still have my doubts on this whole scenario though, and maybe this might be the part of your puzzle that is missing.

    -----------------------------------------------------------------------

    3] Many plugins as well as WordPress itself have not been updated to their latest versions. It would be best to keep everything updated just to know that none are using any outdated code conflicting with each other.

    I can assure you that I am VERY strict on my updates, but it's scary to update plugins/themes / WP CORE even, if you are not sure about the status of your backups.
    So yes, I will update EVERYTHING with pleasure if you can assist me in getting a secure backup of my network.
    I hope you understand my dilemma here.

    Looking forward to your soonest response

    Edwin

    • Konstantinos Xenos

      Okay, thank you for clarifying as well as it actually seems that there might be more issues than simply Snapshot not working and it might as well be connected to anything else.

      Lets first solve the backup/update process as that's a part to at least have everything on latest so we know that there are no conflicts etc.

      Since you have CPanel you can very easily create a backup, either a "soft" one by Exporting the database via phpMyAdmin and making a .zip of your public_html folder via File Manager, or a server-side backup via the Backup option of your Cpanel.

      When that backup is done you are surely safe to update anything in the website, since it's a server side backup there shouldn't really be any reason to not trust it, except if you don't trust the hosting system itself :slight_smile: .

      Tell me if you need any help with that.

      Regards,
      Konstantinos

  • Konstantinos Xenos

    Edwin ,

    Sorry for the late reply but I've just finished all the tests needed.

    If you see your Managed Backups you will find 1 successful and uploaded to our servers with todays date ( January 28, 2019 @ 8:28 am ). All your 'scheduled' and automated Managed Backups should be working fine, so please make sure that you have set a schedule for them.

    The issue seems to be a restriction from the server on the Timeout Directive ( http://httpd.apache.org/docs/2.4/mod/core.html#timeout ), so the admin-ajax calls tend to fail if more the time needed exceeds the servers limit and that's why you are not able to make an on demand Managed Backup ( by pressing the Run Now button as well ). The "Run Now" and "Retry Upload" use admin-ajax to handle everything and that's where the issue is since the server is limiting the calls.

    You'll have to contact your hosting provider with this information in case they could raise this limit.

    On a further note I see that you have also created daily & weekly Snapshots to run. These might be adding extra stress to the server if by chance they run "together" along with the Managed Backups process since they are 2 different processes run individually from one another.

    Tell us if the scheduled Managed Backups will give you any issues in the future so we can take another look.

    Regards,
    Konstantinos

  • Konstantinos Xenos

    Hi Edwin ,

    I've taken 1 backup yesterday and 1 extra backup today just for verification and everything worked as expected and both backups uploaded to our servers as well.

    I don't see any issues at all except that they are slow due to the size of the website. As I mentioned as well on my last reply if you have many local backups as well and they accidentally try to run together then the server might be getting really low on resources resulting to various issues.

    Tell me if you need any further help!

    Regards,
    Konstantinos

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.