budgie

budgie

New LiveView internet deployment, no phx_reply is sent with endless phx_join messages sent

So I just got a new liveview deloyment, using Redis as the pubsub backend while I get cluster forming figured out. The first page render works fine, and there is a phx_join and phx_reply of rendered. After signing in with default phx.gen.auth behavior, I’m getting many phx_join messages sent but no phx_reply. Any idea why this might be?

Most Liked

al2o3cr

al2o3cr

Formatting that message helps make it understandable:

{
  :function_clause,
  [
    {
      WebSockAdapter.CowboyAdapter,
      :terminate,
      [
        {:crash, :error, :function_clause},
        %{
          port: 80,
          scheme: "http",
          version: :"HTTP/1.1",
          path: "/live/websocket",
          host: "app.domain.com",
          peer: {{0, 0, 0, 0, 0, 65535, 44063, 6462}, 37060},
          method: "GET",
          qs: "_csrf_token=FQJ-CHkAYWVEDy5BejkzQhItNCouEx43ERGNMF55sKcqWQQtzDehxJSP&_track_static%5B0%5D=https%3A%2F%2Fapp.domain.com%2Fassets%2Fapp-4d990432c83d65c7274ba6c2f26005e3.css%3Fvsn%3Dd&_track_static%5B1%5D=https%3A%2F%2Fapp.domain.com%2Fassets%2Fapp-a33e271c2b56bde39457fdd88e722922.js%3Fvsn%3Dd&_mounts=0&_live_referer=undefined&vsn=2.0.0"
        },
        {
          Phoenix.LiveView.Socket,
          %{},
          {
            %{channels: %{}, channels_inverse: %{}},
            %Phoenix.Socket{
              assigns: %{},
              channel: nil,
              channel_pid: nil,
              endpoint: AppWeb.Endpoint,
              handler: Phoenix.LiveView.Socket,
              id: "users_sessions:n66qO3JS6Pqw7v2Bcx6iwnQYTasR4SwhP8tDgaNs9cg=",
              joined: false,
              join_ref: nil,
              private: %{
                connect_info: %{
                  session: %{
                    "_csrf_token" => "PP9F4FTP7DM0-hb6hiQBVYMg",
                    "live_socket_id" => "users_sessions:n66qO3JS6Pqw7v2Bcx6iwnQYTasR4SwhP8tDgaNs9cg=",
                    "user_token" => <<159, 174, 170, 59, 114, 82, 232, 250, 176, 238, 253, 129, 115, 30, 162, 194, 116, 24, 77, 171, 17, 225, ...>>
                  }
                }
              },
              pubsub_server: [
                adapter: Phoenix.PubSub.Redis,
                name: App.PubSub,
                node_name: "node-0qw2do37A_U=",
                url: "redis://master.redacted.cache.amazonaws.com:6379",
                ssl: true
              ],
              ref: nil,
              serializer: Phoenix.Socket.V2.JSONSerializer,
              topic: nil,
              transport: :websocket,
              transport_pid: nil
            }
          }
        }
      ],
      [file: ~c"lib/websock_adapter/cowboy_adapter.ex", line: 52]
    },
    {:cowboy_websocket, :handler_call, 6, [file: ~c"/app/deps/cowboy/src/cowboy_websocket.erl", line: 564]},
    {:cowboy_http, :loop, 1, [file: ~c"/app/deps/cowboy/src/cowboy_http.erl", line: 253]},
    {:proc_lib, :init_p_do_apply, 3, [file: ~c"proc_lib.erl", line: 241]}
  ]
}

This tells us some things:

  • the ultimate cause of the exit was a function_clause error in lib/websock_adapter/cowboy_adapter.ex:52

  • This error happened because WebSockAdapter.CowboyAdapter.terminate/3 only expects 2-tuples in the final argument, but the caller passed a 3-tuple shaped like {Phoenix.LiveView.Socket, %{}, {%{channels: ...}, %Phoenix.Socket{}}}

    The first element of that tuple is a handler like the module expects.

    The third element is a {state, socket} pair like would be expected with Phoenix.Socket

    The second element is ???, and it’s going to be tricky to find where it came from

  • however, this isn’t the root cause - the process was trying to call terminate/3 because something else crashed with a function_clause_error. Any noises in the logs before the message you posted?

My suspicion is a cascading error like this:

  • something messed up the socket GenServer’s state from {handler, state} to {handler, what_the_heck, state}
  • that caused the next function call dispatched against that server to fail to match (the first function_clause_error)
  • that made the socket try to shut down, which then ALSO failed to match in terminate/3 (the second function_clause_error)

Where Next?

Popular in Questions Top

chokchit
** (DBConnection.ConnectionError) connection not available and request was dropped from queue after 2733ms. You can configure how long re...
New
New
Kurisu
For example for a current url like http://localhost:4000/cosmetic/products?_utf8=✓&amp;query=perfume&amp;page=2, I would like to get: ...
New
qwerescape
Is there a way to get the call stack or stack trace at any point in the code? Not from exceptions, but an expression that returns how the...
New
JulienCorb
I am trying to implement my new.html.eex file to create new posts on my website. new.html.eex: &lt;h1&gt;Create Post&lt;/h1&gt; &lt;%= ...
New
itssasanka
Hi all, Trying to get some more clarity over utc_datetime and naive_datetime for Ecto: The documentation above suggests that while ...
New
nobody
Hi! In PHP: $_SERVER[‘SERVER_ADDR’] - in Elixir? Searched the docs for ip address and the web, no good results. Thanks!
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
komlanvi
Hi everyone, I was playing with phoenix liveView but I run into an issue. I have a form and want to validate each input text when the te...
New
vonH
In asking this question I am more interested about the expressiveness of the language itself and less concerned about the availability of...
New

Other popular topics Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a &gt; b) do {:ok, "a"} end if (a &lt; b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
chrismccord
As promised, the first release candidate of Phoenix 1.3.0 is out! This release focuses on code generators with improved project structure...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
greenz1
I have a phoenix application from which a user can download multiple(5-6) files of size 1MB. I couldn’t find anything related to sending ...
New
belgoros
I’m not a pro in using Regex and can’t figure out why the following behaviour happens, especially if we take into account the difference ...
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New

Latest on Elixir Forum

Elixir Forum

We're in Beta

About us Mission Statement