Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gatsby,gatsby-cli): Listen for segfaults #34996

Closed
wants to merge 6 commits into from

Conversation

tyhopp
Copy link
Contributor

@tyhopp tyhopp commented Mar 1, 2022

Description

In an effort to help triage segfaults that may occur in our dependencies with native addons (e.g. sharp, lmdb, parcel), include segfault-handler in our build, develop, serve, and child worker processes.

  • Opt-in by setting GATSBY_EXPERIMENTAL_LISTEN_FOR_SEGFAULTS to a truthy value
  • Segfaults are:
    • Printed to stderr by segfault-handler automatically
    • Written to .cache/logs/gatsby-segfault-[hash].log by us
    • Contextualized with a structured error by us

Usage

To try out the canaries for this feature branch, in your project execute:

npm i gatsby@alpha-segfault-handler gatsby-cli@alpha-segfault-handler

Run GATSBY_EXPERIMENTAL_LISTEN_FOR_SEGFAULTS=true npm run build or set the flag in your gatsby-config file. If a segfault occurs, it should be printed to stderr and written to .cache/logs.

Documentation

Might mention this in the Debugging the Build Process doc.

Related Issues

[sc-46856]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Mar 1, 2022
@tyhopp tyhopp marked this pull request as draft March 1, 2022 07:22
@tyhopp tyhopp added topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement. and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Mar 1, 2022
@tyhopp tyhopp force-pushed the feat/segfault-handler branch from 12cd9cf to 3d4ffa3 Compare March 1, 2022 07:25
@wardpeet
Copy link
Contributor

wardpeet commented Mar 1, 2022

I'm a bit hesitant of adding segfault-handler by default because of these comments:
lovell/sharp#2191 (comment)
ddopson/node-segfault-handler#63

Let's make sure to test this on a few sites where segfaults are happening to make sure we're getting the results we want

@tyhopp
Copy link
Contributor Author

tyhopp commented Mar 1, 2022

Let's make sure to test this on a few sites where segfaults are happening to make sure we're getting the results we want

👍 Considering whether this might be better as opt-in via a flag, what do you think?

@wardpeet
Copy link
Contributor

wardpeet commented Mar 2, 2022

If it gives us the information we want I'm happy to keep it enabled all the time

@tyhopp tyhopp force-pushed the feat/segfault-handler branch from 7bceb24 to c9ecd7b Compare March 3, 2022 02:40
@tyhopp tyhopp closed this Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) type: feature or enhancement Issue that is not a bug and requests the addition of a new feature or enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants