Comments (9)
Cheers. If that's it please leave the ticket open and I'll make sure Gun avoids this crash.
from gun.
There's no ping in HTTP so that might be why this happens. How do you send pings?
from gun.
@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.
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.
hmm ok so what it uses depends conditionally on if the websocket handshake is established?
from gun.
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.
unfortunately I am still seeing it after the guard clause was added.
from gun.
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.
Good point. Should handle that better.
from gun.
Related Issues (20)
- gun_sse_h failing because of strict `content-type` header validation HOT 2
- Does websocket upgrade work for HTTP/2 with TLS on gun 2.0 rc 2? HOT 6
- Test and document Websocket protocols HOT 1
- stream_error with retry HOT 9
- Review and improve gun_pool restart strategies HOT 1
- Problem using an HTTP proxy HOT 2
- Strange behavior on ARM processors HOT 2
- gun:connect expects proxy server to reply with HTTP/1.1, some servers respond with HTTP/1.0 HOT 3
- gun 2.0 RC ready? HOT 7
- HTTP2 gun_down event only delivered the connection owner but not to streams HOT 2
- Exposing HTTP2 "additional debug data" in received GOAWAY frames HOT 4
- [Bug] shutdown sends GOAWAY with reason internal error HOT 4
- Crash during termination when connecting to a server requiring mTLS over HTTP/2 HOT 17
- Feature: Response callback fun HOT 4
- Add stream idle timeout HOT 2
- Websocket upgrade fails on unix socket HOT 4
- function not exported {gun_http,ws_send,6} HOT 3
- Downgrade response time HTTP-2 after 1.3.0 to 2.0.1 HOT 26
- client_preferred_next_protocols is incompatible with TLS 1.3 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gun.