alg
Issues with running Phoenix 1.4 app
Hi guys,
I’m having some weird problems with running a Phoenix 1.4 app. I have never seen this before with Phoenix 1.3. Right after the app is built afresh I can start it with mix phx.server just fine. Then I do Ctrl-C + Ctrl-C to exit, and upon restart I will most likely get this:
→ mix phx.server
Compiling 24 files (.ex)
[info] Running MasterCoachWeb.Endpoint with cowboy 2.5.0 at http://localhost:4000
Webpack is watching the files…
[error] Ranch listener MasterCoachWeb.Endpoint.HTTP had connection process started with :cowboy_clear:start_link/4 at #PID<0.543.0> exit with reason: {:undef, [{:cowboy_http, :init, [#PID<0.440.0>, MasterCoachWeb.Endpoint.HTTP, #Port<0.44>, :ranch_tcp, %{env: %{dispatch: [{:_, [], [{:_, [], Phoenix.Endpoint.Cowboy2Handler, {MasterCoachWeb.Endpoint, []}}]}]}, stream_handlers: [Plug.Cowboy.Stream]}], []}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}
[error] Ranch listener MasterCoachWeb.Endpoint.HTTP had connection process started with :cowboy_clear:start_link/4 at #PID<0.544.0> exit with reason: {:undef, [{:cowboy_http, :init, [#PID<0.440.0>, MasterCoachWeb.Endpoint.HTTP, #Port<0.45>, :ranch_tcp, %{env: %{dispatch: [{:_, [], [{:_, [], Phoenix.Endpoint.Cowboy2Handler, {MasterCoachWeb.Endpoint, []}}]}]}, stream_handlers: [Plug.Cowboy.Stream]}], []}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}
[error] Ranch listener MasterCoachWeb.Endpoint.HTTP had connection process started with :cowboy_clear:start_link/4 at #PID<0.545.0> exit with reason: {:undef, [{:cowboy_http, :init, [#PID<0.440.0>, MasterCoachWeb.Endpoint.HTTP, #Port<0.46>, :ranch_tcp, %{env: %{dispatch: [{:_, [], [{:_, [], Phoenix.Endpoint.Cowboy2Handler, {MasterCoachWeb.Endpoint, []}}]}]}, stream_handlers: [Plug.Cowboy.Stream]}], []}, {:proc_lib, :init_p_do_apply, 3, [file: 'proc_lib.erl', line: 249]}]}
By trial and error, I found that it’s enough to remove compiled version of cowboy with $ rm -rf _build/dev/lib/cowboy to have another mix phx.server run the app successfully, but then on the next run I have to remove it again.
Any idea what this may be?
Most Liked
NobbZ
Your code does return conn only a single time, and it’s always the last one, it does render up to two times though, depending on the matches in the case.
alg
I just discovered that it triggers recompilation that ruins beam files for certain dependencies that in turn ruins the app and it won’t launch the next time with full deps recompilation.
Note that disabling this specific “elixir” linter won’t work. It still does this recompilation. Disabling whole ale plugin worked for me.
Give it a try and let me know.
mayulu
Has this be solved?
I had the same issue just now, and I updated Plug and Plug_Cowboy to the newest 1.7.1 and 2.0.1, issue still there.
And I found my code is the reason:
I return conn more than one time, something like the following:
def somefunc(conn, ...) do
case xxxx do
xx ->
render(conn, ....)
yy ->
render(conn, ... )
end
render(conn, ...)
end
Then I removed last render expression, it solved.
Hope it help.
Popular in Questions
Other popular topics
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #blog-post
- #graphql
- #genstage
- #ai
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-us
- #distillery
- #processes
- #forms
- #api
- #metaprogramming
- #security
- #performance









