clemensm

clemensm

Broadcast using LongPoll is failing

Hi there

I’m currently developing a small webapp using Phoenix to send mails to a bunch of contacts. In there I wanted to use a channel to update the send status (i.e. how many mails have already been sent etc). However when I gave this a try using only long polling, I get this error message every time I try to do a broadcast:

[error] GenServer #PID<0.660.0> terminating
** (FunctionClauseError) no function clause matching in Phoenix.Transports.LongPoll.Server.handle_info/2
    (phoenix) lib/phoenix/transports/long_poll_server.ex:75: Phoenix.Transports.LongPoll.Server.handle_info(%Phoenix.Socket.Broadcast{event: "progress", payload: %{all: 5, done: 1, pending: 4, progress: 20.0}, topic: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}, %{buffer: [], channels: %{"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d" => #PID<0.666.0>}, channels_inverse: %{#PID<0.666.0> => {"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", "1"}}, client_ref: {#PID<0.622.0>, #Reference<0.3659197968.2859466756.205729>}, last_client_poll: 1527437359083, priv_topic: "phx:lp:oRFiAZoBxO6vqxRk/SFVjA==1527437358904", pubsub_server: Daten.PubSub, serializer: Phoenix.Transports.V2.LongPollSerializer, socket: %Phoenix.Socket{assigns: %{current_user: %Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "user">, account: %Accounts.Account{__meta__: #Ecto.Schema.Metadata<:loaded, "account">, id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.451558Z>, updated_at: #DateTime<2018-05-25 10:42:28.451570Z>}, email: "c@m", id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.456345Z>, name: "clemens", updated_at: #DateTime<2018-05-25 10:42:28.456352Z>, user_password: %Accounts.UserPassword{__meta__: #Ecto.Schema.Metadata<:loaded, "user_password">, id: 2, inserted_at: #DateTime<2018-05-25 10:42:28.457810Z>, password: nil, password_hash: "$argon2i$v=19$m=65536,t=6,p=1$UG2SFHp/2G7mhq+lGXVmgw$AOjJEKsj14GCfjhOWS/pmXCkWqmTWYcSfnV7WGZCbAQ", updated_at: #DateTime<2018-05-25 10:42:28.457817Z>, user: #Ecto.Association.NotLoaded<association :user is not loaded>, user_id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}}}, channel: nil, channel_pid: nil, endpoint: DatenWeb.Endpoint, handler: DatenWeb.UserSocket, id: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", join_ref: nil, joined: false, private: %{}, pubsub_server: Daten.PubSub, ref: nil, serializer: Phoenix.Transports.V2.LongPollSerializer, topic: nil, transport: Phoenix.Transports.LongPoll, transport_name: :longpoll, transport_pid: #PID<0.660.0>, vsn: "2.0.0"}, window_ms: 15000})
    (stdlib) gen_server.erl:616: :gen_server.try_dispatch/4
    (stdlib) gen_server.erl:686: :gen_server.handle_msg/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
Last message: %Phoenix.Socket.Broadcast{event: "progress", payload: %{all: 5, done: 1, pending: 4, progress: 20.0}, topic: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}
State: %{buffer: [], channels: %{"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d" => #PID<0.666.0>}, channels_inverse: %{#PID<0.666.0> => {"mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", "1"}}, client_ref: {#PID<0.622.0>, #Reference<0.3659197968.2859466756.205729>}, last_client_poll: 1527437359083, priv_topic: "phx:lp:oRFiAZoBxO6vqxRk/SFVjA==1527437358904", pubsub_server: Daten.PubSub, serializer: Phoenix.Transports.V2.LongPollSerializer, socket: %Phoenix.Socket{assigns: %{current_user: %Accounts.User{__meta__: #Ecto.Schema.Metadata<:loaded, "user">, account: %Accounts.Account{__meta__: #Ecto.Schema.Metadata<:loaded, "account">, id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.451558Z>, updated_at: #DateTime<2018-05-25 10:42:28.451570Z>}, email: "c@m", id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d", inserted_at: #DateTime<2018-05-25 10:42:28.456345Z>, name: "clemens", updated_at: #DateTime<2018-05-25 10:42:28.456352Z>, user_password: %Accounts.UserPassword{__meta__: #Ecto.Schema.Metadata<:loaded, "user_password">, id: 2, inserted_at: #DateTime<2018-05-25 10:42:28.457810Z>, password: nil, password_hash: "$argon2i$v=19$m=65536,t=6,p=1$UG2SFHp/2G7mhq+lGXVmgw$AOjJEKsj14GCfjhOWS/pmXCkWqmTWYcSfnV7WGZCbAQ", updated_at: #DateTime<2018-05-25 10:42:28.457817Z>, user: #Ecto.Association.NotLoaded<association :user is not loaded>, user_id: "f52c78c8-4148-4c2a-abaf-c91317ffcf7d"}}}, channel: nil, channel_pid: nil, endpoint: DatenWeb.Endpoint, handler: DatenWeb.UserSocket, id: "mailing:f52c78c8-4148-4c2a-abaf-c91317ffcf7d", join_ref: nil, joined: false, private: %{}, pubsub_server: Daten.PubSub, ref: nil, serializer: Phoenix.Transports.V2.LongPollSerializer, topic: nil, transport: Phoenix.Transports.LongPoll, transport_name: :longpoll, transport_pid: #PID<0.660.0>, vsn: "2.0.0"}, window_ms: 15000}

Note that sending the message using a websocket works perfectly, this is just happening when trying to do a long poll. Is this a legitimate bug, or am I missing something regarding how longpolling is implemented?

Thanks a lot

First Post!

OvermindDL1

OvermindDL1

This seems like a bug, the long poller is not handling the broadcast message, I’d say report it as an issue on github.

Where Next?

Popular in Questions Top

srinivasu
How to handle excepions in elixir? Suppose i have A, B, C ,D, E modules. and each module has get() function. A.get() method will call th...
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
LegitStack
I’m hoping you guys can give me some general advice and perhaps code examples if you’re feeling up to it. I’m very interested in Elixir,...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
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
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Codball
Mix format works fine if run from the cmd. I’ve followed this to facilitate the implementation into VSC which involves downloading an ext...
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

Other popular topics Top

peerreynders
Manning 2016 Halloween weekend sale via Deal of the Day Friday, October 28 - Half off all MEAPs - code WM102816LT Saturday, October 29 ...
326 29600 154
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
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
jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod -- where is this set? Thanks.
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
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
Nvim
Elixir appears to be a superior language to Python. I don’t see any advantage of Python over Elixir. Are there any?
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