Open olsky opened 5 years ago
here is more input with log level set to debug...
1) start emqx broker with console:
bin/emqx/console
2) subscribe to test topic
mosquitto_sub -t "test" -v
3) post coap with:
./coap-client -m post -e "qos=0&retain=0&message=payload&topic=test" "coap://127.0.0.1/mqtt?c=coco&p=public&u=admin" -v 9
./coap-client -m post -e "qos=0&retain=0&message=payload&topic=test" "coap://127.0.0.1/mqtt?c=coco&p=public&u=admin" -v 9 Apr 15 11:55:41 DEBG 127.0.0.1:60179 <-> 127.0.0.1:5683 UDP : new outgoing session Apr 15 11:55:41 DEBG sending CoAP request: Apr 15 11:55:41 DEBG 127.0.0.1:60179 <-> 127.0.0.1:5683 UDP : sent 75 bytes v:1 t:CON c:POST i:736a {} [ Uri-Path:mqtt, Uri-Query:c=coco, Uri-Query:p=public, Uri-Query:u=admin ] :: 'qos=0&retain=0&message=payload&topic=test' Apr 15 11:55:41 DEBG 127.0.0.1:60179 <-> 127.0.0.1:5683 UDP : tid=29546 added to retransmit queue (2313ms) Apr 15 11:55:41 DEBG timeout is set to 90 seconds Apr 15 11:55:41 DEBG * 127.0.0.1:60179 <-> 127.0.0.1:5683 UDP : received 4 bytes v:1 t:ACK c:5.00 i:736a {} [ ] Apr 15 11:55:41 DEBG 127.0.0.1:60179 <-> 127.0.0.1:5683 UDP : tid=29546: removed Apr 15 11:55:41 DEBG process incoming 5.00 response: 5.00 Apr 15 11:55:41 DEBG ***127.0.0.1:60179 <-> 127.0.0.1:5683 UDP : session closed
console output: 2019-04-15 11:59:06.759 [debug] CoAP-RES: coap_get() Path=[], Query=[<<"c=coco">>,<<"p=public">>, <<"u=admin">>] 2019-04-15 11:59:06.760 [debug] CoAP-MQTT: try to start adapter ClientId=<<"coco">>, Username=<<"admin">>, Password=<<"public">>, Channel={{127, 0, 0, 1}, 33541} 2019-04-15 11:59:06.764 [debug] [Protocol] RECV CONNECT(Q0, R0, D0, ClientId=coco, ProtoName=MQTT, ProtoVsn=4, CleanStart=true, KeepAlive=120, Username=admin, Password=**) 2019-04-15 11:59:06.765 [debug] coco [RuleEngine] Client(coco) connected, connack: 0, conn_attrs:[{zone,undefined}, {client_id, <<"coco">>}, {username, <<"admin">>}, {peername, {{127,0,0,1}, 33541}}, {peercert,nossl}, {proto_ver,4}, {proto_name, <<"MQTT">>}, {clean_start, true}, {keepalive,120}, {is_bridge,false}, {connected_at, {1555,322346, 764751}}, {conn_mod, undefined}, {credentials,
success,
client_id =>
<<"coco">>,
mountpoint =>
undefined,
peername =>
{{127,0,0,1},
33541},
username =>
<<"admin">>,
zone =>
undefined}}]
2019-04-15 11:59:06.777 [error] coco Generic server <0.1837.0> terminating
Last message in was {'EXIT',<0.1835.0>,
{{case_clause,ok},
[{emqx_protocol,send,2,
[{file,"src/emqx_protocol.erl"},{line,682}]},
{emqx_coap_mqtt_adapter,proto_init,5,
[{file,"src/emqx_coap_mqtt_adapter.erl"},
{line,258}]},
{emqx_coap_mqtt_adapter,init,1,
[{file,"src/emqx_coap_mqtt_adapter.erl"},
{line,120}]},
{gen_server,init_it,2,
[{file,"gen_server.erl"},{line,374}]},
{gen_server,init_it,6,
[{file,"gen_server.erl"},{line,342}]},
{proc_lib,init_p_do_apply,3,
[{file,"proc_lib.erl"},{line,249}]}]}}
** When Server state == {state,30000,true,#Fun
{emqx_inflight,65535,{0,nil}},
0,undefined,
{mqueue,true,1000,0,0,none,0,{queue,[],[],0}},
#{},undefined,undefined,undefined,0,undefined,
true,undefined,undefined,
{1555,322346,764970},
undefined,undefined}
Reason for termination == {{case_clause,ok}, [{emqx_protocol,send,2,[{file,"src/emqx_protocol.erl"},{line,682}]}, {emqx_coap_mqtt_adapter,proto_init,5, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,258}]}, {emqx_coap_mqtt_adapter,init,1, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,120}]}, {gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]}, {gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}
hi,
while trying to get/put message via coap receving always 5.00 reply. What am I missing?
coap-client: libcoap emqx broker version 3 rc1
./coap-client -m get -s 100 "coap://127.0.0.1/mqtt/test?c=1&u=admin&p=public" -v 9 Apr 11 10:35:11 DEBG 127.0.0.1:33665 <-> 127.0.0.1:5683 UDP : new outgoing session Apr 11 10:35:11 DEBG sending CoAP request: Apr 11 10:35:11 DEBG 127.0.0.1:33665 <-> 127.0.0.1:5683 UDP : sent 36 bytes v:1 t:CON c:GET i:736a {} [ Observe:0, Uri-Path:mqtt, Uri-Path:test, Uri-Query:c=1, Uri-Query:u=admin, Uri-Query:p=public ] Apr 11 10:35:11 DEBG 127.0.0.1:33665 <-> 127.0.0.1:5683 UDP : tid=29546 added to retransmit queue (2313ms) Apr 11 10:35:11 DEBG timeout is set to 90 seconds Apr 11 10:35:11 DEBG * 127.0.0.1:33665 <-> 127.0.0.1:5683 UDP : received 4 bytes v:1 t:ACK c:5.00 i:736a {} [ ] Apr 11 10:35:11 DEBG 127.0.0.1:33665 <-> 127.0.0.1:5683 UDP : tid=29546: removed Apr 11 10:35:11 DEBG process incoming 5.00 response: 5.00 Apr 11 10:35:11 DEBG ***127.0.0.1:33665 <-> 127.0.0.1:5683 UDP : session closed
emqx console output:
(emqx@127.0.0.1)1> (emqx@127.0.0.1)1> 2019-04-11 10:35:11.729 [error] 1 Generic server <0.1877.0> terminating Last message in was {'EXIT',<0.1875.0>, {{case_clause,ok}, [{emqx_protocol,send,2, [{file,"src/emqx_protocol.erl"},{line,682}]}, {emqx_coap_mqtt_adapter,proto_init,5, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,258}]}, {emqx_coap_mqtt_adapter,init,1, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,120}]}, {gen_server,init_it,2, [{file,"gen_server.erl"},{line,374}]}, {gen_server,init_it,6, [{file,"gen_server.erl"},{line,342}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,249}]}]}} ** When Server state == {state,30000,true,#Fun,
<<"1">>,<<"admin">>,undefined,undefined,1,0,
{},false,
Reason for termination == {{case_clause,ok}, [{emqx_protocol,send,2,[{file,"src/emqx_protocol.erl"},{line,682}]}, {emqx_coap_mqtt_adapter,proto_init,5, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,258}]}, {emqx_coap_mqtt_adapter,init,1, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,120}]}, {gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]}, {gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]}
log output:
2019-04-11 12:47:32.747 [error] 1 crasher: initial call: emqx_coap_mqtt_adapter:init/1 pid: <0.3599.0> registered_name: [] exception error: no case clause matching ok in function emqx_protocol:send/2 (src/emqx_protocol.erl, line 682) in call from emqx_coap_mqtt_adapter:proto_init/5 (src/emqx_coap_mqtt_adapter.erl, line 258) in call from emqx_coap_mqtt_adapter:init/1 (src/emqx_coap_mqtt_adapter.erl, line 120) in call from gen_server:init_it/2 (gen_server.erl, line 374) in call from gen_server:init_it/6 (gen_server.erl, line 342) ancestors: [<0.3598.0>,<0.3596.0>,<0.3595.0>,<0.1721.0>,coap_server, <0.1718.0>] message_queue_len: 1 messages: [{keepalive,start,90}] links: [<0.3601.0>] dictionary: [{'$logger_metadata$',#{client_id => <<"1">>}}, {guid,{1554979652747166,268555715087887,0}}] trap_exit: false status: running heap_size: 2586 stack_size: 27 reductions: 2357 neighbours: 2019-04-11 12:47:32.750 [error] 1 Generic server <0.3601.0> terminating Last message in was {'EXIT',<0.3599.0>, {{case_clause,ok}, [{emqx_protocol,send,2, [{file,"src/emqx_protocol.erl"},{line,682}]}, {emqx_coap_mqtt_adapter,proto_init,5, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,258}]}, {emqx_coap_mqtt_adapter,init,1, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,120}]}, {gen_server,init_it,2, [{file,"gen_server.erl"},{line,374}]}, {gen_server,init_it,6, [{file,"gen_server.erl"},{line,342}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,249}]}]}} ** When Server state == {state,30000,true,#Fun,
<<"1">>,<<"admin">>,undefined,undefined,1,0,
{},false,
Reason for termination == {{case_clause,ok}, [{emqx_protocol,send,2,[{file,"src/emqx_protocol.erl"},{line,682}]}, {emqx_coap_mqtt_adapter,proto_init,5, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,258}]}, {emqx_coap_mqtt_adapter,init,1, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,120}]}, {gen_server,init_it,2,[{file,"gen_server.erl"},{line,374}]}, {gen_server,init_it,6,[{file,"gen_server.erl"},{line,342}]}, {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,249}]}]} 2019-04-11 12:47:32.762 [error] 1 crasher: initial call: emqx_session:init/1 pid: <0.3601.0> registered_name: [] exception exit: {{case_clause,ok}, [{emqx_protocol,send,2, [{file,"src/emqx_protocol.erl"},{line,682}]}, {emqx_coap_mqtt_adapter,proto_init,5, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,258}]}, {emqx_coap_mqtt_adapter,init,1, [{file,"src/emqx_coap_mqtt_adapter.erl"}, {line,120}]}, {gen_server,init_it,2, [{file,"gen_server.erl"},{line,374}]}, {gen_server,init_it,6, [{file,"gen_server.erl"},{line,342}]}, {proc_lib,init_p_do_apply,3, [{file,"proc_lib.erl"},{line,249}]}]} in function gen_server:handle_common_reply/8 (gen_server.erl, line 751) ancestors: [emqx_session_sup,emqx_sm_sup,emqx_sup,<0.1382.0>] message_queue_len: 0 messages: [] links: [<0.1650.0>] dictionary: [{'$logger_metadata$',#{client_id => <<"1">>}}] trap_exit: true status: running heap_size: 10958 stack_size: 27 reductions: 353733 neighbours:
more emqx_auth_clientid.conf
--------------------------------------------------------------------
ClientId Authentication Plugin
--------------------------------------------------------------------
Examples
auth.client.1.clientid = 1 auth.client.1.password = public
Password hash.
Value: plain | md5 | sha | sha256
auth.client.password_hash = sha256
Thanks!