Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

489
Views
¿Es posible obtener un seguimiento de la pila cuando un trabajador de gunicorn alcanza un tiempo de espera?

Específicamente, estoy ejecutando una aplicación Flask con trabajadores predeterminados en gunicorn. Estoy tratando de descubrir cómo depurar / rastrear lo que sucede cuando un trabajador muere debido al tiempo de espera mientras atiende una solicitud. ¿Hay alguna manera de obtener un seguimiento de la pila o perfilar la solicitud para depurar esto?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Solo quería agregar a la respuesta aceptada que también hay otra forma de obtener resultados similares mediante el controlador de fallas del módulo Python 3 faulthandler presentado en v3.3 https://docs.python.org/dev/library/faulthandler. html

Puede agregar las siguientes dos líneas a wsgi.py mencionadas en la respuesta aceptada:

 import faulthandler faulthandler.enable()

Cuando se agote el tiempo de espera, se imprimirá el siguiente resultado en stderr:

 [2020-12-24 13:38:32 +0000] [31304] [INFO] Starting gunicorn 20.0.4 [2020-12-24 13:38:32 +0000] [31304] [INFO] Listening at: http://0.0.0.0:8888 (31304) [2020-12-24 13:38:32 +0000] [31304] [INFO] Using worker: sync [2020-12-24 13:38:32 +0000] [31307] [INFO] Booting worker with pid: 31307 [2020-12-24 13:38:55 +0000] [31304] [CRITICAL] WORKER TIMEOUT (pid:31307) Fatal Python error: Aborted Current thread 0x00007f411d781700 (most recent call first): File "/tmp/app.py", line 14 in c File "/tmp/app.py", line 9 in b File "/tmp/app.py", line 6 in a File "/tmp/app.py", line 20 in catch_all File "/tmp/venv/lib/python3.5/site-packages/flask/app.py", line 1936 in dispatch_request File "/tmp/venv/lib/python3.5/site-packages/flask/app.py", line 1950 in full_dispatch_request File "/tmp/venv/lib/python3.5/site-packages/flask/app.py", line 2447 in wsgi_app File "/tmp/venv/lib/python3.5/site-packages/flask/app.py", line 2464 in __call__ File "/tmp/venv/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 175 in handle_request File "/tmp/venv/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 134 in handle File "/tmp/venv/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 29 in accept File "/tmp/venv/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 67 in run_for_one File "/tmp/venv/lib/python3.5/site-packages/gunicorn/workers/sync.py", line 123 in run File "/tmp/venv/lib/python3.5/site-packages/gunicorn/workers/base.py", line 140 in init_process File "/tmp/venv/lib/python3.5/site-packages/gunicorn/arbiter.py", line 583 in spawn_worker File "/tmp/venv/lib/python3.5/site-packages/gunicorn/arbiter.py", line 616 in spawn_workers File "/tmp/venv/lib/python3.5/site-packages/gunicorn/arbiter.py", line 545 in manage_workers File "/tmp/venv/lib/python3.5/site-packages/gunicorn/arbiter.py", line 202 in run File "/tmp/venv/lib/python3.5/site-packages/gunicorn/app/base.py", line 72 in run File "/tmp/venv/lib/python3.5/site-packages/gunicorn/app/base.py", line 228 in run File "/tmp/venv/lib/python3.5/site-packages/gunicorn/app/wsgiapp.py", line 58 in run File "/tmp/venv/bin/gunicorn", line 8 in <module> [2020-12-24 13:38:55 +0000] [31307] [INFO] Worker exiting (pid: 31307) [2020-12-24 13:38:55 +0000] [31503] [INFO] Booting worker with pid: 31503
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!