signalk-server
signalk-server copied to clipboard
Bad acting plugins can crash the server
I'd fix this if I knew how....
When processing REST requests to a plugin, it's possible to crash the server. For example, I had a bug where was sending the response twice and server exited with:
_http_outgoing.js:356
throw new Error('Can\'t set headers after they are sent.');
^
Error: Can't set headers after they are sent.
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:356:11)
at ServerResponse.header (/usr/local/src/signalk-server-node.master/node_modules/express/lib/response.js:719:10)
at ServerResponse.send (/usr/local/src/signalk-server-node.master/node_modules/express/lib/response.js:164:12)
at /usr/local/src/signalk-push-notifications/index.js:191:24
at FSReqWrap.oncomplete (fs.js:123:15)
Perhaps the plugins-config-data file for the plugin should be removed if the plugin errs out, so as to disable and reset the plugin? If I remove "dependencies" in the plugin config, the plugin crashes the server. One example is prop slip calculation. You need to have propulsion instances in the defaults.json for it to select instances, but if these are later removed, the server crashes because it cannot map the instance.
See also #1467