diff mbox series

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

Message ID 20211208202838.752542-33-philip@philipmcgrath.com
State Accepted
Headers show
Series guix: node-build-system: Support compiling add-ons with node-gyp. | expand

Commit Message

Philip McGrath Dec. 8, 2021, 8:28 p.m. UTC
* gnu/packages/node-xyz.scm (node-segfault-handler): New variable.
---
 gnu/packages/node-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

Comments

Pierre Langlois Dec. 12, 2021, 4:31 p.m. UTC | #1
Philip McGrath <philip@philipmcgrath.com> 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
Philip McGrath Dec. 12, 2021, 9:38 p.m. UTC | #2
On 12/12/21 11:31, Pierre Langlois wrote:
> 
> Philip McGrath <philip@philipmcgrath.com> 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---

Yes, this is a bit long. I think I'll keep the last sentence, too, 
though, so something like:

--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.
If a @code{SIGSEGV} signal is raised, the module will print a
native stack trace to both STDERR and to a timestamped file.
--8<---------------cut here---------------end--------------->8---

(And maybe I should be using texinfo markup for STDERR, too.)

-Philip
diff mbox series

Patch

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.")
+    (license license:bsd-3)))