Forums

Error code: 504-loadbalancer

I have problem access my website, it shows loadbalancer error?

Same, but it is a 502 not 504 for me.

I get the same 504 error. Entire app is unresponsive and unable to reload.

On a side note, how would you implement a custom error page so users don't see PA's default error page?

Now getting 502 Bad Gateway.

Got a message from Harry. All is back to normal and my site is live now.

Hi, I have the same problem right now. the error log doesnt show anything. Could u please fix this soon?

I get a 404 from your web app.

Just for clarity: a 504 error means that your web app is taking a long time to respond. The issue back on October 27, 2015 was a system issue that slowed everything down. It hasn't reoccurred recently, so the problem you saw on Match 24, 2017 may have been a problem with your code. Alternatively, maybe you were seeing a 404 ("page not found") error and it looked like a 504 for some reason?

Am receiving this error right now

the error log says

2020-07-28 12:34:20,192: OSError: write error

That is what happens when a client disconnects before the response has been sent to it. This can happen because your views are slow and your users stop the loading of a page or because there is a program accessing the site and the timeout on the client is shorter than the time it takes for the response to be sent.

Error code: 504-loadbalancer. My code takes long time above 1 hours to execute as its backend process is heavy. I want to keep the website active until the output is generated. Is there a way I can achieve this with a subscription or additional pay ?

Take a look at https://help.pythonanywhere.com/pages/AsyncInWebApps/

