Announcement

Collapse
No announcement yet.

504 Gateway Time-out

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    504 Gateway Time-out

    Any ideas why this happens to certain pages? It was working earlier this afternoon. I tried accessing said page just now and I'm unable to and getting this error: 504 Gateway Time-out



    #2
    The only reason that should occur is if the page in question is attempting to do something that takes an extremely long amount of time (60+ seconds) and has still not returned a valid response. This can occur when a coding error has been made in a page template, resulting in an infinite loop, but if it began without changes, that sometimes indicates the page in question is calling out to some third party service that has become unavailable. For example, if a store's pages are calling to a shipping gateway on every page request, this is not only bad for performance, but if the shipping gateway is down, it can cause pages to hang. It would probably need debugging on the affected pages.
    David Hubbard
    CIO
    Miva
    [email protected]
    http://www.miva.com

    Comment


      #3
      Originally posted by ILoveHostasaurus View Post
      The only reason that should occur is if the page in question is attempting to do something that takes an extremely long amount of time (60+ seconds) and has still not returned a valid response. This can occur when a coding error has been made in a page template, resulting in an infinite loop, but if it began without changes, that sometimes indicates the page in question is calling out to some third party service that has become unavailable. For example, if a store's pages are calling to a shipping gateway on every page request, this is not only bad for performance, but if the shipping gateway is down, it can cause pages to hang. It would probably need debugging on the affected pages.
      It can also happen when using a cloud service such as Cloudflare - but they have their own page for it (so you would know if it's them).
      Leslie Kirk
      Miva Certified Developer
      Miva Merchant Specialist since 1997
      Previously of Webs Your Way
      (aka Leslie Nord leslienord)

      Email me: [email protected]
      www.lesliekirk.com

      Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

      Comment


        #4
        You should never see that from Cloudflare unless there is some underlying issue with the store in question, because by the time you see that, it's been 60+ seconds, which indicates a problem.
        David Hubbard
        CIO
        Miva
        [email protected]
        http://www.miva.com

        Comment


          #5
          Thank you for the responses. Today the page in question loaded. And just now, I got a 504 again. Quite odd. Just wondering if there is a Miva Templating Language validator akin to https://jsonlint.com/?

          Comment


            #6
            Originally posted by lesliekirk View Post

            It can also happen when using a cloud service such as Cloudflare - but they have their own page for it (so you would know if it's them).
            LOL, this just happened (while trying to delete expired baskets) Sorry, just had to share

            AMX8QL.png
            Leslie Kirk
            Miva Certified Developer
            Miva Merchant Specialist since 1997
            Previously of Webs Your Way
            (aka Leslie Nord leslienord)

            Email me: [email protected]
            www.lesliekirk.com

            Follow me: Twitter | Facebook | FourSquare | Pinterest | Flickr

            Comment


              #7
              Originally posted by pipette-dave View Post
              Thank you for the responses. Today the page in question loaded. And just now, I got a 504 again. Quite odd. Just wondering if there is a Miva Templating Language validator akin to https://jsonlint.com/?
              I'd recommend a support request explaining the timeout occurring on the CF side and the page in question; it may be something obvious our staff can pick out. Merchant should error if you add template code that is invalid from a syntax perspective.
              David Hubbard
              CIO
              Miva
              [email protected]
              http://www.miva.com

              Comment


                #8
                Originally posted by lesliekirk View Post

                LOL, this just happened (while trying to delete expired baskets) Sorry, just had to share
                That will occur for any request going through Cloudflare that hits the 65 second mark. If that is occurring while deleting baskets, you'll need to either have our support purge them, or keep attempting. That is a sign that the store in question is not having them removed regularly, but may also not have deferred baskets enabled (highly advisable for performance reasons), or has it enabled but is doing something like storing data in custom basket fields for all shoppers, negating the benefit and creating a basket for every single shopper (very bad for performance).
                David Hubbard
                CIO
                Miva
                [email protected]
                http://www.miva.com

                Comment


                  #9
                  We had that problem of 504 Gateway Time-out over the weekend (4 different computers, 2 different operating systems and also mobile devices) and the store was down for who knows how long... Sometimes things worked sort of but only sometimes.

                  Contacted Support and after a bit they decided to Pack Data Files and then things started working.

                  That solution didn't really make sense to me but "sometimes the databases get too big or have some corruption...".

                  Then I checked out our Scheduled Tasks because we had a task set up to pack data file every 7 days - and the Task was missing so I tried to add it back but packing data files is not offered as a task operation and I know it used to be there.

                  Contacted Support again and am informed that that option was removed in Miva 10 "because it was causing issues when ran taking some sites down in the middle of the night". Suggested to put a topic in Dream Features to get what was once a nice feature that was removed to be put back in.

                  So instead of finding and fixing the problem of packing data files with a task, Miva just removes the option.

                  Now somebody needs to be sure to manually pack data files once in a while.

                  If I see the 504 error again I will see if packing data files fixes it.

                  Comment


                    #10
                    The pack data files is not a feature that will be put back into scheduled tasks. That procedure performs different operations depending on the type of underlying database a particular store is using, due to the fact that the Miva Merchant software supports multiple database types. The functions it performs on the most common database configurations are not safe to run unattended, which is why it was removed. The two specific problems are:
                    • Stores with significant traffic, or extremely large record counts in tables normal shopper traffic interact with, should only have this run while the store is in maintenance mode because the optimization will potentially lock the table(s) in question while their indexes are rebuilt by the underlying database system, resulting in the appearance of a non-responsive site, and ultimately a gateway timeout.
                    • On certain underlying table and index types, there may be corruption that MySQL/MariaDB has allowed to occur, without realizing it. When the table/index optimization is performed, there are scenarios where this reveals the problem to the DBMS and it marks the table in question offline, taking the store offline with a fatal error until a manual repair is run. If this is done as an automated task, the store will remain offline until a human intervenes; if it is done by a human, it will be realized immediately, allowing a repair to be made immediately.
                    A staff member putting a store in maintenance mode and running pack data files should be made part of normal business processes; it doesn't need to be frequent, even monthly is fine for most stores.

                    If a pack data files operation corrected an issue, there was an underlying database problem; I'd need to know the ticket/site/specifics to advise further.
                    Last edited by ILoveHostasaurus; 03-25-21, 04:53 AM.
                    David Hubbard
                    CIO
                    Miva
                    [email protected]
                    http://www.miva.com

                    Comment


                      #11
                      Thank you for all the input and information.

                      I'm not sure how helpful this might be, but I narrowed the error down to only a couple of pages and redid the content. Meaning, I copied the code from my Sublime Text file, pasted it into new page templates in admin. I deleted the old versions and now the pages loaded as they should. Perhaps there were code errors, or maybe the file became corrupted somehow? I don't know for sure. I do know that the two pages in question load properly now.

                      Comment

                      Working...
                      X