Forums

Can edit uwsgi config ?

Hello, I wanted to know if I could configure the uwsgi file of one of my app since I would like to increase the time in which the connection is finished, add these configurations

ignore-sigpipe = true ignore-write-errors = true disable-write-exception = true

Because one of my web app caused an error IOError: write error

No, you cannot edit the uwsgi config.

Hello, is it still not possible to edit the uwsgi config?

I am experiencing the exact same issue the above user stated.

If this config cannot be changed. Would you recommend error handling and retry if it experiences OSError? My web app simply receives webhooks, performs calculations on the data, then sends a new webhook out.

No, it still can't be changed. How long is your app taking to perform the calculations it needs to do in response to the incoming webhooks?

How can I figure the time duration? %%timeit?

It seems the range of the time my app receives a webhook and sends the webhook out is 4-11 seconds.

An "OSError: write error" occurs not very often. When it does occur, I'm unsure on the time duration (as I didn't receive the outgoing webhook to verify time).

It is crucial to my app that this error does not occur at all. How can I fix it?

You need to add some logging to your code and track execution time in your logs. See https://help.pythonanywhere.com/pages/MySiteIsSlow/#adding-print-debugs-to-your-code

After adding logging to track execution time, I found out that my app actually takes 1-4 seconds from start of app (webhook received) to end of app (webhook sent out).

It seems completely random when the OSError occurs. At the end of my program, I send 2 webhooks to myself: The first is an info message, the second is a trade execution message. Sometimes when the OSError occurs, I will only receive the trade execution message and not the info message. And sometimes neither are received. An example of what the logs show for this error:

On server log:

SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /webhook (ip 10.0.0.66) !!!

uwsgi_response_writev_headers_and_body_do(): Broken pipe [core/writer.c line 306] during POST /webhook (10.0.0.66)

On error log:

OSError: write error

My run time seems very fast. The OSError seems to occur at the end of my app script. Could this maybe occur because I end my script with either "return 'success', 200" or "abort(400)"? I'm quite new to web app creation, so if there is a proper way to end the script please let me know.

If I understand correctly it looks like the client that connects to your endpoint is not very patient and disconnects before you return the response.

Well the thing is... I don't need to return any response to the client that connects. The client isn't a person, it's an incoming webhook (based on alerts) that delivers data to my app, so that my app can perform calculations on the data and send it all out via webhook elsewhere.

Is there a way to disregard/ignore the initial client so that I don't get OSError?? Or do you guys have any solution for the problem that I feel I've detailed very well in these past posts?

OSError is only a symptom of the situation when client disconnects so your web app can't send the response. If is causing some issues for your setup to work, you may check why the client disconnects prematurely. Otherwise you may probably ignore those entries in the logs.