This repository was archived by the owner on Jan 23, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 18
Server refuses to die in container #5
Copy link
Copy link
Open
Description
SIGINT seems to be ignored by server. HTTP server exposes .kill() and .close() but default listener for SIGINT seems to be missing
Package version
Adonis packages
"@adonisjs/assembler": "^1.3.4",
"@adonisjs/ace": "^6.8.4",
"@adonisjs/core": "^5.0.0-preview.4",
"@adonisjs/fold": "^6.3.4",
Node.js and npm version
NodeJS: 13.9.0
NPM: 6.13.7
Sample Code (to reproduce the issue)
When building container and setting start command as CMD [ "node", "./build/server.js" ]
Container does not die gracefully with SIGINT since SIGINT is sent to process, which just ignores it
Fix is to add process.on('SIGINT') yourself to some part of application, server.ts for example
// server.ts (original)
new Ignitor(__dirname)
.httpServer()
.start()
.catch(console.error)Workaround is to chop it into multiple pieces and adding SIGINT listener
// server.ts (workaround)
const server = new Ignitor(__dirname)
.httpServer()
server.start()
.catch(console.error)
// Without it process won't die in container
process.on('SIGINT', () => {
server.kill(10)
})BONUS (a sample repo to reproduce the issue)
TemaSM
Metadata
Metadata
Assignees
Labels
No labels