ami-iit / yarp-openmct

Repo for YARP and OpenMCT integration.
BSD 3-Clause "New" or "Revised" License
6 stars 1 forks source link

We get "stderr: Ports refresh request not sent!" even when the request is sent successfully #162

Closed nunoguedelha closed 1 year ago

nunoguedelha commented 1 year ago

In server.js, procHandler.requestPortsRefresh() never returns true, even in case of success.

info:Yarp command successfully started...
[OPEN-MCT STATIC SERVER] stderr: Ports refresh request not sent!

Fixed in #164 .

nunoguedelha commented 1 year ago

process.send(...) returns a boolean, set to true if the message was sent successfully, and false otherwise. So OpenMctServerHandlerChildProc.prototype.requestPortsRefresh() just needs to return that value.

nunoguedelha commented 1 year ago

Also fixed UnhandledPromiseRejectionWarning error due to unhandled Promise rejection in https://github.com/ami-iit/yarp-openmct/blob/79574337223349713dfa51b94da633fb5da9f010/iCubTelemVizServer/configHandler.js#L64-L71

(node:71178) UnhandledPromiseRejectionWarning: Error: spawn yarp ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
    at onErrorNT (internal/child_process.js:467:16)
    at processTicksAndRejections (internal/process/task_queues.js:82:21)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:71178) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:71178) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[OPEN-MCT STATIC SERVER] stderr: Debugger listening on ws://127.0.0.1:56478/41eb7164-2760-4838-b41a-b09fcb1d0dfd
For help, see: https://nodejs.org/en/docs/inspector

Now, when such failure occurs, we get the error shown below, Yarp Text Logging visualiisation is not available, and the rest of the visualiser features work properly.

Failed running Yarp port names retrieval: Error: spawn yarp ENOENT./n
        returning empty array of ports
Yarp port name regexp @{^\/log\/.*\[YarpJS_WholeBodyDynamics\].*$} does not match any existing ports
Yarp port name regexp @{\[walkingModule\]} does not match any existing ports