# File upload time-out

**URL:** <https://community.fly.io/t/file-upload-time-out/19337>\
**Category:** General\
**Tags:** django, login-only\
**Created:** [April 17, 2024, 12:26am UTC](https://community.fly.io/t/file-upload-time-out/19337 "2024-04-17T00:26:13Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![gapfranco](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/gapfranco/32/40967_2.png) [@gapfranco](https://community.fly.io/u/gapfranco)\
**Post date:** [April 17, 2024, 12:26am UTC](https://community.fly.io/t/file-upload-time-out/19337/1 "2024-04-17T00:26:13Z")

</div>

I’m trying to upload files in my django app on [fly.io](http://fly.io) but the the files are large and takes time I receive a time-out error. How can I handle this? Is Thera e procedure to upload large files in fly?

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [April 17, 2024, 1:04am UTC](https://community.fly.io/t/file-upload-time-out/19337/2 "2024-04-17T01:04:09Z")

</div>

I doubt there is generic advice that would apply. I have a Rails app deployed to [fly.io](http://fly.io) where a user uploaded a 164MB file successfully.

---

<div class="post-metadata">

**Author:** ![gapfranco](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/gapfranco/32/40967_2.png) [@gapfranco](https://community.fly.io/u/gapfranco)\
**Post date:** [April 17, 2024, 1:46am UTC](https://community.fly.io/t/file-upload-time-out/19337/3 "2024-04-17T01:46:28Z")

</div>

The problem is not the file size but the time it takes to upload. A bandwidth issue. It seems to have a 30s time-out.

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [April 17, 2024, 11:56am UTC](https://community.fly.io/t/file-upload-time-out/19337/4 "2024-04-17T11:56:22Z")

</div>

> [@60 second timeout for HTTP server](https://community.fly.io/t/60-second-timeout-for-http-server/1243/2):
>
> There is a 60 _idle_ timeout. If no data is received or sent within 60 seconds, the connection will be closed.

– [60 second timeout for HTTP server - #2 by jerome](https://community.fly.io/t/60-second-timeout-for-http-server/1243/2)

I suspect that the limit you are seeing is elsewhere. For example:

> **Command line:** `-t INT` or `--timeout INT`
> 
> **Default:** `30`
> 
> Workers silent for more than this many seconds are killed and restarted.
> 
> Value is a positive number or 0. Setting it to 0 has the effect of infinite timeouts by disabling timeouts for all workers entirely.

– [Settings — Gunicorn 22.0.0 documentation](https://docs.gunicorn.org/en/stable/settings.html#timeout)

---

<div class="post-metadata">

**Author:** ![gapfranco](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/gapfranco/32/40967_2.png) [@gapfranco](https://community.fly.io/u/gapfranco)\
**Post date:** [April 18, 2024, 1:13am UTC](https://community.fly.io/t/file-upload-time-out/19337/5 "2024-04-18T01:13:08Z")

</div>

The connection is broken after 30s during the file upload. When the file is smaller and takes less than 30s everything works.

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [April 18, 2024, 1:53am UTC](https://community.fly.io/t/file-upload-time-out/19337/6 "2024-04-18T01:53:41Z")

</div>

I just uploaded the file I mentioned previously, this time to a [fly.io](http://fly.io) server running in the iad region. It took 148.013 seconds to do so. The upload completed successfully.

My stack is nginx + passenger + rails + active storage. What is your stack?

---

<div class="post-metadata">

**Author:** ![gapfranco](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/gapfranco/32/40967_2.png) [@gapfranco](https://community.fly.io/u/gapfranco)\
**Post date:** [April 18, 2024, 1:28pm UTC](https://community.fly.io/t/file-upload-time-out/19337/7 "2024-04-18T13:28:56Z")

</div>

My stack is just Django + Gunicorn. Uploading to the file system.  
My app needs the file for processing and then it’s discarded, I don’t need to keep the file.  
But it never gets updloaded in full due to this problem.

---

<div class="post-metadata">

**Author:** ![rubys](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/rubys/32/16907_2.png) [@rubys](https://community.fly.io/u/rubys)\
**Post date:** [April 18, 2024, 1:32pm UTC](https://community.fly.io/t/file-upload-time-out/19337/8 "2024-04-18T13:32:04Z")

</div>

And Gunicorn defaults to a 30 second timeout. See the link to the documentation I provided above.

---

<div class="post-metadata">

**Author:** ![gapfranco](https://sea1.discourse-cdn.com/fly1/user_avatar/community.fly.io/gapfranco/32/40967_2.png) [@gapfranco](https://community.fly.io/u/gapfranco)\
**Post date:** [April 18, 2024, 3:09pm UTC](https://community.fly.io/t/file-upload-time-out/19337/9 "2024-04-18T15:09:02Z")

</div>

Yes. I tried to increase but it didn’t work. Perhaps I’ve missed sometring. I’ll try again.  
Thanks for the help.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/fly1/original/3X/6/e/6e8955d00cb218e186ebbe3a6ab06fefdce15290.svg) [@system](https://community.fly.io/u/system)\
**Post date:** [April 25, 2024, 3:09pm UTC](https://community.fly.io/t/file-upload-time-out/19337/10 "2024-04-25T15:09:53Z")

</div>

Closed on April 25, 2024, 3:09pm UTC

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.
