botpress / nlu

This repo contains every ML/NLU related code written by Botpress in the NodeJS environment. This includes the Botpress Standalone NLU Server.
22 stars 21 forks source link

fix(worker): do not reuse a process if it exited since last usage #199

Closed franklevasseur closed 2 years ago

franklevasseur commented 2 years ago

Description

this commit is basically a line-by-line copy of #135 to bring back the fix on master

How to test

  1. reproduce the bug

    1. using Botpress latest version, do a training on any bot and locate the following log in your terminal: [NLU] Engine Training worker successfully started on process with pid 92926.
    2. once the training is done, run kill -9 92926 with the pid displayed in the log above
    3. try training again, this should fail
  2. package a new nlu bin from this branch

    1. package a new nlu binary from source using cmd yarn package [--linux|--darwin|--win]
    2. make sure the binary is located at <nlu-project-root>/dist/nlu-v0_1_9-YOUR_OS-x64
  3. make sure this branches fixes the issue reproduced at step 1

    1. copy the file created at step 2 and paste in <bp-root>/bin/nlu. This will override the previously used nlu server
    2. try reproducing the issue like in step 1, but this time locate the following log in your terminal [NLU] Engine The following workers have died since last usage: [92926]. This indicates that the fix works.