Skip to content

parsing error on c8y/devicecontrol/notifications topic if more than 1 operation is present #3297

@reubenmiller

Description

@reubenmiller

Describe the bug

thin-edge.io does not parse the message body of c8y/devicecontrol/notifications correctly when there are multiple operations are included in a single message.

The following error is shown on the te/errors topic showing the parsing error.

[te/errors] Failed to convert a message on topic 'c8y/devicecontrol/notifications': trailing characters at line 2 column 1

See the additional context section for a full example showing the payload with multiple operations in a single MQTT message payload.

To Reproduce

  1. Disconnect the device from the internet

  2. Wait until the bridge registers the disconnection

  3. Create at least 2 operations

  4. Subscribe to the local MQTT broker (to monitor the output)

    tedge mqtt sub '#'
  5. Connect the device to the internet and wait for the bridge to connect again

  6. Inspect the tedge mqtt sub output

Expected behavior

thin-edge.io should support parsing the message payload which includes multiple cloud operations in the same message received on the c8y/devicecontrol/notifications topic.

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] Debian GNU/Linux 12 (bookworm)
Hardware [incl. revision] unknown
System-Architecture Linux tedge 6.8.0-39-generic #39-Ubuntu SMP PREEMPT_DYNAMIC Sat Jul 6 02:50:39 UTC 2024 aarch64 GNU/Linux
thin-edge.io version tedge 1.3.2~388+g6388202

Additional context

MQTT Output

The snippet below shows an example of a message received from Cumulocity on the c8y/devicecontrol/notifications topic which includes multiple operations (one per line)

[c8y/devicecontrol/notifications] {"delivery":{"log":[{"time":"2024-12-14T11:52:34.224Z","status":"PENDING"},{"time":"2024-12-14T11:52:34.240Z","status":"SEND"},{"time":"2024-12-14T12:54:47.398Z","status":"PENDING"},{"time":"2024-12-14T12:54:47.419Z","status":"SEND"}],"time":"2024-12-14T12:54:47.565Z","status":"PENDING"},"agentId":"6242671887","creationTime":"2024-12-14T11:52:34.184Z","deviceId":"6242671887","id":"42686600","status":"PENDING","description":"Retrieve tedge-configuration-plugin configuration snapshot from device mostest001","c8y_UploadConfigFile":{"type":"tedge-configuration-plugin"},"externalSource":{"externalId":"mostest001","type":"c8y_Serial"}}
{"delivery":{"log":[{"time":"2024-12-14T12:54:47.398Z","status":"PENDING"},{"time":"2024-12-14T12:54:47.449Z","status":"SEND"}],"time":"2024-12-14T12:54:47.565Z","status":"PENDING"},"agentId":"6242671887","creationTime":"2024-12-14T12:53:51.718Z","deviceId":"6242671887","id":"42686668","status":"PENDING","description":"Retrieve tedge-log-plugin configuration snapshot from device mostest001","c8y_UploadConfigFile":{"type":"tedge-log-plugin"},"externalSource":{"externalId":"mostest001","type":"c8y_Serial"}}
{"delivery":{"log":[{"time":"2024-12-14T12:54:47.398Z","status":"PENDING"},{"time":"2024-12-14T12:54:47.461Z","status":"SEND"}],"time":"2024-12-14T12:54:47.565Z","status":"PENDING"},"agentId":"6242671887","creationTime":"2024-12-14T12:53:56.793Z","deviceId":"6242671887","id":"42686670","status":"PENDING","description":"Retrieve mosquitto.conf configuration snapshot from device mostest001","c8y_UploadConfigFile":{"type":"mosquitto.conf"},"externalSource":{"externalId":"mostest001","type":"c8y_Serial"}}
{"delivery":{"log":[{"time":"2024-12-14T12:54:47.398Z","status":"PENDING"},{"time":"2024-12-14T12:54:47.472Z","status":"SEND"}],"time":"2024-12-14T12:54:47.565Z","status":"PENDING"},"agentId":"6242671887","creationTime":"2024-12-14T12:54:09.131Z","deviceId":"6242671887","id":"42686672","status":"PENDING","c8y_LogfileRequest":{"searchText":"","logFile":"all-workflows","dateTo":"2024-12-14T13:54:03+0100","dateFrom":"2024-12-13T13:54:03+0100","maximumLines":1000},"description":"Log file request","externalSource":{"externalId":"mostest001","type":"c8y_Serial"}}
{"delivery":{"log":[{"time":"2024-12-14T12:54:47.398Z","status":"PENDING"},{"time":"2024-12-14T12:54:47.482Z","status":"SEND"}],"time":"2024-12-14T12:54:47.565Z","status":"PENDING"},"agentId":"6242671887","creationTime":"2024-12-14T12:54:19.489Z","deviceId":"6242671887","id":"42686674","status":"PENDING","c8y_Command":{"text":"ls"},"description":"Execute shell command","externalSource":{"externalId":"mostest001","type":"c8y_Serial"}}
[c8y/s/ds] 526,mostest001,tedge-configuration-plugin
526,mostest001,tedge-log-plugin
526,mostest001,mosquitto.conf
522,mostest001,all-workflows,2024-12-13T13:54:03+0100,2024-12-14T13:54:03+0100,,1000
511,mostest001,ls
[te/errors] Failed to convert a message on topic 'c8y/devicecontrol/notifications': trailing characters at line 2 column 1

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingtheme:c8yTheme: Cumulocity related topics

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions