signalk-server icon indicating copy to clipboard operation
signalk-server copied to clipboard

Bad acting plugins can crash the server

Open sbender9 opened this issue 9 years ago • 2 comments

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)

sbender9 avatar Nov 16 '16 01:11 sbender9

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.

joabakk avatar Jul 17 '17 16:07 joabakk

See also #1467

tkurki avatar Feb 11 '23 09:02 tkurki