ninenines / gun

HTTP/1.1, HTTP/2, Websocket client (and more) for Erlang/OTP.
ISC License
891 stars 232 forks source link

no match of right hand side value in gun_ws:dispatch #338

Open ziopio opened 5 days ago

ziopio commented 5 days ago

We had this ugly crash caused by an unhandled error value returned from send. It would be nice to catch this and close the process in a clean way.

=CRASH REPORT==== 2-Jan-1988::14:26:04.205654 ===
  crasher:
    initial call: gun:init/1
    pid: <0.1761.0>
    registered_name: []
    exception error: no match of right hand side value {{error,closed},
                                                        undefined}
      in function  gun_ws:dispatch/7 (/Users/***/***/***/_build/default/lib/gun/src/gun_ws.erl, line 254)
      in call from gun_ws:handle/5 (/Users/***/***/***/_build/default/lib/gun/src/gun_ws.erl, line 148)
      in call from gun:handle_common_connected_no_input/4 (/Users/***/***/***/_build/default/lib/gun/src/gun.erl, line 1423)
      in call from gen_statem:loop_state_callback/11 (gen_statem.erl, line 1426)
    ancestors: [gun_conns_sup,gun_sup,<0.593.0>]

This crash is rare, we only got it once