Cumulocity-IoT / cumulocity-devicemanagement-agent

Cumulocity Reference Agent written in Python to demonstrate most of the Device Management Capabilities of Cumulocity IoT
Apache License 2.0
26 stars 20 forks source link

dangling `EXECUTING` operation #37

Closed 6293 closed 3 years ago

6293 commented 3 years ago

When an agent has accidentally shut down after it sent 501 (EXECUTING) and before 502 / 503 (failure / success), it creates a "dangling" operation in the Cumulocity server. After the device restart, this operation is not visible from the agent since the cloud will not resend EXECUTING operations (they only resend PENDING operations).

Besides, if you create a new operation which has the same fragment as the dangling operation, the dangling operation would be set to SUCCESS and the new one is set to EXECUTING. This is because the agent would successfully send 501 then 503 to the cloud, but 503 will only update the old operation while 501 is applied to the new one.

switschel commented 3 years ago

We are aware of that see this #17. Solution can be on Agent Start mainly using the initializer to set all dangling operation of a module (fragment) to FAILED with Failed Reasons "Operation was interrupted and could not be executed completely".

I will implement a proposal.

switschel commented 3 years ago

Solved & Pushed in main branch.