Forums

Error code: 504-loadbalancer

I am getting this error while loading my website (web2py) In order to rectify it, I went on removing everything related to web2py ( the site was experimental anyway - so I have not lost much )

I regenerated a new website using web2py. I an still getting this error.

The problem must be on the pythonanywhere side.

Have you reloaded your site?

Also: try creating a new Web project - maybe Flask - and see if that works

You can get that error if your web app takes too long to respond to a request. Check that each request takes less than 5 min.

I tried reloading. It failled. Then I deleted web2py project website. Also removed the files. Generated a flask project. It loads properly. The I deleted the flask website. Generated web2py project. It does not load.at all. Error is still the same. Looks like I have changed something else outside the web2py directory which must be causing this problem

I also tried this one. Deleted the web2py website, then generated a pythonanywhere hosted website manually. It loads well. Then deleted it once again and generated web2py website once again. This time the error changed to 502-backend. I also tried opening a bash shell and gave this command

python /var/www/sanjivdurve_pythonanywhere_com_wsgi.py

The command worked well, showed no error and returned to $ prompt instantly. Reloaded the website. It gave error 502-backend. I have been using python 2.7 all along. Could that be the reason ?

Doesnt web2py prompt any error?, Even if the admin panel is disabled you can go to your's application error folder and delete all the files there, then reproduce the error by browsing your site and an error ticket will be created. (if it is a web2py error)

You can read this ticket using a bash shell by typing "cat + Tab" to autocomplete the ticket's name. It isnt as pretty as viewing it as a web page but at least you would be able to read the traceback and figure whats failing.

Web2py does not prompt any error. Let me summarize once again to avoid confusion.

I tried deleting the website altogether along with any files including the web2py directory which gets created by default when you set up a new web2py project.

I created a new flask project.--- The site loads well as expected.

I deleted it and created a project using manual option ---- The site loads well as expected.

I deleted it and tried to create web2py project. It gives me a message - "All done! Your web app is now set up. Details below."

Then I clicked the reload button and the message is -- "Your webapp took a long time to reload. It probably reloaded, but we were unable to check it."

Now when I rightclick the link "sanjivdurve.pythonanywhere.com" and click on open the link in new tab, it takes a long time and gives message "something went wrong ....Error code: 504-loadbalancer"

What is interesting is that I could load my site with web2py without any problem till afternoon. It was only after I messed up my application code that I decided to delete the whole site alongwith my application code and started all over again that I had this problem. By the way, I am not even close to getting a ticket because the site does not even load.

Hmm, odd. You're deleting the web2py directory, so that should clear everything down... and, if I understand you correctly, you're getting the 504 before you try to add any apps to web2py -- am I right in thinking that?

I took a look at your server log (linked from the "Web" tab) and it looks like the website is exiting and our systems are trying to restart it, only to see it exit again:

2016-02-15 12:00:29 DAMN ! worker 1 (pid: 5484) MISTERIOUSLY killed by signal 6 :( trying respawn ...
2016-02-15 12:00:29 Respawned uWSGI worker 1 (new pid: 5485)
2016-02-15 12:00:29 Tcl_InitNotifier: unable to start notifier thread
2016-02-15 12:00:29 
2016-02-15 12:00:32 DAMN ! worker 1 (pid: 5485) MISTERIOUSLY killed by signal 6 :( trying respawn ...
2016-02-15 12:00:32 worker respawning too fast !!! i have to sleep a bit (2 seconds)...
2016-02-15 12:00:32 Respawned uWSGI worker 1 (new pid: 5486)
2016-02-15 12:00:32 Tcl_InitNotifier: unable to start notifier thread

...but, if you're clearing everything down, I can't think of why that might be. Unless, have you installed any Python packages using pip install --user? Or perhaps you're using a virtualenv? Maybe there's some kind of incompatibility between web2py and something you've installed?

Yes you are right. I am getting 504 before I can add any apps in web2py.

I remember to have tried installing some packages in virtualenv which I shall try and remove tonight (but python was certainly not one of them). I have installed pandas 0.17.1 (which includes numpy) using pip27 install --user but the site was loading normally with that. The problem only started when I created a test.py file in "modules" folder and was trying to call test.ip() function (as given in web2py manual) in my index function in my web2py app. I deleted the website because it was not responding when test.ip() was being called. After that I could never load it again.

It is also interesting that if I create a flask project, it asks gives me a choice of python version whereas if I install web2py it defaults to 2.7.

I shall get rid of my virtualenv because I do not even remember whether I have anything there which is important. After that, my folders will be almost same as day 1.

Thanks for your efforts.

Hmm, that's interesting. If, once you'd added the test.ip(), it had hung and then you'd not been able to get a web app running whatever you did, then I would suspect that was the cause -- we occasionally see a problem where a web app can block and refuse to reload properly if it hangs completely. But if that had been the case, then you wouldn't have been able to see your Flask app once you'd deleted and replaced the web2py one either -- the problem continues even if you delete the web app.

The problem won't be with your virtualenv, unless you specifically tell the web app to use that particular virtualenv on the "Web" tab. But it could conceivably be something you installed outside the virtualenv with the --user flag on pip; take a look in the .local subdirectory of your home directory to see if there's anything else there (perhaps some weird dependency of pandas?)

Uninstalled pandas and six from .local/lib/site-packages. Also removed the contents of site-packages.

Deleted web2py site and created once again. Problem is still the same.

Removed all the leftover files in .virtualenv as well as .virtualenv. folder(it gets created automatically when I open a bash shell)

Deleted web2py site and created once again. Problem is still the same.

Now my machine is almost the same as day 1. Problem remains.

I suspect some process is running in the background and it needs to be killed by the root. ps -ef command does not work with my rights. it says do this mount -t proc proc /proc and when I do that it says only root can do that.

BTW the server log shows the process running, terminating and starting a new process every 2 seconds since 11:10 on 15/02 even when I am not even online. There must be a process on the server from which the first one has originated which needs to be killed.

I've taken a look and I'm totally baffled by this to be honest.

Can I suggest signing up for a new pythonanywhere account, and seeing if you can get it working there?

I'll keep trying to find out what's wrong with the old account...

Thanks Harry.

I have done that. I could set up web2py site instantly. It is working well. I shall continue to use the new account. I shall move my files to the new one tonight. I shall not use the old one unless you let me know otherwise.

I am also going to install pandas with pip2.7 --user under .local and see if everything continues to work normally.

Thanks for the efforts.

OK, well we're not sure what happened, but we manually rebuilt your sandbox in the old account, and we think it's working again now. Do you want to have a look around and check?