scottmessinger

scottmessinger

Hi! After upgrading to Phoenix 1.7 (and cowboy 2.9 to 2.10), we’re seeing a bunch of odd errors from Cowboy. We haven’t noticed any user facing errors, so I’m quite confused.

The stated error is:

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

But that doesn’t appear very helpful. Any ideas what’s going on? Has anyone else seen this?

Here's the full error:
Ranch listener AppWeb.Endpoint.HTTP had connection process started with
:cowboy_clear:start_link/4 at #PID<0.8556.164> exit with reason:
{:function_clause, [{:cowboy_http, :commands, [{:state, #PID<0.5243.0>,
AppWeb.Endpoint.HTTP, #Port<0.552217>, :ranch_tcp, :undefined, %{compress:
true, env: %{dispatch: [{:_, [], [{:_, [], Plug.Cowboy.Handler,
{AppWeb.Endpoint, []}}]}]}, idle_timeout: 70000, max_header_value_length:
50000, max_keepalive: 5000000, stream_handlers: [:cowboy_compress_h,
:cowboy_telemetry_h, :cowboy_stream_h]}, "", %{}, {{10, 0, 1, 207}, 10480},
{{<snip>, 17, 0, 3}, 4000}, :undefined,
#Reference<0.1990757299.4122214401.120008>, true, 13, {:ps_request_line, 0},
65535, 12, :done, 5000000, [{:stream, 12, {:cowboy_compress_h, {:state,
{:cowboy_telemetry_h, {:state, {:cowboy_stream_h, {:state, :undefined,
AppWeb.Endpoint.HTTP, #PID<0.3209.164>, :undefined, :undefined, :undefined,
:undefined, ...}}, #Function<0.39451584/1 in
:cowboy_telemetry_h.metrics_callback>, :undefined, %{body_length: 0, cert:
:undefined, has_body: false, headers: %{"accept" => "*/*", "accept-encoding"
=> "gzip, deflate, br, zstd", "accept-language" => "en-US,en;q=0.9", ...},
host: "www.commoncurriculum.com", method: "GET", path:
"<snip>",
...}, "200 OK", %{"Connection" => "keep-alive",
"access-control-allow-credentials" => "true", "access-control-allow-origin" =>
"*", "access-control-expose-headers" => "", "cache-control" => "max-age=0,
private, must-revalidate", ...}, AppWeb.Endpoint.HTTP, -576097733072733623,
:undefined, :undefined, :undefined, ...}}, 300, :gzip, :undefined, :sync}},
"GET", :"HTTP/1.1", :undefined, :undefined, 0, []}], [{:child,
#PID<0.3209.164>, 12, 5000, :undefined}]}, 12, [{:response, "200 OK",
%{"Connection" => "keep-alive", "access-control-allow-credentials" => "true",
"access-control-allow-origin" => "*", "access-control-expose-headers" => "",
"cache-control" => "max-age=0, private, must-revalidate", "content-encoding"
=> "gzip", "content-length" => "1379", "content-type" => "application/json;
charset=utf-8", "date" => "Tue, 27 Feb 2024 06:21:44 GMT", "server" =>
"Cowboy", "vary" => "accept-encoding", "x-request-id" =>
"<snip>"}, [[<<31, 139, 8, 0, 0, 0, 0, 0, 0, 3>>], <<237, 152,
109, 111, 163, 70, 16, 199, 191, 74, 197, 219, 218, 167, 93, 88, 48, 248, 93,
122, 74, 37, 75, 105, 175, 106, 210, 158, 170, 83, 84, 237, 195, 16,
...>>]}]], [file: ~c"/app/deps/cowboy/src/cowboy_http.erl", line: 957]},
{:cowboy_http, :loop, 1, [file: ~c"/app/deps/cowboy/src/cowboy_http.erl",
line: 257]}, {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line:
240]}]}

Showing Posts 1 to 3

al2o3cr

al2o3cr

The error is complaining that no head of :cowboy_http.commands matches the input:

  • a state record with out_state set to :done
  • a stream ID of 12
  • a list of commands:
    [
      {:response, "200 OK", %{"Connection" => "keep-alive", ...}, <<...>>}
    ]
    

This appears to be caused by a late response from the handler - the head that handles response commands matches on out_state being :wait, so it doesn’t match:

scottmessinger

scottmessinger OP

Thank you @al2o3cr ! That’s very insightful. Any idea what could be causing this? Is it related t Phoenix or something we might be doing in our app?

scottmessinger

scottmessinger OP

Just wanted to followup and say my problem is I was calling render two times in the controller (result of a bad merge):

— All posts loaded —

Where Next? Top

Trending in Questions Top

katta
I having some trouble figuring out if I have set myself too strict of standards for my production server. Currently I can handle 75% of r...
New
peck
Hi everyone. My team and I have been working on a fairly modest app based around video streaming and chat, but we’ve landed a customer t...
New
achenet
Hello, I’m trying to build a basic Phoenix web-app, and I’d like to use Tailwind. However, when I launch mix phx.server, I get an error...
New
bradley
I really like the adapter patterns that ecto, nebulex, waffle, etc. use and would love find something similar for a key management servic...
New
unaware8150
Hello folks! So at work, we are seeing some situations where we have to define some “fixed” strings that are used across the codebase in...
New
Cxx-mlr
I’m working on a small exercise involving update_in/3, and I came up with this solution: data = %{ name: "Periodic Table", category:...
New
Alvinkariuki
How Can I Optimise Compile Time Dependencies I have been building an elixir application for about 2 years now. Many modules and files ha...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
budgie
A little off-topic, but I feel like people here have a good head on their shoulders. I used to be quite good at making software. Was luc...
New
KristerV
Hey. Is there anyone here who creates agents in their apps? Not talking about using agents, but creating them. I’m finding it pretty diff...
New
mudasobwa
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
juhalehtonen
There has been a thread to discuss the Stack Overflow Developer Survey on this forum every year since 2018, so here’s yet another one for...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews