Skip to content

SIGSEGV handler causes infinite loop if signal raised from within #25762

Closed as not planned
@gireeshpunathil

Description

@gireeshpunathil
process.on('SIGSEGV', (s) => {
  console.log(`program crashed with ${signum}`)
})
// some code that causes node to hard crash, not abort (such as *(int *) 0 = 0;)

this causes node to loop tight with high CPU. On the first look I was thinking it keeps calling the handler but that was not the case.

in libuv, the signals (internal or external) are intercepted in uv__signal_handler .

  • After all the processing, it returns from the signal stack, which causes the faulty instruction to be re-entered, leading to the tight loop.
  • it writes to the signal's pipefd, but the thread is never able to reach there to process it and invoke the callback.

These questions come to my mind:

  • Is it meaningful to resume to the execution context on internal fatal signals?
  • If yes, where should it resume?
  • If no, what it should do?

IMO the embedder should decide / control these?

@nodejs/libuv @nodejs/process

Metadata

Metadata

Assignees

No one assigned

    Labels

    lib / srcIssues and PRs related to general changes in the lib or src directory.processIssues and PRs related to the process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions