Closed antho1404 closed 4 years ago
Similar issue when ctrl+c during any step. The environment is not cleanup:
➜ js-sdk git:(master) ./packages/cli/bin/run process:dev ../process/process-webhook.yml --image mesg/engine:local
✔ Starting environment
⠧ Compiling process
Creating process
Fetching process's logs
^C
➜ js-sdk git:(master) docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
95499f1d029f mesg/engine:local "./engine" About a minute ago Up About a minute 0.0.0.0:1317->1317/tcp, 0.0.0.0:50052->50052/tcp mesg_engine
Yes, the cleaning event is only at the end and should be moved to the first instruction of the command and cover more signals (only SIGINT
for now).
Some directions to solve that: https://stackoverflow.com/questions/14031763/doing-a-cleanup-action-just-before-node-js-exits
Any function during the stopping of logs, services, processes, and environment should have their errors catcher so the CLI can continue to cleanup the other stuff.
Got error because runner already stopped from other terminal:
➜ js-sdk git:(feature/dev-command-framework) ./packages/cli/bin/run dev ../app --version=local
✔ Starting environment
✔ Creating process "process-test.yml"
✔ Fetching logs
^C › Warning: Result stream error: 1 CANCELLED: Cancelled
✔ Stopping logs
✖ Stopping running services
→ invalid request: runner "DAqsSEWMEsEjD3txBbWVMVUKioYo1YzTmjjBYPC3MxSS" not found
Deleting processes
Stopping environment
(node:48941) UnhandledPromiseRejectionWarning: Error: invalid request: runner "DAqsSEWMEsEjD3txBbWVMVUKioYo1YzTmjjBYPC3MxSS" not found
at Runner.<anonymous> (/Users/nico/Development/MESG/js-sdk/packages/api/lib/util/lcd.js:27:23)
at Generator.next (<anonymous>)
at fulfilled (/Users/nico/Development/MESG/js-sdk/packages/api/lib/util/lcd.js:5:58)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(node:48941) 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:48941) [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.
Engine is still running:
➜ js-sdk git:(feature/dev-command-framework) docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
e97b61bfbac4 mesg/engine:local "./engine" 4 minutes ago Up 4 minutes 0.0.0.0:1317->1317/tcp, 0.0.0.0:50052->50052/tcp mesg_engine
Issue migrated to liteflow-labs/liteflow-js#18
When the command
service:dev
throws an error, the engine is not stopped and the next use ofservice:dev
doesn't stop the engine and the running service:Originally posted by @NicolasMahe in https://github.com/mesg-foundation/js-sdk/pull/197#issuecomment-601670084