MDSLab / s4t-lightning-rod

Implementation of the Lightning-rod, the Stack4Things node-side probe (this version works with the standalone version of IoTronic)
http://stack4things.unime.it/
Apache License 2.0
3 stars 8 forks source link

Why is socat wrapper is run in a fork? [question] #32

Closed KostyaEsmukov closed 8 years ago

KostyaEsmukov commented 8 years ago

Hello,

Please explain why is socat wrapper (network-wrapper.js) is run in a fork? Does it provide a lot of output thus blocking the event loop or was it just a historical decision?

It's not an obvious decision anyway, and it would be better (IMO) to include this functionality in the core LR process (except if there is a real need for a separate event loop here).

Related to #19

Kind regards, Kostya.

npeditto commented 8 years ago

Hi Kostya,

in the past we decided to create a socat wrapper in order to manage in modular way the socat process avoiding the to make an all-in-one process that could be crash. In this way if there is a problem in the socat process we avoid to compromise the main LR one. Moreover, in this way we can trigger easly the events occurred during the tunnels creation phases. Of course it was also possible to create a single process but at the expense of the process modularity.

Nicola

KostyaEsmukov commented 8 years ago

Hi Nicola,

I guess the only advantage of running socat wrapper in a separate process is avoiding a lock of the core process's event loop by too often stdout/stderr events.

Handling crashes gently is harder than in an all-in-one-process approach:

OK, I will leave it as a separate process while taking into account the cases above.

Thank you.

options.detached

Note that child processes may continue running after the parent exits regardless of whether they are detached or not. See setsid(2) for more information. https://nodejs.org/api/child_process.html#child_process_options_detached