Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Malformed Discovery Message causes c-flo to stop #35

Closed
uwekamper opened this issue May 14, 2017 · 2 comments
Closed

Malformed Discovery Message causes c-flo to stop #35

uwekamper opened this issue May 14, 2017 · 2 comments
Assignees

Comments

@uwekamper
Copy link
Member

A previous version of cdmmpqtt.py (https://github.com/c-base/cdmmpqtt) did publish a discovery message that did not include the "inports"-list. This caused c-flo to stop working. Here is the error message:

May 14 03:31:26 c-flo node[3134]: Participant discovery failed: Discovery message missing .inports
May 14 03:31:26 c-flo node[3134]:  Error: Discovery message missing .inports
May 14 03:31:26 c-flo node[3134]:     at Coordinator.participantDiscovered (/opt/c-flo/node_modules/msgflo/src/coordinator.coffee:168:11)
May 14 03:31:26 c-flo node[3134]:     at Coordinator.handleFbpMessage (/opt/c-flo/node_modules/msgflo/src/coordinator.coffee:160:8)
May 14 03:31:26 c-flo node[3134]:     at /opt/c-flo/node_modules/msgflo/src/coordinator.coffee:135:14
May 14 03:31:26 c-flo node[3134]:     at MessageBroker.Client._onMessage (/opt/c-flo/node_modules/msgflo-nodejs/lib/mqtt.js:165:22)
May 14 03:31:26 c-flo node[3134]:     at MqttClient.<anonymous> (/opt/c-flo/node_modules/msgflo-nodejs/lib/mqtt.js:58:26)
May 14 03:31:26 c-flo node[3134]:     at emitThree (events.js:116:13)
May 14 03:31:26 c-flo node[3134]:     at MqttClient.emit (events.js:197:7)
May 14 03:31:26 c-flo node[3134]:     at MqttClient._handlePublish (/opt/c-flo/node_modules/mqtt/lib/client.js:816:12)
May 14 03:31:26 c-flo node[3134]:     at MqttClient._handlePacket (/opt/c-flo/node_modules/mqtt/lib/client.js:286:12)
May 14 03:31:26 c-flo node[3134]:     at process (/opt/c-flo/node_modules/mqtt/lib/client.js:242:12)
May 14 03:31:26 c-flo node[3134]:     at Writable.writable._write (/opt/c-flo/node_modules/mqtt/lib/client.js:252:5)
May 14 03:31:26 c-flo node[3134]:     at doWrite (/opt/c-flo/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:338:64)
May 14 03:31:26 c-flo node[3134]:     at writeOrBuffer (/opt/c-flo/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:327:5)
May 14 03:31:26 c-flo node[3134]:     at Writable.write (/opt/c-flo/node_modules/mqtt/node_modules/readable-stream/lib/_stream_writable.js:264:11)
May 14 03:31:26 c-flo node[3134]:     at Socket.ondata (_stream_readable.js:555:20)
May 14 03:31:26 c-flo node[3134]:     at emitOne (events.js:96:13)
May 14 03:31:26 c-flo node[3134]:     at Socket.emit (events.js:191:7)
May 14 03:31:26 c-flo node[3134]:     at readableAddChunk (_stream_readable.js:176:18)
May 14 03:31:26 c-flo node[3134]:     at Socket.Readable.push (_stream_readable.js:134:10)
May 14 03:31:26 c-flo node[3134]:     at TCP.onread (net.js:563:20)
May 14 03:31:26 c-flo node[3134]:
May 14 03:31:26 c-flo node[3134]:  {"command":"participant","protocol":"discovery","payload":{"component":"c-base/music-player","label":"Show URL on a public screen.","outports":[{"queue":"megablast/current_song","type":"object","description":"JSON object of the current song being played.","id":"current_song"}],"role":"megablast","id":"cdmmpqtt83779605327991","icon":"television"}}

Restarting the c-flo.service using systemctl would then result in the following error.

May 14 04:04:22 c-flo node[3854]: --forever enabled
May 14 04:05:03 c-flo node[3854]: /opt/c-flo/node_modules/msgflo/src/msgflo.coffee:31
May 14 04:05:03 c-flo node[3854]:         throw err;
May 14 04:05:03 c-flo node[3854]:         ^
May 14 04:05:03 c-flo node[3854]: Error: Waiting for participant nerdctrl-display timed out
May 14 04:05:03 c-flo node[3854]:     at Timeout._onTimeout (/opt/c-flo/node_modules/msgflo/src/coordinator.coffee:74:21)
May 14 04:05:03 c-flo node[3854]:     at ontimeout (timers.js:380:14)
May 14 04:05:03 c-flo systemd[1]: c-flo.service: Main process exited, code=exited, status=1/FAILURE
May 14 04:05:03 c-flo systemd[1]: c-flo.service: Unit entered failed state.
May 14 04:05:03 c-flo systemd[1]: c-flo.service: Failed with result 'exit-code'.

Stopping c-flo, reverting graphs/c-base.json to the last working version and then restart c-flo resolved the issue.

To reproduce the issue one can create a discovery message like this:

discovery_message = {
        "command": "participant",
        "protocol": "discovery",
        "payload": {
            "component": "c-base/music-player",
            "label": "Show URL on a public screen.",
            # "inports": [], ### inports missing ###
            "outports": [
                {
                    "queue": "%s/current_song" % mqtt_client_name,
                    "type": "object",
                    "description": "JSON object of the current song being played.",
                    "id": "current_song",
                }
            ],
            "role": "%s" % mqtt_client_name,
            "id": mqtt_client_id,
            "icon": "television"
        },
    }
@bergie
Copy link
Member

bergie commented May 16, 2017

Moved to upstream msgflo/msgflo#135

@bergie bergie closed this as completed May 16, 2017
@bergie
Copy link
Member

bergie commented May 16, 2017

OK, so red herring. MsgFlo logged a warning about malformed discovery message, but the restart failed due to msgflo/msgflo#133

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants