helium / helium-packet-router

Apache License 2.0
8 stars 5 forks source link

Crash when parsing downlink token #295

Closed macpie closed 4 months ago

macpie commented 4 months ago
{badarg,[{erlang,binary_to_existing_atom,[<<":EU868">>],[{error_info,#{module => erl_erts_errors}}]},{hpr_http_roaming,parse_uplink_token,1,[{file,"/__w/helium-packet-router/helium-packet-router/src/protocols/http/hpr_http_roaming.erl"},{line,485}]},{hpr_http_roaming,handle_xmitdata_req,1,[{file,"/__w/helium-packet-router/helium-packet-router/src/protocols/http/hpr_http_roaming.erl"},{line,347}]},{hpr_http_roaming_downlink_stream_worker,process_downlink,1,[{file,"/__w/helium-packet-router/helium-packet-router/src/protocols/http/hpr_http_roaming_downlink_stream_worker.erl"},{line,155}]}]}"

hpr_http_roaming:parse_uplink_token:485 this should be wrap in try catch and return malformed_token if failure.

Seems like some eunit test fail sometime on it as well

      hpr_http_roaming: class_c_downlink_test...*failed*
in function erlang:binary_to_existing_atom/1
  called as binary_to_existing_atom(<<":US915">>)
in call from hpr_http_roaming:parse_uplink_token/1 (/__w/helium-packet-router/helium-packet-router/src/protocols/http/hpr_http_roaming.erl, line 440)
in call from hpr_http_roaming:handle_xmitdata_req/1 (/__w/helium-packet-router/helium-packet-router/src/protocols/http/hpr_http_roaming.erl, line 349)
in call from hpr_http_roaming:class_c_downlink_test/0 (/__w/helium-packet-router/helium-packet-router/src/protocols/http/hpr_http_roaming.erl, line 550)
in call from eunit_test:'-mf_wrapper/2-fun-0-'/2 (eunit_test.erl, line 273)
in call from eunit_test:run_testfun/1 (eunit_test.erl, line 71)
in call from eunit_proc:run_test/1 (eunit_proc.erl, line 531)
in call from eunit_proc:with_timeout/3 (eunit_proc.erl, line 356)
**error:badarg
  output:<<"">>