Skip to content
This repository was archived by the owner on Jan 23, 2025. It is now read-only.
This repository was archived by the owner on Jan 23, 2025. It is now read-only.

Server refuses to die in container #5

@McSneaky

Description

@McSneaky

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)

https://gitlab.com/McSneaky/youtube-downloader

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions