Forums

Error - backend?

I am currently on the free plan.

I am trying to run some Gensim code with a large amount of text.

Locally, when testing the same Flask code, the gensim method code works fine. Yet, when running on PA, I get this error

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: 502-backend

Looking at the errorlogs isn't helpful since the method being called isn't listed there and there are no obvious or helpful errors.

So, do I need to upgrade my account in some way and if so, in what way?

How do I figure this out?

Thanks!

We have a help page on debugging 502 errors here: https://help.pythonanywhere.com/pages/502BadGateway/

None of the suggestions on this page seem to address the issue.

The issue appears to be the size of the input and the error that happens all by itself. Smaller Requests work OK.

How can I determine the right size server or CPU cycles needed?

If it's the size of the request, then that is not something that an upgrade will change. Are you POSTing more then 100M?

No, it's not that large a Request.

In fact, thinking ahead to just this question, I just did a test where I did the POST and returned the text I POSTed. That worked fine, no errors. Thus, the problem is apparently the Gensim code slogging though the data.

What's the approach to fix this?

Thanks,

I did just get this email, so maybe I'm up against needing to spend at least $150/month (to start, I guess)?


RAM limits

Because system RAM is one of the most scarce resources on the PythonAnywhere servers, we limit your processes to a maximum in-memory size of 3GB. This is a per-process limit, not a system-wide one, so if you have larger memory needs, you may be able to do the processing you need by running multiple smaller processes.

If you find you definitely need more RAM than this, one option is a private server inside the PythonAnywhere cluster. However, this is expensive -- the cheapest option right now is $150 per month.

If a process goes over the memory limit, it will be killed. You will normally get an email about this, unless you have previously unsubscribed from our tarpit emails, or from all communications from us.

Yes, if you are getting emails about your processes being terminated for memory use, then that is the issue.

OK, I didn't anticipate this problem starting at $150/month and possibly even more.

I suppose we should set up an NGINX server so we have control and it's not a shared environment.

Thanks Glenn for all your kind replies. :)