Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SIGPIPE writing to a closed pipe error in an EBS Docker app

I have an inexplicable error when running a docker container in EBS vs locally. The container runs a naked uWSGI process that loads an app that runs long-running (over 5 seconds) requests. The docker container runs fine locally; and the entire code path runs fine on the EBS host when run through ssh on the box (by submitting requests programmatically to entry function, that emulates the POST parameters from the client). But when the code path is called over http via an API route, it errors out with:

Fri May  7 03:01:40 2021 - SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request /preview-map (ip 172.17.0.1) !!!
2021-05-07 03:01:40] log_exception 1761 - Exception on /preview-map [POST]
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
   ...
  File "./scene.py", line 135, in scenePreview
    quality=10)  # quality=1 => no shadow/reflection, quality=10 is 'normal'
  File "/usr/local/lib/python3.7/site-packages/vapory/vapory.py", line 102, in render
    quality, antialiasing, remove_temp)
  File "/usr/local/lib/python3.7/site-packages/vapory/io.py", line 114, in render_povstring
    raise IOError("POVRay rendering failed with the following error: "+err)
TypeError: can only concatenate str (not "bytes") to str

I debugged for hours, assuming that the error is about the stack trace: POVRay (a 3D scene rendering engine abstracted in Python by the vapory library), but I can run the POVRay function on the EBS docker container no problem.

Is it possible that my uWSGI process in EBS is closing my connection after 3 seconds and this break in the code is just a co-incidence? It's docker, so there really can't be any difference between my local and remote environments other than something EBS is doing to close connections prematurely.

I am stumped. Any idea how to debug this further?

like image 949
metalaureate Avatar asked May 07 '21 03:05

metalaureate


1 Answers

Same solution as here: Fixing broken pipe error in uWSGI with Python

Increase uWSGI timeouts.

ENV UWSGI_CONNECT_TIMEOUT=2400 UWSGI_READ_TIMEOUT=2400 UWSGI_SEND_TIMEOUT=2400
like image 164
metalaureate Avatar answered Oct 21 '22 20:10

metalaureate