kengz / spacy-nlp

Expose Spacy nlp text parsing to Nodejs (and other languages) via socketIO
MIT License
225 stars 58 forks source link

Support for SIGTERM handling not possible if spacy-nlp package is included in project #44

Open lalitgupta-blr opened 2 years ago

lalitgupta-blr commented 2 years ago

Background: SIGTERM handling is required for graceful shutdown of node based micro service while running on Kubernetes. An example for SIGTERM graceful handling by node project would the following code (can be tested by sending "kill -15 pid" to the node process id). process.on('SIGTERM', () => { console.log('Just Received SIGTERM.'); });

Issue: When a node project is dependant upon spacy-nlp packge then even if the above code is included in the node project, sending "kill -15 pid" to node process id results in error "INFO Exit: killed ioClient.js children" and node process exits without graceful shutdown.

lalitgupta-blr commented 2 years ago

After commenting the following lines, the SIGTERM is getting handled by the project file correctly.

node_modules/poly-socketio/src/start-io.js node_modules/spacy-nlp/src/start-io.js

The reason is that these two files have SIGTERM handlers process.exit() is being called by them.

Is there is possibility of getting process.exit() called with some configuration/settings?