OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to fix Gunicorn Timeout error in Django?

  • Thread starter Thread starter tthheemmaannii
  • Start date Start date
T

tthheemmaannii

Guest
My Django app uses gunicorn as server. It allows users to upload files. Recently I've been getting the following error with some file uploads:

Code:
  0%|          | 0/1121 [00:00<?, ?frames/s][2024-06-19 18:59:53 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:7)
  0%|          | 0/1121 [00:06<?, ?frames/s]
web-1  | [2024-06-19 13:59:53 -0500] [7] [INFO] Worker exiting (pid: 7)
web-1  | [2024-06-19 18:59:53 +0000] [1] [ERROR] Worker (pid:7) exited with code 1
web-1  | [2024-06-19 18:59:53 +0000] [1] [ERROR] Worker (pid:7) exited with code 1.
web-1  | [2024-06-19 18:59:53 +0000] [32] [INFO] Booting worker with pid: 32

Sometimes(even for the same file) I get the following error instead:

Code:
 [2024-06-18 08:56:09 -0500] [19] [INFO] Worker exiting (pid: 19)
web-1  | [2024-06-18 13:56:10 +0000] [1] [ERROR] Worker (pid:19) was sent SIGKILL! Perhaps out of memory?
web-1  | [2024-06-18 13:56:10 +0000] [34] [INFO] Booting worker with pid: 34
web-1  | /usr/local/lib/python3.11/site-packages/whisper/__init__.py:63: UserWarning: /root/.cache/whisper/tiny.pt exists, but the SHA256 checksum does not match; re-downloading the file
web-1  |   warnings.warn(
 78%|█████████████████████████████        | 56.6M/72.1M [00:24<00:05, 2.74MiB/s][2024-06-18 13:57:18 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:34)
 79%|█████████████████████████████        | 56.7M/72.1M [00:24<00:06, 2.42MiB/s]
web-1  | [2024-06-18 08:57:18 -0500] [34] [INFO] Worker exiting (pid: 34)
web-1  | [2024-06-18 13:57:19 +0000] [1] [ERROR] Worker (pid:34) exited with code 1
web-1  | [2024-06-18 13:57:19 +0000] [1] [ERROR] Worker (pid:34) exited with code 1.
web-1  | [2024-06-18 13:57:19 +0000] [45] [INFO] Booting worker with pid: 45

I only get this error sometimes, while other times I simply get internal server error even for the same files. I get the error for some small files but consistently for larger files. After troubleshooting I've realized that the error always occurs after 30 seconds which leads me to believe that it is due to Gunicorn timeout error. However I've read that simply increasing the timeout limit is only a band-aid solution. So now I am looking for alternatives. My app is run in a Docker container. The errors occur both during development and production. Currently I am trying to fix it locally in development.

The error occurs after the file is uploaded. My website transcribes the audio file to text then returns a text file to the user. The error occurs before the website can return the file. Note that the error only occurs for 1. long audio files(even if the file is small) and 2. seemingly arbitrary files. Even if the file is small and the audio length is short it will produce error after about 30 seconds.

Any suggestion is appreciated.
<p>My Django app uses gunicorn as server. It allows users to upload files. Recently I've been getting the following error with some file uploads:</p>
<pre><code> 0%| | 0/1121 [00:00<?, ?frames/s][2024-06-19 18:59:53 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:7)
0%| | 0/1121 [00:06<?, ?frames/s]
web-1 | [2024-06-19 13:59:53 -0500] [7] [INFO] Worker exiting (pid: 7)
web-1 | [2024-06-19 18:59:53 +0000] [1] [ERROR] Worker (pid:7) exited with code 1
web-1 | [2024-06-19 18:59:53 +0000] [1] [ERROR] Worker (pid:7) exited with code 1.
web-1 | [2024-06-19 18:59:53 +0000] [32] [INFO] Booting worker with pid: 32
</code></pre>
<p>Sometimes(even for the same file) I get the following error instead:</p>
<pre><code> [2024-06-18 08:56:09 -0500] [19] [INFO] Worker exiting (pid: 19)
web-1 | [2024-06-18 13:56:10 +0000] [1] [ERROR] Worker (pid:19) was sent SIGKILL! Perhaps out of memory?
web-1 | [2024-06-18 13:56:10 +0000] [34] [INFO] Booting worker with pid: 34
web-1 | /usr/local/lib/python3.11/site-packages/whisper/__init__.py:63: UserWarning: /root/.cache/whisper/tiny.pt exists, but the SHA256 checksum does not match; re-downloading the file
web-1 | warnings.warn(
78%|█████████████████████████████ | 56.6M/72.1M [00:24<00:05, 2.74MiB/s][2024-06-18 13:57:18 +0000] [1] [CRITICAL] WORKER TIMEOUT (pid:34)
79%|█████████████████████████████ | 56.7M/72.1M [00:24<00:06, 2.42MiB/s]
web-1 | [2024-06-18 08:57:18 -0500] [34] [INFO] Worker exiting (pid: 34)
web-1 | [2024-06-18 13:57:19 +0000] [1] [ERROR] Worker (pid:34) exited with code 1
web-1 | [2024-06-18 13:57:19 +0000] [1] [ERROR] Worker (pid:34) exited with code 1.
web-1 | [2024-06-18 13:57:19 +0000] [45] [INFO] Booting worker with pid: 45
</code></pre>
<p>I only get this error sometimes, while other times I simply get <code>internal server error</code> even for the same files. I get the error for some small files but consistently for larger files. After troubleshooting I've realized that the error always occurs after 30 seconds which leads me to believe that it is due to Gunicorn timeout error. However I've read that simply increasing the timeout limit is only a band-aid solution. So now I am looking for alternatives. My app is run in a Docker container. The errors occur both during development and production. Currently I am trying to fix it locally in development.</p>
<p>The error occurs after the file is uploaded. My website transcribes the audio file to text then returns a text file to the user. The error occurs before the website can return the file. Note that the error only occurs for 1. long audio files(even if the file is small) and 2. seemingly arbitrary files. Even if the file is small and the audio length is short it will produce error after about 30 seconds.</p>
<p>Any suggestion is appreciated.</p>
 

Latest posts

Top