Something went wrong :-( Something went wrong while trying to load this site; please try again later.

Debugging tips If this is your site, and you just reloaded it, then the problem might simply be that it hasn't loaded up yet. Try refreshing this page and see if this message disappears.

If you keep getting this message, you should check your site's server and error logs for any messages. Im getting this error when im accessing website kindly assist

hi, my app doesnt open . "Error code: 504-loadbalancer "

any idea ?

and error.log "2024-09-05 14:08:44,616: OSError: write error"

server.log "2024-09-05 16:54:24 DAMN ! worker 2 (pid: 80) died, killed by signal 9 :( trying respawn ... 2024-09-05 16:54:24 Respawned uWSGI worker 2 (new pid: 92) 2024-09-05 16:54:24 spawned 2 offload threads for uWSGI worker 2 2024-09-05 16:54:46 Thu Sep 5 16:54:45 2024 - *** HARAKIRI ON WORKER 1 (pid: 86, try: 1) *** 2024-09-05 16:54:46 Thu Sep 5 16:54:45 2024 - HARAKIRI !!! worker 1 status !!! 2024-09-05 16:54:46 Thu Sep 5 16:54:45 2024 - HARAKIRI [core 0] 10.0.5.105 - GET / since 1725544184 2024-09-05 16:54:46 Thu Sep 5 16:54:45 2024 - HARAKIRI !!! end of worker 1 status !!! 2024-09-05 16:54:46 DAMN ! worker 1 (pid: 86) died, killed by signal 9 :( trying respawn ... 2024-09-05 16:54:46 Respawned uWSGI worker 1 (new pid: 98) 2024-09-05 16:54:46 spawned 2 offload threads for uWSGI worker 1"

Thanks for letting us know! It looks like after our system maintenance this morning, some SQLite databases were stuck in a "locked" state where processes would hang when they tried to access them. We just restarted the file locking service on the file server associated with your account, and your site is up and running now, so we think that was probably the cause of the issues you were seeing.

As an aside: we do strongly recommend against using SQLite for production websites. it's a great database for development environments and early-stage testing, but for anything customer-facing we'd recommend using MySQL or Postgres.

I got "Error code: 504-loadbalancer". Something went wrong :-( Something went wrong while trying to load this site; please try again later.

Debugging tips If this is your site, and you just reloaded it, then the problem might simply be that it hasn't loaded up yet. Try refreshing this page and see if this message disappears.

If you keep getting this message, you should check your site's server and error logs for any messages.

Error code: 504-loadbalancer Give a solution for this error please

What errors do you see at the bottom of your web app's error log?

there is no error show in the error log. But i got the "Error code: 504-loadbalancer" error.

A 504 error is a timeout; how long does it take before the error message appears? I would expect it to take a few minutes, and it would be an indication that your code is taking a long time to return a response.

i got this error in server log

2024-10-31 09:11:00 *** Starting uWSGI 2.0.20 (64bit) on [Thu Oct 31 09:10:44 2024] ***
2024-10-31 09:11:00 compiled with version: 9.4.0 on 22 July 2022 18:35:26
2024-10-31 09:11:00 os: Linux-6.5.0-1022-aws #22~22.04.1-Ubuntu SMP Fri Jun 14 16:31:00 UTC 2024
2024-10-31 09:11:00 nodename: blue-liveweb32
2024-10-31 09:11:00 machine: x86_64
2024-10-31 09:11:00 clock source: unix
2024-10-31 09:11:00 pcre jit disabled
2024-10-31 09:11:00 detected number of CPU cores: 4
2024-10-31 09:11:00 current working directory: /home/mubn000
2024-10-31 09:11:00 detected binary path: /usr/local/bin/uwsgi
2024-10-31 09:11:00 *** dumping internal routing table ***
2024-10-31 09:11:00 [rule: 0] subject: path_info regexp: \.svgz$ action: addheader:Content-Encoding:gzip
2024-10-31 09:11:00 *** end of the internal routing table ***
2024-10-31 09:11:00 chdir() to /home/mubn000/voting-app/e-votings-app/code
2024-10-31 09:11:00 your processes number limit is 1536
2024-10-31 09:11:00 your memory page size is 4096 bytes
2024-10-31 09:11:00 detected max file descriptor number: 123456
2024-10-31 09:11:00 building mime-types dictionary from file /etc/mime.types...
2024-10-31 09:11:00 567 entry found
2024-10-31 09:11:00 lock engine: pthread robust mutexes
2024-10-31 09:11:00 thunder lock: disabled (you can enable it with --thunder-lock)
2024-10-31 09:11:00 uwsgi socket 0 bound to UNIX address /var/sockets/mubn000.pythonanywhere.com/socket fd 3
2024-10-31 09:11:00 Python version: 3.10.5 (main, Jul 22 2022, 17:09:35) [GCC 9.4.0]
2024-10-31 09:11:00 PEP 405 virtualenv detected: /home/mubn000/voting-app/venv
2024-10-31 09:11:00 Set PythonHome to /home/mubn000/voting-app/venv
2024-10-31 09:11:00 *** Python threads support is disabled. You can enable it with --enable-threads ***
2024-10-31 09:11:00 Python main interpreter initialized at 0x5f4341d1fe70
2024-10-31 09:11:00 your server socket listen backlog is limited to 100 connections
2024-10-31 09:11:00 your mercy for graceful operations on workers is 60 seconds
2024-10-31 09:11:00 setting request body buffering size to 65536 bytes
2024-10-31 09:11:00 mapped 668512 bytes (652 KB) for 3 cores
2024-10-31 09:11:00 *** Operational MODE: preforking ***
2024-10-31 09:11:00 initialized 70 metrics
2024-10-31 09:11:00 WSGI app 0 (mountpoint='') ready in 16 seconds on interpreter 0x5f4341d1fe70 pid: 1 (default app)
2024-10-31 09:11:00 *** uWSGI is running in multiple interpreter mode ***
2024-10-31 09:11:00 gracefully (RE)spawned uWSGI master process (pid: 1)
2024-10-31 09:11:00 spawned uWSGI worker 1 (pid: 9, cores: 1)
2024-10-31 09:11:00 spawned 2 offload threads for uWSGI worker 1
2024-10-31 09:11:00 spawned uWSGI worker 2 (pid: 12, cores: 1)
2024-10-31 09:11:00 spawned 2 offload threads for uWSGI worker 2
2024-10-31 09:11:00 spawned uWSGI worker 3 (pid: 15, cores: 1)
2024-10-31 09:11:00 metrics collector thread started
2024-10-31 09:11:00 spawned 2 offload threads for uWSGI worker 3
2024-10-31 09:11:00 announcing my loyalty to the Emperor...

[edit by admin: formatting]

That's normally logging rather than an error -- it's just the web-hosting system starting up.

then why I get this error "Error code: 504-loadbalancer". I got this error after 5 mint of processing. On monday my external exam is schedule. Please help me to resolve this error. I got this error since one week. now I got this error again when i try to add upload a picture

Your best option is to add some print statements to the view function that is taking more than five minutes to run to find out where it is spending all of that time. If you add "from datetime import datetime" to the start of your code, you can add prints like this:

print(f"{datetime.now()}: about to do X", flush=True)

...to your code. These prints will be send to the website's server log, and by adding different prints at different places you should be able to track down what is running more slowly that you expect.