pieterm

pieterm

Multiple uploads result in Cowboy exit

We have an upload form in our application that allows for multiple / simultaneous uploads by the user.
When the user drops file by file, everything works as expected. However, if he drops multiple files at once, some of them are uploaded successfully, others result in a Cowboy related error for each failed file upload.

Ranch listener AppWeb.Endpoint.HTTP had connection process started with :cowboy_clear:start_link/4 at #PID<0.4182.0> exit with reason: {:function_clause, [{ ....

Full error: https://gist.github.com/pierot/3a7fc1c6ecbae3c3ba82cb2b30c35251

I cannot reproduce this locally, at least not with the same error. Locally I sometimes get:

Ranch listener JustifiedWeb.Endpoint.HTTPS had connection process started with :cowboy_tls:start_link/4 at #PID<0.3052.0> exit with reason: {{:badmatch, :undefined},

On production we run the application in HTTP (not HTTPS) behind Cloudflare -> Traefik. Maybe this is related to the error somehow.

We have been searching for the cause, without any luck.

Marked As Solved

jeroenbourgois

jeroenbourgois

Update on our side: we seemed to have fixed it… After some testing on my local machine I noticed a myxql related error, connection that went away.

It seemed that when dropping a lot of small files simultaneously the client side plugin (dropzone.js) was very eager to send all of those requests to the server – which was fine – but that resulted in a lot of simultaneous calls to the database, at almost exactly the same time.

We hit the db because we need a related resource in order to know where to put the file. Instead of doing it per request, we now fetch that resource once up front and then per file we just pass in the fetched resource, resulting in 1 query altogether instead of n-queries (n = amount of files).

But, we remain interested how the initial error we had relates to this error, and how there was no trace of the db call failing in the ‘process tree’ or what not. I just spotted it by accident on my local machine. Would love to learn how we should have gone about tackling this.

Where Next?

Popular in Questions Top

lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
New
LegitStack
I’m trying to make a websocket server in Phoenix or raw Elixir. I heard about gun, I think I could use cowboy, but since I’m not that sma...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New

Other popular topics Top

JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1140 51847 244
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
malloryerik
Hi, this is for people who, like me, have had some friction using .html.heex templates in VSCode. The solution seems to be, in a hyphena...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
beno
I will often find my self writing things similar to: case some_value do nil -&gt; something() "" -&gt; something() _ -&gt; someth...
New
AstonJ
We’ve put together this wiki for Phoenix LiveView - please feel free to add any info you feel is worth including. What is Phoenix LiveV...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New
vrod
I am using the Starship cross-shell prompt – it seems pretty nice, but I get some errors: [WARN] - (starship::utils): Executing command ...
New

We're in Beta

About us Mission Statement