Closed jorgeig-space closed 2 years ago
This might also be the cause of this issue: https://github.com/brocaar/chirpstack-application-server/issues/522
Most stacks will fail silently if they received an invalid frame. In this case the frame is invalid because the MIC will be wrong (as it is for the previous FCnt). The only reason I have the end-node logs above is because I'm also working on the Rust Lorawan stack so I inserted some debug statements.
To clarify, there are no other devices on the network, everything is running on the same host, and the end-device and gateway are in the same room.
Do you mean that for two confirmed uplinks (FCnt 5 and FCnt 6), the NS responded with exactly the same downlink payload (containing the ACK)?
// This is where the issue manifests
182.041880 TRACE lorawan_response: Uplink with FCnt 5
185.558987 DEBUG parse_with_factory: bytes: [96, 236, 213, 244, 1, 32, 5, 0, 56, 146, 35, 134] <--------------
212.366891 TRACE lorawan_response: Uplink with FCnt 6
215.883770 DEBUG parse_with_factory: bytes: [96, 236, 213, 244, 1, 32, 5, 0, 56, 146, 35, 134] <--------------
Please note that (for LoRaWAN 1.0), the ACK does not contain the frame-counter that was acknowledged. For LoRaWAN 1.1 the ACK uses the uplink frame-counter in the MIC calculation.
Note that the NS increments the downlink frame-counter after receiving a TX ACK from the gateway. In case the gateway does transmit the downlink, but does not send a TXACK (or it did send but it did not reach the NS), the NS will consider the downlink as not transmitted and the downlink frame-counter will not increment and thus will be used again for the next downlink.
This could have happened:
In this case the downlink from 2) will not appear in the Redis Stream as it is considered as never been sent by the gateway.
Please note, it is perfectly fine that the confirmed uplink has fcnt 6, and the downlink acknowledgement has fcnt 5. The device receives an ACK, but it does not contain the uplink fcnt to which the ACK relates. That is why in LoRaWAN 1.1 this was included in the MIC validation.
Many thanks for taking the time to look into this and pointing out the ACK mechanism. That makes things much clearer. Clearly this is not an NS issue.
It appears there is some issue in RAK's lora_pkt_fwd
, since the ACK is transmitted (seen by the end-device), but no txack is given back to the NS... I'll close the issue here and post a solution when I find it. If you have any ideas on how to diagnose that, they'll be much appreciated! Thanks.
Hi, sorry to beat the dead horse with this but I've been taking a closer look at logs and it appears the NS is indeed receiving TX ACK from the gateway. Redis still doesn't show any downlink message right before the problem, and the device is still seeing the "duplicated" ACK.
In this latest test:
The big issue is that the ACK is always correctly transmitted, it's just that the NS doesn't seem to know about it (but the log says otherwise).
Any pointer on where to look? I can only see one difference between the good ACKs and the one that appears to be ignored: at the end of each FCnt block in the NS log, there is a message msg="sent downlink meta-data to network-controller"
which is not present for FCnt 1.
The messages storage: downlink-frame saved
seem to indicate that we are on the OnError
branch of handleDownlinkTXAckTasks, but I see no errors on the AS or anywhere else.
=========== Logs
View on application:
NS Log:
JOIN
ns: time="2022-03-02T03:22:41.287768752Z" level=info msg="gateway/mqtt: uplink frame received" gateway_id=b827ebfffed7e6e4 uplink_id=34d5f339-a1c4-4374-8fb1-1673b2c234d6
ns: time="2022-03-02T03:22:41.506105913Z" level=info msg="uplink: frame(s) collected" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 mtype=JoinRequest uplink_ids="[34d5f339-a1c4-4374-8fb1-1673b2c234d6]"
ns: time="2022-03-02T03:22:41.661447048Z" level=info msg="lorawan/backend: finished backend api call" message_type=JoinReq protocol_version=1.0 receiver_id=0000000000000000 result_code=Success sender_id=000000 transaction_id=187779681
ns: time="2022-03-02T03:22:41.669978781Z" level=info msg="sent uplink meta-data to network-controller" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:41.677317551Z" level=info msg="device-queue flushed" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:41.687746224Z" level=info msg="device-session saved" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 dev_addr=01f8eea2 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:41.705809659Z" level=info msg="device-activation created" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 dev_eui=3236500700160026 id=1063
ns: time="2022-03-02T03:22:41.716904311Z" level=info msg="device updated" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:41.726039025Z" level=info msg="gateway/mqtt: publishing gateway command" command=down downlink_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 gateway_id=b827ebfffed7e6e4 qos=0 topic=gateway/b827ebfffed7e6e4/command/down
ns: time="2022-03-02T03:22:41.745245424Z" level=info msg="storage: downlink-frame saved" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 token=50642
------> ns: time="2022-03-02T03:22:41.761914901Z" level=info msg="backend/gateway: downlink tx acknowledgement received" downlink_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535 gateway_id=b827ebfffed7e6e4
ns: time="2022-03-02T03:22:41.781753280Z" level=info msg="sent downlink meta-data to network-controller" ctx_id=795fcae2-a24a-4f49-b8d3-60e0ca3f0535
FCnt 0
ns: time="2022-03-02T03:22:49.236545186Z" level=info msg="gateway/mqtt: uplink frame received" gateway_id=b827ebfffed7e6e4 uplink_id=3d626ee7-52c4-4e21-95ed-442f665a9918
ns: time="2022-03-02T03:22:49.465267739Z" level=info msg="uplink: frame(s) collected" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd mtype=ConfirmedDataUp uplink_ids="[3d626ee7-52c4-4e21-95ed-442f665a9918]"
ns: time="2022-03-02T03:22:49.569812964Z" level=info msg="sent uplink meta-data to network-controller" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd dev_eui=3236500700160026
ns: time="2022-03-02T03:22:49.581033451Z" level=info msg="device gateway rx-info meta-data saved" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd dev_eui=3236500700160026
ns: time="2022-03-02T03:22:49.602659464Z" level=info msg="device-session saved" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd dev_addr=01f8eea2 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:49.750499711Z" level=info msg="finished client unary call" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd grpc.code=OK grpc.ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f grpc.duration=163.189546ms grpc.method=HandleUplinkData grpc.service=as.ApplicationServerService span.kind=client system=grpc
ns: time="2022-03-02T03:22:49.776026545Z" level=info msg="gateway/mqtt: publishing gateway command" command=down downlink_id=79cb52e5-294d-4041-bc09-855a5adf21dd gateway_id=b827ebfffed7e6e4 qos=0 topic=gateway/b827ebfffed7e6e4/command/down
ns: time="2022-03-02T03:22:49.813452835Z" level=info msg="device-session saved" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd dev_addr=01f8eea2 dev_eui=3236500700160026
-----> ns: time="2022-03-02T03:22:49.822347429Z" level=info msg="backend/gateway: downlink tx acknowledgement received" downlink_id=79cb52e5-294d-4041-bc09-855a5adf21dd gateway_id=b827ebfffed7e6e4
ns: time="2022-03-02T03:22:49.847309289Z" level=info msg="storage: downlink-frame saved" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd token=31179
ns: time="2022-03-02T03:22:49.862989573Z" level=info msg="device-session saved" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd dev_addr=01f8eea2 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:49.870309238Z" level=info msg="sent downlink meta-data to network-controller" ctx_id=79cb52e5-294d-4041-bc09-855a5adf21dd
FCnt 1
ns: time="2022-03-02T03:22:53.351669109Z" level=info msg="gateway/mqtt: uplink frame received" gateway_id=b827ebfffed7e6e4 uplink_id=a9ee3c59-2088-4786-ab53-cfc00a3d5578
ns: time="2022-03-02T03:22:53.594831415Z" level=info msg="uplink: frame(s) collected" ctx_id=41916195-326e-4f28-9526-13ef4c878933 mtype=ConfirmedDataUp uplink_ids="[a9ee3c59-2088-4786-ab53-cfc00a3d5578]"
ns: time="2022-03-02T03:22:53.652651396Z" level=info msg="device gateway rx-info meta-data saved" ctx_id=41916195-326e-4f28-9526-13ef4c878933 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:53.662736870Z" level=info msg="sent uplink meta-data to network-controller" ctx_id=41916195-326e-4f28-9526-13ef4c878933 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:53.704875670Z" level=info msg="device-session saved" ctx_id=41916195-326e-4f28-9526-13ef4c878933 dev_addr=01f8eea2 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:53.799708719Z" level=info msg="finished client unary call" ctx_id=41916195-326e-4f28-9526-13ef4c878933 grpc.code=OK grpc.ctx_id=91296d51-e78c-481f-b9e4-a2c649fac3ad grpc.duration=138.318779ms grpc.method=HandleUplinkData grpc.service=as.ApplicationServerService span.kind=client system=grpc
ns: time="2022-03-02T03:22:53.837449749Z" level=info msg="gateway/mqtt: publishing gateway command" command=down downlink_id=41916195-326e-4f28-9526-13ef4c878933 gateway_id=b827ebfffed7e6e4 qos=0 topic=gateway/b827ebfffed7e6e4/command/down
----> ns: time="2022-03-02T03:22:53.887277148Z" level=info msg="backend/gateway: downlink tx acknowledgement received" downlink_id=41916195-326e-4f28-9526-13ef4c878933 gateway_id=b827ebfffed7e6e4
ns: time="2022-03-02T03:22:53.895231733Z" level=info msg="device-session saved" ctx_id=41916195-326e-4f28-9526-13ef4c878933 dev_addr=01f8eea2 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:53.905574193Z" level=info msg="storage: downlink-frame saved" ctx_id=41916195-326e-4f28-9526-13ef4c878933 token=16785
ns: time="2022-03-02T03:22:56.247231193Z" level=info msg="gateway/mqtt: gateway stats packet received" gateway_id=b827ebfffed7e6e4 stats_id=58654513-85d9-49b2-a7ca-677906cf5b2d
ns: time="2022-03-02T03:22:56.307640759Z" level=info msg="storage: gateway state updated" ctx_id=58654513-85d9-49b2-a7ca-677906cf5b2d gateway_id=b827ebfffed7e6e4
ns: time="2022-03-02T03:22:56.423147194Z" level=info msg="finished client unary call" ctx_id=58654513-85d9-49b2-a7ca-677906cf5b2d grpc.code=OK grpc.ctx_id=fd097867-19e6-4904-8604-2bdc3f5b304c grpc.duration=81.738354ms grpc.method=HandleGatewayStats grpc.service=as.ApplicationServerService span.kind=client system=grpc
FCnt 2
ns: time="2022-03-02T03:22:56.957286836Z" level=info msg="gateway/mqtt: uplink frame received" gateway_id=b827ebfffed7e6e4 uplink_id=86939234-2e54-4ff9-b193-ce0972f4a705
ns: time="2022-03-02T03:22:57.199717779Z" level=info msg="uplink: frame(s) collected" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f mtype=ConfirmedDataUp uplink_ids="[86939234-2e54-4ff9-b193-ce0972f4a705]"
ns: time="2022-03-02T03:22:57.238074541Z" level=info msg="device gateway rx-info meta-data saved" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f dev_eui=3236500700160026
ns: time="2022-03-02T03:22:57.244401172Z" level=info msg="device-session saved" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f dev_addr=01f8eea2 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:57.248416938Z" level=info msg="sent uplink meta-data to network-controller" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f dev_eui=3236500700160026
ns: time="2022-03-02T03:22:57.408944574Z" level=info msg="gateway/mqtt: publishing gateway command" command=down downlink_id=e158db29-846d-47f0-81c2-b40ff652b89f gateway_id=b827ebfffed7e6e4 qos=0 topic=gateway/b827ebfffed7e6e4/command/down
ns: time="2022-03-02T03:22:57.449817190Z" level=info msg="device-session saved" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f dev_addr=01f8eea2 dev_eui=3236500700160026
----> ns: time="2022-03-02T03:22:57.480867378Z" level=info msg="backend/gateway: downlink tx acknowledgement received" downlink_id=e158db29-846d-47f0-81c2-b40ff652b89f gateway_id=b827ebfffed7e6e4
ns: time="2022-03-02T03:22:57.510334660Z" level=info msg="storage: downlink-frame saved" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f token=57688
ns: time="2022-03-02T03:22:57.515877336Z" level=info msg="finished client unary call" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f grpc.code=OK grpc.ctx_id=247797fc-8d1b-4d52-a02c-1f1bca3734b7 grpc.duration=268.411342ms grpc.method=HandleUplinkData grpc.service=as.ApplicationServerService span.kind=client system=grpc
ns: time="2022-03-02T03:22:57.538397023Z" level=info msg="device-session saved" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f dev_addr=01f8eea2 dev_eui=3236500700160026
ns: time="2022-03-02T03:22:57.545114631Z" level=info msg="sent downlink meta-data to network-controller" ctx_id=e158db29-846d-47f0-81c2-b40ff652b89f
AS log:
JOIN
as: time="2022-03-02T03:22:41.60104294Z" level=info msg="backend/joinserver: request received" message_type=JoinReq receiver_id=0000000000000000 sender_id=000000 transaction_id=187779681
as: time="2022-03-02T03:22:41.645955533Z" level=info msg="device-keys updated" ctx_id="<nil>" dev_eui=3236500700160026
as: time="2022-03-02T03:22:41.649984407Z" level=info msg="backend/joinserver: sending response" dev_eui=3236500700160026 message_type=JoinAns receiver_id=000000 result_code=Success sender_id=0000000000000000 transaction_id=187779681
FCnt 0
as: time="2022-03-02T03:22:49.639972759Z" level=info msg="device last-seen and dr updated" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f dev_eui=3236500700160026
as: time="2022-03-02T03:22:49.656400009Z" level=info msg="device activation updated" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f dev_addr=01f8eea2 dev_eui=3236500700160026
as: time="2022-03-02T03:22:49.67782403Z" level=info msg="integration/logger: logging event" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f dev_eui=3236500700160026 type=join
as: time="2022-03-02T03:22:49.685525679Z" level=info msg="integration/mqtt: publishing event" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f dev_eui=3236500700160026 qos=0 retain=false topic=application/1/device/3236500700160026/event/join
as: time="2022-03-02T03:22:49.705088785Z" level=info msg="metrics saved" aggregation="[MINUTE HOUR DAY MONTH]" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f name="device:3236500700160026"
as: time="2022-03-02T03:22:49.70803565Z" level=info msg="finished unary call with code OK" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f grpc.code=OK grpc.method=HandleUplinkData grpc.request.deadline="2022-03-02T03:22:50Z" grpc.service=as.ApplicationServerService grpc.start_time="2022-03-02T03:22:49Z" grpc.time_ms=115.714 peer.address="[::1]:34810" span.kind=server system=grpc
as: time="2022-03-02T03:22:49.737546303Z" level=info msg="integration/mqtt: publishing event" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f dev_eui=3236500700160026 qos=0 retain=false topic=application/1/device/3236500700160026/event/up
as: time="2022-03-02T03:22:49.727159777Z" level=info msg="integration/logger: logging event" ctx_id=8aae7825-2f8c-42ea-8c79-ff4a52488b6f dev_eui=3236500700160026 type=up
FCnt 1
as: time="2022-03-02T03:22:53.733138195Z" level=info msg="device last-seen and dr updated" ctx_id=91296d51-e78c-481f-b9e4-a2c649fac3ad dev_eui=3236500700160026
as: time="2022-03-02T03:22:53.766436456Z" level=info msg="metrics saved" aggregation="[MINUTE HOUR DAY MONTH]" ctx_id=91296d51-e78c-481f-b9e4-a2c649fac3ad name="device:3236500700160026"
as: time="2022-03-02T03:22:53.782219632Z" level=info msg="finished unary call with code OK" ctx_id=91296d51-e78c-481f-b9e4-a2c649fac3ad grpc.code=OK grpc.method=HandleUplinkData grpc.request.deadline="2022-03-02T03:22:54Z" grpc.service=as.ApplicationServerService grpc.start_time="2022-03-02T03:22:53Z" grpc.time_ms=109.813 peer.address="[::1]:34810" span.kind=server system=grpc
as: time="2022-03-02T03:22:53.786225423Z" level=info msg="integration/mqtt: publishing event" ctx_id=91296d51-e78c-481f-b9e4-a2c649fac3ad dev_eui=3236500700160026 qos=0 retain=false topic=application/1/device/3236500700160026/event/up
as: time="2022-03-02T03:22:53.781796654Z" level=info msg="integration/logger: logging event" ctx_id=91296d51-e78c-481f-b9e4-a2c649fac3ad dev_eui=3236500700160026 type=up
as: time="2022-03-02T03:22:56.371597124Z" level=info msg="gateway updated" ctx_id=fd097867-19e6-4904-8604-2bdc3f5b304c id=b827ebfffed7e6e4 name=local
as: time="2022-03-02T03:22:56.410356921Z" level=info msg="metrics saved" aggregation="[MINUTE HOUR DAY MONTH]" ctx_id=fd097867-19e6-4904-8604-2bdc3f5b304c name="gw:b827ebfffed7e6e4"
as: time="2022-03-02T03:22:56.414622679Z" level=info msg="finished unary call with code OK" ctx_id=fd097867-19e6-4904-8604-2bdc3f5b304c grpc.code=OK grpc.method=HandleGatewayStats grpc.service=as.ApplicationServerService grpc.start_time="2022-03-02T03:22:56Z" grpc.time_ms=66.776 peer.address="[::1]:34810" span.kind=server system=grpc
FCnt 2
as: time="2022-03-02T03:22:57.316915942Z" level=info msg="device last-seen and dr updated" ctx_id=247797fc-8d1b-4d52-a02c-1f1bca3734b7 dev_eui=3236500700160026
as: time="2022-03-02T03:22:57.378475351Z" level=info msg="integration/logger: logging event" ctx_id=247797fc-8d1b-4d52-a02c-1f1bca3734b7 dev_eui=3236500700160026 type=up
as: time="2022-03-02T03:22:57.430923292Z" level=info msg="integration/mqtt: publishing event" ctx_id=247797fc-8d1b-4d52-a02c-1f1bca3734b7 dev_eui=3236500700160026 qos=0 retain=false topic=application/1/device/3236500700160026/event/up
as: time="2022-03-02T03:22:57.478729503Z" level=info msg="metrics saved" aggregation="[MINUTE HOUR DAY MONTH]" ctx_id=247797fc-8d1b-4d52-a02c-1f1bca3734b7 name="device:3236500700160026"
as: time="2022-03-02T03:22:57.497619401Z" level=info msg="finished unary call with code OK" ctx_id=247797fc-8d1b-4d52-a02c-1f1bca3734b7 grpc.code=OK grpc.method=HandleUplinkData grpc.request.deadline="2022-03-02T03:22:58Z" grpc.service=as.ApplicationServerService grpc.start_time="2022-03-02T03:22:57Z" grpc.time_ms=245.256 peer.address="[::1]:34810" span.kind=server system=grpc
Redis content for the gateway key, where we can see there is no "down" message for FCnt 1 (although it was acknowledged).
127.0.0.1:6379> XRANGE lora:ns:gw:b827ebfffed7e6e4:stream:frame - +
JOIN
1) 1) "1646191361510-0" 03:22:41
2) 1) "up"
2) '0a1700000000000000000026001600075036328e87b64d12ae121108d8f3c6ce011a09087d100c1a03342f351a3e0a08b827ebfffed7e6e428ddffffffffffffffff0131666666666666204040015a007a04987365d482011034d5f339a1c443748fb11673b2c234d6880102320832365007001600263a0c0881c6fb90061082b5d4f201'
2) 1) "1646191361780-0" 03:22:41
2) 1) "down"
2) '0a1120f8d984c5e951a5102091324e2be3d389122428d8f3c6ce01300a6001820104987365d4420b087d100c1a03342f35200172040a02080518d28b032210795fcae2a24a4f49b8d360e0ca3f05352a08b827ebfffed7e6e43001420832365007001600264a0c0881c6fb9006108b9892f302'
FCnt 0
3) 1) "1646191369473-0" 03:22:49
2) 1) "up"
2) '0a1380a2eef8010000000a6c0e6a840f2297a4293c121108d8f3c6ce011a09087d100c1a03342f351a3e0a08b827ebfffed7e6e428dfffffffffffffffff0131000000000000214040015a007a0498ec81b48201103d626ee752c44e2195ed442f665a991888010220042a0401f8eea23a0c0889c6fb900610b793f3df01'
4) 1) "1646191369869-0" 03:22:49
2) 1) "down"
2) '0a0c60a2eef80120000046f8bcdf122428d8f3c6ce01300a600182010498ec81b4420b087d100c1a03342f35200172040a02080118cbf301221079cb52e5294d4041bc09855a5adf21dd2a08b827ebfffed7e6e430033a0401f8eea2420832365007001600264a0c0889c6fb900610d1fcbb9d03'
FCnt 1
5) 1) "1646191373616-0" 03:22:53
2) 1) "up"
2) '0a2180a2eef8010001001435d51141cf38a653cae137ac4cf60f1bbc1549871ec50586121108d8a8dfce011a09087d100c1a03342f351a400a08b827ebfffed7e6e428e4ffffffffffffffff01310000000000002140380240015a007a04992b37c4820110a9ee3c5920884786ab53cfc00a3d557888010220042a0401f8eea23a0c088dc6fb900610b6ff91a502'
FCnt 2
6) 1) "1646191377206-0" 03:22:57
2) 1) "up"
2) '0a1380a2eef8010002000aa8d45602070928821714121108d8f3c6ce011a09087d100c1a03342f351a3e0a08b827ebfffed7e6e428dfffffffffffffffff0131666666666666204040015a007a04996266bc820110869392342e544ff9b193ce0972f4a70588010220042a0401f8eea23a0b0891c6fb90061081e8fe61'
7) 1) "1646191377544-0" 03:22:57
2) 1) "down"
2) '0a0c60a2eef8012001009752c094122428d8f3c6ce01300a6001820104996266bc420b087d100c1a03342f35200172040a02080118d8c2032210e158db29846d47f081c2b40ff652b89f2a08b827ebfffed7e6e430033a0401f8eea2420832365007001600264a0c0891c6fb900610f0bca48202'
MQTT output from:
mosquitto_sub -t "application/1/device/3236500700160026/#" -t "gateway/b827ebfffed7e6e4/event/#" -T "gateway/b827ebfffed7e6e4/event/stats" -v -F "%I %t %p"
:
JOIN
2022-03-02T03:22:41+0000 gateway/b827ebfffed7e6e4/event/up
&P62???M???? }
4/5<
?'??????(?????????1ffffff @@z?seԂ4??9??Ct??s??4ֈ
2022-03-02T03:22:41+0000 gateway/b827ebfffed7e6e4/event/ack
?'??????ҋ"y_??JOI??`???5*
FCnt 0 UP (gateway)
2022-03-02T03:22:49+0000 gateway/b827ebfffed7e6e4/event/up
????
lj?"??)???? }
4/5<
?'??????(?????????1!@@z?쁴?=bn?R?N!??D/fZ??
2022-03-02T03:22:49+0000 application/1/device/3236500700160026/event/join {"applicationID":"1","applicationName":"MuninSensing","deviceName":"Nucleo-1","devEUI":"MjZQBwAWACY=","devAddr":"Afjuog==","rxInfo":[{"gatewayID":"uCfr//7X5uQ=","time":null,"timeSinceGPSEpoch":null,"rssi":-33,"loRaSNR":8.5,"channel":0,"rfChain":1,"board":0,"antenna":0,"location":{"latitude":0,"longitude":0,"altitude":0,"source":"UNKNOWN","accuracy":0},"fineTimestampType":"NONE","context":"mOyBtA==","uplinkID":"PWJu51LETiGV7UQvZlqZGA==","crcStatus":"CRC_OK"}],"txInfo":{"frequency":433175000,"modulation":"LORA","loRaModulationInfo":{"bandwidth":125,"spreadingFactor":12,"codeRate":"4/5","polarizationInversion":false}},"dr":0,"tags":{},"publishedAt":"2022-03-02T03:22:49.660025843Z"}
FCnt 0 UP (from AS)
2022-03-02T03:22:49+0000 application/1/device/3236500700160026/event/up {"applicationID":"1","applicationName":"MuninSensing","deviceName":"Nucleo-1","devEUI":"MjZQBwAWACY=","rxInfo":[{"gatewayID":"uCfr//7X5uQ=","time":null,"timeSinceGPSEpoch":null,"rssi":-33,"loRaSNR":8.5,"channel":0,"rfChain":1,"board":0,"antenna":0,"location":{"latitude":0,"longitude":0,"altitude":0,"source":"UNKNOWN","accuracy":0},"fineTimestampType":"NONE","context":"mOyBtA==","uplinkID":"PWJu51LETiGV7UQvZlqZGA==","crcStatus":"CRC_OK"}],"txInfo":{"frequency":433175000,"modulation":"LORA","loRaModulationInfo":{"bandwidth":125,"spreadingFactor":12,"codeRate":"4/5","polarizationInversion":false}},"adr":false,"dr":0,"fCnt":0,"fPort":10,"data":"zuIeYgEA","objectJSON":"{\"fPort\":10,\"frame_number\":1,\"size\":0,\"timestamp\":0}","tags":{},"confirmedUplink":true,"devAddr":"Afjuog==","publishedAt":"2022-03-02T03:22:49.692630354Z","deviceProfileID":"8917dda4-c938-4449-a5d1-45e5bcfda112","deviceProfileName":"Munin Sensor"}
FCnt 0 ACK to NS
2022-03-02T03:22:49+0000 gateway/b827ebfffed7e6e4/event/ack
?'????????"y?R?)M@A? ?ZZ?!?*
FCnt 1 UP (gateway)
2022-03-02T03:22:53+0000 gateway/b827ebfffed7e6e4/event/up
!????5?A?8?S??7?L?I??ب?? }
4/5>
?'??????(?????????1!@8@z?+7Ă??<Y ?G??S??
=Ux?
FCnt 1 UP (AS)
2022-03-02T03:22:53+0000 application/1/device/3236500700160026/event/up {"applicationID":"1","applicationName":"MuninSensing","deviceName":"Nucleo-1","devEUI":"MjZQBwAWACY=","rxInfo":[{"gatewayID":"uCfr//7X5uQ=","time":null,"timeSinceGPSEpoch":null,"rssi":-28,"loRaSNR":8.5,"channel":2,"rfChain":1,"board":0,"antenna":0,"location":{"latitude":0,"longitude":0,"altitude":0,"source":"UNKNOWN","accuracy":0},"fineTimestampType":"NONE","context":"mSs3xA==","uplinkID":"qe48WSCIR4arU8/ACj1VeA==","crcStatus":"CRC_OK"}],"txInfo":{"frequency":433575000,"modulation":"LORA","loRaModulationInfo":{"bandwidth":125,"spreadingFactor":12,"codeRate":"4/5","polarizationInversion":false}},"adr":false,"dr":0,"fCnt":1,"fPort":20,"data":"zuIeYgIHDwsHBZgFlwPaBVkFTwA=","objectJSON":"{\"fPort\":20,\"frame_number\":2,\"size\":7,\"timestamp\":0}","tags":{},"confirmedUplink":true,"devAddr":"Afjuog==","publishedAt":"2022-03-02T03:22:53.752886164Z","deviceProfileID":"8917dda4-c938-4449-a5d1-45e5bcfda112","deviceProfileName":"Munin Sensor"}
FCnt 1 ACK to NS
2022-03-02T03:22:53+0000 gateway/b827ebfffed7e6e4/event/ack
?'????????"A?a?2nO(?&?L??3*
FCnt 2 UP (gateway)
2022-03-02T03:22:56+0000 gateway/b827ebfffed7e6e4/event/up
????
??V (???? }
4/5<
?'??????(?????????1ffffff @@z?bf?????4.TO???? r???
FCnt 2 UP (AS)
2022-03-02T03:22:57+0000 application/1/device/3236500700160026/event/up {"applicationID":"1","applicationName":"MuninSensing","deviceName":"Nucleo-1","devEUI":"MjZQBwAWACY=","rxInfo":[{"gatewayID":"uCfr//7X5uQ=","time":null,"timeSinceGPSEpoch":null,"rssi":-33,"loRaSNR":8.2,"channel":0,"rfChain":1,"board":0,"antenna":0,"location":{"latitude":0,"longitude":0,"altitude":0,"source":"UNKNOWN","accuracy":0},"fineTimestampType":"NONE","context":"mWJmvA==","uplinkID":"hpOSNC5UT/mxk84JcvSnBQ==","crcStatus":"CRC_OK"}],"txInfo":{"frequency":433175000,"modulation":"LORA","loRaModulationInfo":{"bandwidth":125,"spreadingFactor":12,"codeRate":"4/5","polarizationInversion":false}},"adr":false,"dr":0,"fCnt":2,"fPort":10,"data":"1uIeYgMA","objectJSON":"{\"fPort\":10,\"frame_number\":3,\"size\":0,\"timestamp\":0}","tags":{},"confirmedUplink":true,"devAddr":"Afjuog==","publishedAt":"2022-03-02T03:22:57.349608035Z","deviceProfileID":"8917dda4-c938-4449-a5d1-45e5bcfda112","deviceProfileName":"Munin Sensor"}
FCnt 2 ACK to NS (although the Down command now contains FCnt_Down 1, as if the previous one wasn't ACK'd)
2022-03-02T03:22:57+0000 gateway/b827ebfffed7e6e4/event/ack
?'????????"?X?)?mG??´?R??*
Updated title and description to match the problem more closely.
I've also just tried using the Chirpstack OS image (full) for Raspberry Pi Zero W. The problem still persists using the Chirpstack OS image, configured for EU433, with all the rest as default (no RAK forwarder, or any other application installed).
It turns out this only happens when running the full chirpstack stack in a Pi Zero W. When the same stack runs on a separate computer, with the RPi running the packet forwarder, everything works normally. Also tried with TTN and everything worked.
I am closing the issue, as it's not a bug per se, but if you have some free time I'll be happy to dig with you as to why this happens without any error messages. If you need a RPi Zero let me know :)
What happened?
Received the same UnconfirmedDataDownlink (i.e. with the same FCnt) twice, for two consecutive Uplinks. The end device sees both ACK correctly, and the NS appears to receive the TXACK from the gateway in the logs, but the first ACK is not stored on redis nor shown in the AS interface.
What did you expect?
Receive an ACK with an increased FCnt, and have the previous one stored.
Steps to reproduce this issue
Steps:
I am attaching the app screenshot, end-device application log extract, redis extract (from the gw key) and the network-server log. I am not certain that the problem is in chirpstack because this seems like a very common use case, but looking at redis it looks like a chirpstack issue. Any pointers to where to look next?
These are log extracts from the end-device application, where we can see that the ACKs are correctly received up to UpFCnt 6, where it is the same as UpFCnt 5.
I am not sure whether the issue is in ChirpStack or the RAK2245 forwarder, but I went into the redis stream and found that the ACK is generated at the wrong time, but strangely enough also generated at the right time although it's not in the redis stream:
Note: the duplicated key "2)" is just my translation of the ASCII bytestring into an array of uint_8.
Could you share your log output?
Your Environment
RAK lora_pkt_fwd version: