Subject: [bug#51838] [PATCH v3 32/43] gnu: Add node-segfault-handler.

From: Pierre Langlois <[email-masked]>
Date: Sun, 12 Dec 2021 16:31:45 +0000

Philip McGrath <[email-masked]> writes:

> * gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
> ---
>  gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
>  1 file changed, 35 insertions(+)
>
> diff --git a/gnu/packages/node-xyz.scm b/gnu/packages/node-xyz.scm
> index 196fa55a39..27506062ba 100644
> --- a/gnu/packages/node-xyz.scm
> +++ b/gnu/packages/node-xyz.scm
> @@ -856,3 +856,38 @@ (define-public node-bindings
>  checks @emph{all} the possible locations that a native addon would be built
>  at, and returns the first one that loads successfully.")
>      (license license:expat)))
> +
> +(define-public node-segfault-handler
> +  (package
> +    (name "node-segfault-handler")
> +    (version "1.3.0")
> +    (source
> +     (origin
> +       (method git-fetch)
> +       (uri (git-reference
> +             (url "https://github.com/ddopson/node-segfault-handler")
> +             (commit (string-append "v" version))))
> +       (file-name (git-file-name name version))
> +       (sha256
> +        (base32 "07nbw35wvrr18kmh8f388v4k5mpjgyy0260bx0xzjdv795i3xvfv"))))
> +    (native-inputs
> +     `(("python" ,python)))
> +    (inputs
> +     `(("node-bindings" ,node-bindings)
> +       ("node-nan" ,node-nan)))
> +    (build-system node-build-system)
> +    (arguments
> +     ;; there are no tests
> +     `(#:tests? #f))
> +    (home-page "https://github.com/ddopson/node-segfault-handler")
> +    (synopsis "Catches @code{SIGSEGV} and prints diagnostic information")
> +    (description "This package is a tool for debugging Node.js C/C++ native
> +code modules, and is safe to use in production environments.  Normally, when a
> +bug is triggered in native code, the @code{node} process simply ends with no
> +helpful information.  In production, this can manifest as worker processes
> +restarting for seemingly no reason.  Running @code{node} in @code{gdb} is
> +messy and infeasible for a production environment.  Instead, this module will
> +sit unobtrusively doing nothing (zero perf impact) as long as Node.js is
> +well-behaved.  If a @code{SIGSEGV} signal is raised, the module will print a
> +native stack trace to both STDERR and to a timestamped file.")

I'd suggest for the description to be a little more succint, maybe just:

--8<---------------cut here---------------start------------->8---
This package is a tool for debugging Node.js C/C++ native code modules
and getting stack traces when things go wrong.
--8<---------------cut here---------------end--------------->8---

Otherwise LGTM!

Thanks,
Pierre