ninenines / gun

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

CRASH REPORT Process with 0 neighbours crashed with reason: no function clause matching gun_http2:parse(<<>>, close) #261

Closed jainygaurav closed 3 years ago

jainygaurav commented 3 years ago

Please help me fix this issue:

Main Issue: https://github.com/inaka/apns4erl/issues/242.

You fixed similar issue earlier: https://github.com/ninenines/gun/issues/105

My environment:

AWS EC2 ubuntu 14.04 OTP: 19.3.6 git clone https://github.com/inaka/apns4erl.git ejabberd - 16.03

%% == Dependencies for apns4erl https://github.com/inaka/apns4erl.git ==

{deps, [
  {gun, "1.3.3"},
  {jsx, "3.0.0"},
  {base64url, "1.0.1"}
]}.
essen commented 3 years ago

Please post the entire crash report.

paulo-ferraz-oliveira commented 3 years ago

@essen, it's also worth noticing that apns4erl isn't using the latest gun. It's desirable to bump to 2.0.0, when it's out (just not comfortable doing it on top of rc1, since we understand behaviour might change). Internally, I've been using rc1 without issues, though 😄.

jainygaurav commented 3 years ago

@essen Just going by the timestamp, this is what I see in my server logs:

2021-02-17 20:46:51.167 [error] <0.483.0> CRASH REPORT Process <0.483.0> with 0 neighbours crashed with reason: no function clause matching gun_http2:parse(<<>>, close) line 77

2021-02-17 20:46:51.168 [error] <0.476.0> Supervisor gun_sup had child undefined started with {gun,start_link,undefined} at <0.483.0> exit with reason function_clause in context child_terminated

essen commented 3 years ago

Crash reports typically have more information...

jainygaurav commented 3 years ago

@essen is there a gun config/setting which will enable more logging?

I run ejabberd server at error loglevel...do I need to run on info/warn/debug?

@paulo-ferraz is there a apns4erl config/setting that will enable more logs?

essen commented 3 years ago

Don't worry about it. It's most likely fixed in 2.0. HTTP/2 support is much better there.

@paulo-ferraz-oliveira apns4erl might benefit from newly added gun_pool, would be worth an experiment. It won't be documented in 2.0.0 just yet.

I'll have to make time to release a 2.0.0-rc.2 if I didn't already. Or a proper 2.0 directly. We'll see.

Closing this in the meantime because I doubt this is still an issue in current Gun. Thanks!

paulo-ferraz-oliveira commented 3 years ago

@paulo-ferraz-oliveira apns4erl might benefit from newly added gun_pool, would be worth an experiment. It won't be documented in 2.0.0 just yet.

I saw a pull request pass by here, recently, (by you, I believe) but was actually waiting for 2.0. Can wait a while longer, though.

@jainygaurav, you should try to lock gun to 2.0.0-rc1, on your end (rebar.config) and check if the issue goes away.

paulo-ferraz-oliveira commented 3 years ago

@essen, when I migrated for 1.0.0-rc1 to 2.0.0-rc1, I had to rename transport_opts as tls_opts, but don't see this mentioned in the migration doc.s (either it was before 1.0.0 or I just didn't find it). Just a side note.

jainygaurav commented 3 years ago

@essen I get the following warnings

_build/default/lib/gun/src/gun_socks.erl:131: Warning: a term is constructed, but never used _build/default/lib/gun/src/gun_socks.erl:136: Warning: a term is constructed, but never used

./rebar3 upgrade
===> Verifying dependencies...
===> Fetching base64url v1.0.1
===> Fetching gun v2.0.0-rc.1
===> Fetching jsx v3.0.0
===> Fetching cowlib v2.10.1
===> No upgrade needed for base64url
===> No upgrade needed for gun
===> No upgrade needed for jsx
===> No upgrade needed for cowlib

./rebar3 compile
===> Verifying dependencies...
===> Analyzing applications...
===> Compiling cowlib
===> Compiling base64url
===> Compiling gun
_build/default/lib/gun/src/gun_socks.erl:131: Warning: a term is constructed, but never used
_build/default/lib/gun/src/gun_socks.erl:136: Warning: a term is constructed, but never used

===> Compiling jsx
===> Analyzing applications...
===> Compiling apns
essen commented 3 years ago

It is mentioned in https://ninenines.eu/docs/en/gun/2.0/guide/migrating_from_1.3/

About the warning, what OTP version? Sounds like most recent OTP master.

paulo-ferraz-oliveira commented 3 years ago

It is mentioned in https://ninenines.eu/docs/en/gun/2.0/guide/migrating_from_1.3/

I see; I was specifically looking for transport_opts. Problem solved. Thanks.

paulo-ferraz-oliveira commented 3 years ago

@essen: I can confirm the warning occurs with 19.3, for example, but you have a @todo around it, which is why when I imported it (internally) I really didn't care (also, not really using 19.3 anymore).


Edit: 20.3 also, 21.3 no longer and neither on 24-rc.1.

jainygaurav commented 3 years ago

@essen I use OTP 19.3. Can I continue to use it or do I need to upgrade to OTP 21.3?

I have other dependencies which are tied to 19.3 and upgrading to 21.3 will not be easy for us.

jainygaurav commented 3 years ago

@paulo-ferraz-oliveira I did not change transport_opts to tls_opts but it compiled with those warnings. Is that ok?

Do I need to change transport_opts to tls_opts?

I built apns with this code

find src/ -type f | xargs grep transport_opts
src/apns_connection.erl:  TransportOpts = transport_opts(Connection),
src/apns_connection.erl:                              , transport_opts => TransportOpts
src/apns_connection.erl:  TransportOpts = transport_opts(Connection),
src/apns_connection.erl:transport_opts(Connection) ->
essen commented 3 years ago

Gun 2.0 I think is 22+, maybe it works with lesser versions but you might have to do minor modifications and such.

jainygaurav commented 3 years ago

@essen Can you please point me to the modifications?

essen commented 3 years ago

Can't, sorry.

jainygaurav commented 3 years ago

ok