Giter Club home page Giter Club logo

Comments (9)

essen avatar essen commented on May 27, 2024 1

Cheers. If that's it please leave the ticket open and I'll make sure Gun avoids this crash.

from gun.

essen avatar essen commented on May 27, 2024

There's no ping in HTTP so that might be why this happens. How do you send pings?

from gun.

cultofmetatron avatar cultofmetatron commented on May 27, 2024

@essen thsi is the code I have that does it. the traceback is non exsitant but this is the only place I send {:ping, "ping"} so I assume this is where it slips into the library

  def handle_cast({:send_message, "ping"}, %{name: name, stream_ref: stream_ref, gun_pid: gun_pid} = state) do

    case :gun.ws_send(gun_pid, stream_ref, {:ping, "ping"}) do
      :ok ->
        {:noreply, state}
      reply ->
        {:noreply, state}
    end
  end

and this is occurring over a websocket

from gun.

essen avatar essen commented on May 27, 2024

The 6-arity is an internal call that results from yours. What might be a bug is if you try to send a Websocket ping when the connection is using HTTP, it tries to call a function that does not exist instead of rejecting the call.

from gun.

cultofmetatron avatar cultofmetatron commented on May 27, 2024

hmm ok so what it uses depends conditionally on if the websocket handshake is established?

from gun.

cultofmetatron avatar cultofmetatron commented on May 27, 2024

ok so I added a guard clause that prevents the ws_send from sending the ping unless the status of the websocket is successfully upgraded. will let you know if it works.

Thankyou for the insight!

from gun.

cultofmetatron avatar cultofmetatron commented on May 27, 2024

unfortunately I am still seeing it after the guard clause was added.

from gun.

vshev4enko avatar vshev4enko commented on May 27, 2024

I got the same crashes. It happens when gen_statem in e.g connected state receives {ws_send, frames()} but the protocol is gun_http which doesn't have a ws_send function. Depending conditionally on ws handshake doesn't solve the issue due to the async nature there is no guarantee gun will not reconnect having {ws_send, frames()} in the mailbox. It is easily reproducible just by calling gun:ws_send/3 and reconnecting.

from gun.

essen avatar essen commented on May 27, 2024

Good point. Should handle that better.

from gun.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.