0%

Azure IoTHub Gateway v2 - protocol error: received flow without next-incoming-id after session established

Description:

we facing the azure iot hub bug today,

after upgrade the azure iot hub gateway to GWV2 version, the dc-traffic-forwarder servcie can no longer retreive data from azure iot hub

image-20240612105900760

the error message from the azure iot hub is:

1
2
3
4
5
6
7
panic: subscribe azure iot event failed, err: protocol error: received flow without next-incoming-id after session established

goroutine 13 [running]:
dc-traffic-forwarder/internal/iothub.(*IotHubBroker).Subscribe.func1.1()
/go/src/dc-traffic-forwarder/internal/iothub/init.go:90 +0x1f9
created by dc-traffic-forwarder/internal/iothub.(*IotHubBroker).Subscribe.func1
/go/src/dc-traffic-forwarder/internal/iothub/init.go:48 +0xfb

Temporary Fix:

after doing some researching, we find this post and understand that this issue is cause by azure iot hub violate the amqp protocol (not sending the next-incoming-id in the flow frame), therefore this libaray close connection so we can not get any message from azure iot hub.

截圖 2024-06-12 上午11.04.20

the dependency diagram look like this:

dc-traffic-forwarder --depends--> deviceonbi/iothub --fork--> amenzhinsky/iothub --depends--> Azure/go-amqp (this library close the connection)

to fix this issue, we fork the Azure/go-amqp library and modify the next-incoming-id validation part as a temp fix

截圖 2024-06-11 晚上9.42.31

after modify the next incoming id, the links for the sender and receiver will be revert for some reason, therefore i need to add another fix to get the correct link by the key name and role by checking if the link is retrive successfully, if not, revert the role to get again.

截圖 2024-06-11 晚上9.42.40

截圖 2024-06-12 上午11.16.05