Forums

receiving Error code: 504-loadbalancer

Hi Pythonanywhere,

today, 20-05-2019 my web app sometimes returns "Error code: 504-loadbalancer ". I think it's not my app's fault?

The 504 error is a timeout -- if a request takes more than a few minutes to process, our system will assume that your website has crashed and will restart the process that appears to have hung. When that happens, it will return a 504 error to the browser that triggered the request that took that long.

so solution cause you haven't given any

cause i have this problem and i don't where to start in rectifying

You need to find out what happens inside your web app. Add some debugging code that writes into log files to see what takes time and prevents response from coming in time.

Today this error happened to me, the same code worked good in development instance that without any error.

More over, Error log page itself is not opening.

Now , as i write the webpage started working. Am not sure what happened, how can i get the root cause of this black out ?

Looks like it was when we were experiencing a DDoS attempt on our side.

I have had this problem whenever I run a particular function on pymc3 which requires heavy math and stats, so 5 minutes certainly would not work. I am desperate now because my own Chrome doesn't work for my own web site. Please help.

@BaodongLiu Take a look at Async work in Web apps | PythonAnywhere help

I use web2py and in the controller has one function:

def kp(): import pymc3 as pm .....

and I have a html page written for this function.

How do I make sure that all users who go on to this web page and enter the data to run this function will not be timed out after 5 minutes?

The 5 minute limit is a hard limit that can't be changed; if you take a look at the page that @fjl linked to, it has some suggestions about how you can restructure things so that access to views takes less than five minutes, but you can process certain kinds of jobs asynchronously in the background. You would need to write code in order to do that, though.