gausby / tortoise

A MQTT Client written in Elixir
Apache License 2.0
314 stars 54 forks source link

No matching handle_info in Tortoise.Connection #129

Open jfcloutier opened 3 years ago

jfcloutier commented 3 years ago

The error occurred while using Tortoise on a very slow connection.

** (FunctionClauseError) no function clause matching in Tortoise.Connection.handle_info/2
    (tortoise 0.9.6) lib/tortoise/connection.ex:381: Tortoise.Connection.handle_info({{Tortoise, "SRH181700008"}, #Reference<0.2774786679.2276458497.120393>, %{error: [], ok: [{"SRH181700008/networks/+/cmd", 1}], warn: []}}, %Tortoise.Connection{backoff: %Tortoise.Connection.Backoff{max_interval: 30000, min_interval: 100, value: nil}, client_id: "SRH181700008", connect: %Tortoise.Package.Connect{__META__: %Tortoise.Package.Meta{flags: 0, opcode: 1}, clean_session: false, client_id: "SRH181700008", keep_alive: 60, password: nil, protocol: "MQTT", protocol_version: 4, user_name: nil, will: %Tortoise.Package.Publish{__META__: %Tortoise.Package.Meta{flags: 0, opcode: 3}, dup: false, identifier: nil, payload: "{\"code\":\"going_down\",\"msg\":\"Last will message\"}", qos: 1, retain: false, topic: "SRH181700008/message"}}, keep_alive: #Reference<0.2774786679.2276458497.119920>, opts: [handler: {Jackalope.TortoiseHandler, [handler: Hubbub, jackalope_pid: #PID<0.2961.0>]}, client_id: "SRH181700008"],...

Trace:

19:40:03.506 [info]  [Jackalope] Publishing SRH181700008/message with payload {"capabilities_version":"1.0","code":"ready","firmware_version":"1.4.3-resumable1","mqtt_api_version":"1.0","msg":"Hub is ready","reason":"network_restored"}
19:40:03.514 [info]  [Jackalope] Publishing SRH181700008/networks/update with payload {"attribute":{"name":"active_interface","timestamp":"2021-01-29 19:40:03.499471Z","value":"mobile"},"reason":"notification"}
19:40:08.495 [warn]  Retrying message, failed with reason: :timeout
19:40:12.612 [info]  [Hubbub] MQTT subscription for "SRH181700008/networks/+/cmd" is up
19:40:12.613 [info]  [Piston] Broadcasting :monitor with {:hub_status, :hub_ready}
19:40:12.621 [info]  [Piston] Broadcasting :monitor with {:hub_status, :hub_not_ready}
19:40:12.606 [error] GenServer {Tortoise.Registry, {Tortoise.Connection, "SRH181700008"}} terminating
** (FunctionClauseError) no function clause matching in Tortoise.Connection.handle_info/2
    (tortoise 0.9.6) lib/tortoise/connection.ex:381: Tortoise.Connection.handle_info({{Tortoise, "SRH181700008"}, #Reference<0.2774786679.2276458497.120393>, %{error: [], ok: [{"SRH181700008/networks/+/cmd", 1}], warn: []}}, %Tortoise.Connection{backoff: %Tortoise.Connection.Backoff{max_interval: 30000, min_interval: 100, value: nil}, client_id: "SRH181700008", connect: %Tortoise.Package.Connect{__META__: %Tortoise.Package.Meta{flags: 0, opcode: 1}, clean_session: false, client_id: "SRH181700008", keep_alive: 60, password: nil, protocol: "MQTT", protocol_version: 4, user_name: nil, will: %Tortoise.Package.Publish{__META__: %Tortoise.Package.Meta{flags: 0, opcode: 3}, dup: false, identifier: nil, payload: "{\"code\":\"going_down\",\"msg\":\"Last will message\"}", qos: 1, retain: false, topic: "SRH181700008/message"}}, keep_alive: #Reference<0.2774786679.2276458497.119920>, opts: [handler: {Jackalope.TortoiseHandler, [handler: Hubbub, jackalope_pid: #PID<0.2961.0>]}, client_id: "SRH181700008"], server: %Tortoise.Transport{host: 'a28r3lt16wlgiy-ats.iot.us-east-1.amazonaws.com', opts: [:binary, {:packet, :raw}, {:active, false}, {:verify, :verify_peer}, {:alpn_advertised_protocols, ["x-amzn-mqtt-ca"]}, {:server_name_indication, '*.iot.us-east-1.amazonaws.com'}, {:cert, <<48, 130, 1, 124, 48, 130, 1, 33, 160, 3, 2, 1, 2, 2, 16, 111, 204, 65, 121, 164, 8, 59, 168, 138, 1, 98, 85, 76, 25, 139, 2, 48, 10, ...>>}, {:key, %{algorithm: :ecdsa, engine: #Reference<0.2774786679.2276589569.100874>, key_id: "pkcs11:token=1"}}, {:cacerts, [<<48, 130, 1, 166, 48, 130, 1, 77, 160, 3, 2, 1, 2, 2, 16, 81, 12, 150, 22, 235, 48, 26, 62, 189, 217, 196, 20, 122, 232, 107, ...>>, <<48, 130, 3, 65, 48, 130, 2, 41, 160, 3, 2, 1, 2, 2, 19, 6, 108, 159, 207, 153, 191, 140, 10, 57, 226, 240, 120, 138, 67, ...>>, <<48, 130, 5, 65, 48, 130, 3, 41, 160, 3, 2, 1, 2, 2, 19, 6, 108, 159, 210, 150, 53, 134, 159, 10, 15, 229, 134, 120, ...>>]}, {:versions, [:"tlsv1.2"]}, {:partial_chain, #Function<0.80393881/1 in Hubbub."-fun.partial_chain/1-">}], port: 443, type: Tortoise.Transport.SSL}, status: :up, subscriptions: %Tortoise.Package.Subscribe{__META__: %Tortoise.Package.Meta{flags: 2, opcode: 8}, identifier: nil, topics: [{"SRH181700008/cmd", 1}, {"SRH181700008/devices/+/cmd", 1}, {"SRH181700008/networks/+/cmd", 1}, {"SRH181700008/networks/cmd", 1}]}})
    (stdlib 3.14) gen_server.erl:689: :gen_server.try_dispatch/4
    (stdlib 3.14) gen_server.erl:765: :gen_server.handle_msg/6
    (stdlib 3.14) proc_lib.erl:226: :proc_lib.init_p_do_apply/3
Last message: {{Tortoise, "SRH181700008"}, #Reference<0.2774786679.2276458497.120393>, %{error: [], ok: [{"SRH181700008/networks/+/cmd", 1}], warn: []}}
State: %Tortoise.Connection{backoff: %Tortoise.Connection.Backoff{max_interval: 30000, min_interval: 100, value: nil}, client_id: "SRH181700008", connect: %Tortoise.Package.Connect{__META__: %Tortoise.Package.Meta{flags: 0, opcode: 1}, clean_session: false, client_id: "SRH181700008", keep_alive: 60, password: nil, protocol: "MQTT", protocol_version: 4, user_name: nil, will: %Tortoise.Package.Publish{__META__: %Tortoise.Package.Meta{flags: 0, opcode: 3}, dup: false, identifier: nil, payload: "{\"code\":\"going_down\",\"msg\":\"Last will message\"}", qos: 1, retain: false, topic: "SRH181700008/message"}}, keep_alive: #Reference<0.2774786679.2276458497.119920>, opts: [handler: {Jackalope.TortoiseHandler, [handler: Hubbub, jackalope_pid: #PID<0.2961.0>]}, client_id: "SRH181700008"], server: %Tortoise.Transport{host: 'a28r3lt16wlgiy-ats.iot.us-east-1.amazonaws.com', opts: [:binary, {:packet, :raw}, {:active, false}, {:verify, :verify_peer}, {:alpn_advertised_protocols, ["x-amzn-mqtt-ca"]}, {:server_name_indication, '*.iot.us-east-1.amazonaws.com'}, {:cert, <<48, 130, 1, 124, 48, 130, 1, 33, 160, 3, 2, 1, 2, 2, 16, 111, 204, 65, 121, 164, 8, 59, 168, 138, 1, 98, 85, 76, 25, 139, 2, 48, 10, ...>>}, {:key, %{algorithm: :ecdsa, engine: #Reference<0.2774786679.2276589569.100874>, key_id: "pkcs11:token=1"}}, {:cacerts, [<<48, 130, 1, 166, 48, 130, 1, 77, 160, 3, 2, 1, 2, 2, 16, 81, 12, 150, 22, 235, 48, 26, 62, 189, 217, 196, 20, 122, 232, 107, ...>>, <<48, 130, 3, 65, 48, 130, 2, 41, 160, 3, 2, 1, 2, 2, 19, 6, 108, 159, 207, 153, 191, 140, 10, 57, 226, 240, 120, 138, 67, ...>>, <<48, 130, 5, 65, 48, 130, 3, 41, 160, 3, 2, 1, 2, 2, 19, 6, 108, 159, 210, 150, 53, 134, 159, 10, 15, 229, 134, 120, ...>>]}, {:versions, [:"tlsv1.2"]}, {:partial_chain, #Function<0.80393881/1 in Hubbub."-fun.partial_chain/1-">}], port: 443, type: Tortoise.Transport.SSL}, status: :up, subscriptions: %Tortoise.Package.Subscribe{__META__: %Tortoise.Package.Meta{flags: 2, opcode: 8}, identifier: nil, topics: [{"SRH181700008/cmd", 1}, {"SRH181700008/devices/+/cmd", 1}, {"SRH181700008/networks/+/cmd", 1}, {"SRH181700008/networks/cmd", 1}]}}   
19:40:47.331 [info]  [Hubbub] Subscribing all MQTT topics: ["SRH181700008/cmd", "SRH181700008/devices/+/cmd", "SRH181700008/networks/cmd", "SRH181700008/networks/+/cmd"]
sleipnir commented 2 years ago

I have same issue in my system