parcel icon indicating copy to clipboard operation
parcel copied to clipboard

Segmentation Fault 11 when restarting watcher with cache on 2.10.3

Open ErikBooij opened this issue 1 year ago • 4 comments

Hi 👋

Although I've stated in the title that I'm experiencing this on 2.10.3, I was experiencing this on prior versions too. Any time I restart the Parcel watcher, while a populated .parcel-cache folder is present, I get a Segmentation fault: 11 error. I regularly need to restart the watcher, because Parcel complains (in the browser) that it cannot find a file (not sure if it's related to the segfault). Running rm -rf .parcel-cache and starting the watcher again, resolves this.

The command I'm running, is:

$ ./node_modules/.bin/parcel --dist-dir src/frontend/dist src/frontend/app/*.html

This yields (when I'm running it as a Make command):

make: *** [watch-frontend] Segmentation fault: 11

or this when I run it directly:

zsh: segmentation fault  ./node_modules/.bin/parcel --dist-dir src/frontend/dist

This is my package.json

{
  "devDependencies": {
    "@apidevtools/swagger-cli": "^4.0.4",
    "@headlessui/react": "^1.7.17",
    "@heroicons/react": "^2.0.18",
    "@hookform/resolvers": "^3.3.2",
    "@playwright/test": "^1.40.1",
    "@tailwindcss/forms": "^0.5.7",
    "@tailwindcss/typography": "^0.5.10",
    "@tanstack/react-query": "^5.12.2",
    "@types/google-protobuf": "^3.15.12",
    "@types/node": "^20.10.4",
    "@types/react": "^18.2.42",
    "@types/react-dom": "^18.2.17",
    "@types/url-parse": "^1.4.11",
    "@types/yargs": "^17.0.32",
    "@typescript-eslint/eslint-plugin": "^6.13.2",
    "@typescript-eslint/parser": "^6.13.2",
    "@vitest/ui": "^1.0.1",
    "axios": "^1.6.2",
    "buffer": "^6.0.3",
    "dotenv-cli": "^7.3.0",
    "eslint": "^8.55.0",
    "eslint-plugin-import": "^2.29.0",
    "google-protobuf": "^3.21.2",
    "immer": "^10.0.3",
    "mysql2": "^3.6.5",
    "orval": "^6.22.1",
    "parcel": "^2.10.3",
    "postcss": "^8.4.32",
    "process": "^0.11.10",
    "protobufjs": "^7.2.5",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "react-feather": "^2.0.10",
    "react-helmet-async": "^2.0.3",
    "react-hook-form": "^7.48.2",
    "react-router": "^6.20.1",
    "react-router-dom": "^6.20.1",
    "svgo": "^3.0.5",
    "tailwindcss": "^3.3.6",
    "url": "^0.11.3",
    "url-parse": "^1.5.10",
    "usehooks-ts": "^2.9.1",
    "vitest": "^1.0.1",
    "yargs": "^17.7.2",
    "yup": "^1.3.2"
  },
  "scripts": {}
}

I do not use a Parcel config file, but I do have a tailwind.config.js, and a .postcssrc:

const defaultTheme = require('tailwindcss/defaultTheme')

/** @type {import('tailwindcss').Config} */
module.exports = {
  content: ['./src/frontend/app/**/*.{html,js,ts,tsx}'],
  theme: {
    extend: {
      animation: {
        'spin-slow': 'spin 2s linear infinite',
      },
      fontFamily: {
        sans: ['Inter var', ...defaultTheme.fontFamily.sans],
      },
    },
  },
  plugins: [
    require('@tailwindcss/forms'),
    require('@tailwindcss/typography'),
  ],
}
{
  "plugins": {
    "tailwindcss": {}
  }
}

🌍 Your Environment

Software Version(s)
Parcel 2.10.3 (issue also present on prior versions)
Node v21.2.0 (issue also present on prior versions)
npm/Yarn NPM 10.2.3
Operating System macOS 14.0 (Sonoma)

ErikBooij avatar Dec 08 '23 19:12 ErikBooij

Running rm -rf .parcel-cache and starting the watcher again, resolves this.

True for my use case too. Also, by making this comment hopefully it'll catch more attention for others who stumble in here from their seg faults.

peterbe avatar Dec 20 '23 23:12 peterbe

Indeed I have the same issue, and this is for a rather simple library build. Having the cache causes segfault.

erhant avatar Jan 03 '24 07:01 erhant

Having this exact same issue. Only using parcel through GoWebly, but whether I do run or build, I always get a segmentation fault.

I'm also on macOS (15 dev beta) with a M1 Pro, just as #7402 and this issue probably too I think. #9670 is also likely related.

Deleting .parcel-cache indeed fixed the issue for now, but I guess it's worth looking into actually fixing this - unluckily I have no clue about parcel itself, but could provide debug information if told how to enable.

d0x7 avatar Jun 29 '24 00:06 d0x7

Try adding a manual resolution to @parcel/[email protected]

It includes parcel-bundler/watcher#177, which should fix some memory bugs in the watcher code.

You'll need to add this to your package.json file:

	"resolutions": {
		"@parcel/watcher": "v2.4.2-alpha.0"

yamadapc avatar Jul 01 '24 01:07 yamadapc