Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression: sync_subscribe topic causes bad_match #37

Closed
heri16 opened this issue Jul 1, 2016 · 2 comments
Closed

Regression: sync_subscribe topic causes bad_match #37

heri16 opened this issue Jul 1, 2016 · 2 comments
Assignees
Milestone

Comments

@heri16
Copy link
Contributor

heri16 commented Jul 1, 2016

Calling emqttc:subscribe over ssl socket works fine, but fails with emqttc:sync_subscribe even for a single topic.

iex(1)> {:ok, client} = :emqttc.start_link(connect_options)
iex(2)> topics = [{"$aws/things/frestive-cps-rene-3001/shadow/update/delta", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/update/accepted", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/update/rejected", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/get/accepted", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/get/rejected", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/delete/accepted", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/delete/rejected", 0}]
iex(3)> :emqttc.sync_subscribe(client, topics)

[info] [Client <0.170.0>]: connecting to a2qbxv4743ghh5.iot.ap-southeast-1.amaz
naws.com:8883
[error] ** State machine #PID<0.159.0> terminating
** Last message in was {:"$gen_sync_event", {#PID<0.158.0>, #Reference<0.0.2.34
>},
 {:subscribe, #PID<0.158.0>,
  [{"$aws/things/frestive-cps-rene-3001/shadow/update/delta", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/update/accepted", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/update/rejected", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/get/accepted", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/get/rejected", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/delete/accepted", 0},
   {"$aws/things/frestive-cps-rene-3001/shadow/delete/rejected", 0}]}}
** When State == :connected
**      Data  == {:state, #PID<0.158.0>, '<0.159.0>',
 'a2qbxv4743ghh5.iot.ap-southeast-1.amazonaws.com', 8883,
 {:ssl_socket, #Port<0.8960>,
  {:sslsocket, {:gen_tcp, #Port<0.8960>, :tls_connection, :undefined},
   #PID<0.165.0>}}, #PID<0.167.0>,
 {:proto_state,
  {:ssl_socket, #Port<0.8960>,
   {:sslsocket, {:gen_tcp, #Port<0.8960>, :tls_connection, :undefined},
    #PID<0.165.0>}}, '10.101.10.218:24665', 4, "MQTT", "frestive-cps-rene-3001"

  true, 60, false,
  {:mqtt_message, 0, false, false, :undefined, :undefined, :undefined},
  :undefined, :undefined, 1, %{}, %{}, %{}, %{},
  {:gen_logger, :console_logger, 2}}, [], %{}, [], [], %{}, :undefined, false,
 {:keepalive,
  {:ssl_socket, #Port<0.8960>,
   {:sslsocket, {:gen_tcp, #Port<0.8960>, :tls_connection, :undefined},
    #PID<0.165.0>}}, :send_oct, 1700, 60, {:keepalive, :timeout},
  #Reference<0.0.2.344>}, 60, 30, 4, 8, :undefined, :ssl, :undefined,
 {:gen_logger, :console_logger, 2}, [],
 [cacertfile: 'config/certs/root-CA.crt',
  certfile: 'config/certs/fe354dc277-certificate.pem.crt',
  keyfile: 'config/certs/fe354dc277-private.pem.key']}
** Reason for termination =
** {{:badmatch,
  {:next_state, :connected,
   {:state, #PID<0.158.0>, '<0.159.0>',
    'a2qbxv4743ghh5.iot.ap-southeast-1.amazonaws.com', 8883,
    {:ssl_socket, #Port<0.8960>,
     {:sslsocket, {:gen_tcp, #Port<0.8960>, :tls_connection, :undefined},
      #PID<0.165.0>}}, #PID<0.167.0>,
    {:proto_state,
     {:ssl_socket, #Port<0.8960>,
      {:sslsocket, {:gen_tcp, #Port<0.8960>, :tls_connection, :undefined},
       #PID<0.165.0>}}, '10.101.10.218:24665', 4, "MQTT",
     "frestive-cps-rene-3001", true, 60, false,
     {:mqtt_message, 0, false, false, :undefined, :undefined, :undefined},
     :undefined, :undefined, 2,
     %{"$aws/things/frestive-cps-rene-3001/shadow/delete/accepted" => 0,
       "$aws/things/frestive-cps-rene-3001/shadow/delete/rejected" => 0,
       "$aws/things/frestive-cps-rene-3001/shadow/get/accepted" => 0,
       "$aws/things/frestive-cps-rene-3001/shadow/get/rejected" => 0,
       "$aws/things/frestive-cps-rene-3001/shadow/update/accepted" => 0,
       "$aws/things/frestive-cps-rene-3001/shadow/update/delta" => 0,
       "$aws/things/frestive-cps-rene-3001/shadow/update/rejected" => 0}, %{},
     %{}, %{}, {:gen_logger, :console_logger, 2}},
    [{#PID<0.158.0>, #Reference<0.0.2.349>}],
    %{"$aws/things/frestive-cps-rene-3001/shadow/delete/accepted" => {0,
       [#PID<0.158.0>]},
      "$aws/things/frestive-cps-rene-3001/shadow/delete/rejected" => {0,
       [#PID<0.158.0>]},
      "$aws/things/frestive-cps-rene-3001/shadow/get/accepted" => {0,
       [#PID<0.158.0>]},
      "$aws/things/frestive-cps-rene-3001/shadow/get/rejected" => {0,
       [#PID<0.158.0>]},
      "$aws/things/frestive-cps-rene-3001/shadow/update/accepted" => {0,
       [#PID<0.158.0>]},
      "$aws/things/frestive-cps-rene-3001/shadow/update/delta" => {0,
       [#PID<0.158.0>]},
      "$aws/things/frestive-cps-rene-3001/shadow/update/rejected" => {0,
       [#PID<0.158.0>]}}, [], [], %{}, 1, false,
    {:keepalive,
     {:ssl_socket, #Port<0.8960>,
      {:sslsocket, {:gen_tcp, #Port<0.8960>, :tls_connection, :undefined},
       #PID<0.165.0>}}, :send_oct, 1700, 60, {:keepalive, :timeout},
     #Reference<0.0.2.344>}, 60, 30, 4, 8, :undefined, :ssl, :undefined,
    {:gen_logger, :console_logger, 2}, [],
    [cacertfile: 'config/certs/root-CA.crt',
     certfile: 'config/certs/fe354dc277-certificate.pem.crt',
     keyfile: 'config/certs/fe354dc277-private.pem.key']}, :hibernate}},
 [{:emqttc, :connected, 3, [file: 'src/emqttc.erl', line: 671]},
  {:gen_fsm, :handle_msg, 7, [file: 'gen_fsm.erl', line: 518]},
  {:proc_lib, :wake_up, 3, [file: 'proc_lib.erl', line: 250]}]}

** (exit) exited in: GenServer.call(:thing_shadow, {:thing_register, "frestive-
ps-rene-3001", []}, 5000)
    ** (EXIT) an exception was raised:
        ** (MatchError) no match of right hand side value: {:next_state, :conne
ted, {:state, #PID<0.158.0>, '<0.159.0>', 'a2qbxv4743ghh5.iot.ap-southeast-1.am
zonaws.com', 8883, {:ssl_socket, #Port<0.8960>, {:sslsocket, {:gen_tcp, #Port<0
8960>, :tls_connection, :undefined}, #PID<0.165.0>}}, #PID<0.167.0>, {:proto_st
te, {:ssl_socket, #Port<0.8960>, {:sslsocket, {:gen_tcp, #Port<0.8960>, :tls_co
nection, :undefined}, #PID<0.165.0>}}, '10.101.10.218:24665', 4, "MQTT", "frest
ve-cps-rene-3001", true, 60, false, {:mqtt_message, 0, false, false, :undefined
 :undefined, :undefined}, :undefined, :undefined, 2, %{"$aws/things/frestive-cp
-rene-3001/shadow/delete/accepted" => 0, "$aws/things/frestive-cps-rene-3001/sh
dow/delete/rejected" => 0, "$aws/things/frestive-cps-rene-3001/shadow/get/accep
ed" => 0, "$aws/things/frestive-cps-rene-3001/shadow/get/rejected" => 0, "$aws/
hings/frestive-cps-rene-3001/shadow/update/accepted" => 0, "$aws/things/frestiv
-cps-rene-3001/shadow/update/delta" => 0, "$aws/things/frestive-cps-rene-3001/s
adow/update/rejected" => 0}, %{}, %{}, %{}, {:gen_logger, :console_logger, 2}},
[{#PID<0.158.0>, #Reference<0.0.2.349>}], %{"$aws/things/frestive-cps-rene-3001
shadow/delete/accepted" => {0, [#PID<0.158.0>]}, "$aws/things/frestive-cps-rene
3001/shadow/delete/rejected" => {0, [#PID<0.158.0>]}, "$aws/things/frestive-cps
rene-3001/shadow/get/accepted" => {0, [#PID<0.158.0>]}, "$aws/things/frestive-c
s-rene-3001/shadow/get/rejected" => {0, [#PID<0.158.0>]}, "$aws/things/frestive
cps-rene-3001/shadow/update/accepted" => {0, [#PID<0.158.0>]}, "$aws/things/fre
tive-cps-rene-3001/shadow/update/delta" => {0, [#PID<0.158.0>]}, "$aws/things/f
estive-cps-rene-3001/shadow/update/rejected" => {0, [#PID<0.158.0>]}}, [], [],
{}, 1, false, {:keepalive, {:ssl_socket, #Port<0.8960>, {:sslsocket, {:gen_tcp,
#Port<0.8960>, :tls_connection, :undefined}, #PID<0.165.0>}}, :send_oct, 1700,
0, {:keepalive, :timeout}, #Reference<0.0.2.344>}, 60, 30, 4, 8, :undefined, :s
l, :undefined, {:gen_logger, :console_logger, 2}, [], [cacertfile: 'config/cert
/root-CA.crt', certfile: 'config/certs/fe354dc277-certificate.pem.crt', keyfile
 'config/certs/fe354dc277-private.pem.key']}, :hibernate}
            src/emqttc.erl:671: :emqttc.connected/3
            (stdlib) gen_fsm.erl:518: :gen_fsm.handle_msg/7
            (stdlib) proc_lib.erl:250: :proc_lib.wake_up/3
    (elixir) lib/gen_server.ex:564: GenServer.call/3
@heri16 heri16 changed the title sync_subscribe multiple topics causes bad_match sync_subscribe topic over ssl causes bad_match Jul 1, 2016
@heri16
Copy link
Contributor Author

heri16 commented Jul 1, 2016

Offending line is src/emqttc.erl:671 @emqplus

@heri16 heri16 changed the title sync_subscribe topic over ssl causes bad_match Regression: sync_subscribe topic causes bad_match Jul 18, 2016
@heri16
Copy link
Contributor Author

heri16 commented Jul 20, 2016

See pull request #42

@emqplus emqplus self-assigned this Feb 5, 2017
@emqplus emqplus added this to the 0.9 milestone Feb 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants