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

Segmentation fault when using with vite and sveltekit project #3720

Open
insanebaba opened this issue Apr 6, 2024 · 1 comment
Open

Segmentation fault when using with vite and sveltekit project #3720

insanebaba opened this issue Apr 6, 2024 · 1 comment

Comments

@insanebaba
Copy link

insanebaba commented Apr 6, 2024

Hi Team, I'm getting this segmentation fault error, when trying to build the sveltekit project with vite.

goroutine 1 [chan receive]:
github.com/evanw/esbuild/internal/helpers.(*ThreadSafeWaitGroup).Wait(...)
        github.com/evanw/esbuild/internal/helpers/waitgroup.go:36
main.runService.func2()
        github.com/evanw/esbuild/cmd/esbuild/service.go:114 +0x59
main.runService(0x1)
        github.com/evanw/esbuild/cmd/esbuild/service.go:160 +0x4ed
main.main()
        github.com/evanw/esbuild/cmd/esbuild/main.go:240 +0xa29

goroutine 6 [chan receive]:
main.runService.func1()
        github.com/evanw/esbuild/cmd/esbuild/service.go:98 +0x4a
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:97 +0x1e5

goroutine 7 [chan receive]:
main.(*serviceType).sendRequest(0xc000023ef0, {0x915100, 0xc000bfee40})
        github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.runService.func3()
        github.com/evanw/esbuild/cmd/esbuild/service.go:125 +0x39
created by main.runService
        github.com/evanw/esbuild/cmd/esbuild/service.go:122 +0x31c

goroutine 4065 [chan receive]:
github.com/evanw/esbuild/internal/bundler.(*scanner).scanAllDependencies(0xc0012b3b00)
        github.com/evanw/esbuild/internal/bundler/bundler.go:1857 +0x232
github.com/evanw/esbuild/internal/bundler.ScanBundle(_, {_, _, _, _, _, _}, {_, _}, 0xc000b02060, ...)
        github.com/evanw/esbuild/internal/bundler/bundler.go:1262 +0xb36
github.com/evanw/esbuild/pkg/api.rebuildImpl({0xc000b02060, {0x0, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x0, 0x1, 0x2, ...}, ...}, ...)
        github.com/evanw/esbuild/pkg/api/api_impl.go:1501 +0x2e5
github.com/evanw/esbuild/pkg/api.(*internalContext).rebuild(_)
        github.com/evanw/esbuild/pkg/api/api_impl.go:1031 +0x2a5
github.com/evanw/esbuild/pkg/api.(*internalContext).Rebuild(...)
        github.com/evanw/esbuild/pkg/api/api_impl.go:1092
github.com/evanw/esbuild/pkg/api.Build({0x2, 0x4, 0x0, 0xc00244a2d0, 0x1, {0x0, 0x0}, 0x0, 0x0, {0xc00244a3f0, ...}, ...})
        github.com/evanw/esbuild/pkg/api/api.go:384 +0xb6
main.(*serviceType).handleBuildRequest(0xc000023ef0, 0x32312039?, 0x39352e3731203134?)
        github.com/evanw/esbuild/cmd/esbuild/service.go:763 +0xe58
main.(*serviceType).handleIncomingPacket.func2()
        github.com/evanw/esbuild/cmd/esbuild/service.go:235 +0x68
created by main.(*serviceType).handleIncomingPacket
        github.com/evanw/esbuild/cmd/esbuild/service.go:233 +0x1c5

goroutine 4053 [chan receive]:
main.(*serviceType).sendRequest(0xc000023ef0, {0x915100, 0xc000727e00})
        github.com/evanw/esbuild/cmd/esbuild/service.go:192 +0xfa
main.(*serviceType).convertPlugins.func2.3({{0xc00002c3a0, 0x12}, {0xc002c9d170, 0x30}, {0x98472c, 0x4}, {0xc002c9d170, 0x21}, 0x2, {0x0, ...}})
        github.com/evanw/esbuild/cmd/esbuild/service.go:973 +0x768
github.com/evanw/esbuild/pkg/api.(*pluginImpl).onResolve.func1({{0xc00002c3a0, 0x12}, {0xc002c9d170, 0x21}, {0x0, 0x0}, {{0xc002c9d170, 0x30}, {0x98472c, 0x4}, ...}, ...})
        github.com/evanw/esbuild/pkg/api/api_impl.go:1936 +0x1f5
github.com/evanw/esbuild/internal/bundler.RunOnResolvePlugins({_, _, _}, _, {0xc001248000, 0xc000582210, 0xc000582228, 0xc001544780, 0x4, 0xc00244a600}, ...)
        github.com/evanw/esbuild/internal/bundler/bundler.go:831 +0x8d5
github.com/evanw/esbuild/internal/bundler.parseFile({{0xa6f198, 0xc0015447c0}, {0xc001248000, 0xc000582210, 0xc000582228, 0xc001544780, 0x4, 0xc00244a600}, 0xc0012b3680, 0xc000b02060, ...})
        github.com/evanw/esbuild/internal/bundler/bundler.go:397 +0x3187
created by github.com/evanw/esbuild/internal/bundler.(*scanner).maybeParseFile
        github.com/evanw/esbuild/internal/bundler/bundler.go:1385 +0xab6

I couldn't find a way to reproduce this as i tried multiple ways, but my project has 100s of files and hence not able to run all possible permutation combinations.

I don't know how to fix this error,

here's package.json dependencies

"dependencies": {
    "@auth/core": "^0.9.0",
    "@auth/sveltekit": "^0.3.6",
    "@aws-sdk/client-s3": "^3.398.0",
    "@aws-sdk/s3-request-presigner": "^3.398.0",
    "@buckaroo/buckaroo_sdk": "^0.9.0",
    "@mollie/api-client": "^3.7.0",
    "@opentelemetry/api": "<1.5.0",
    "@opentelemetry/auto-instrumentations-node": "^0.39.1",
    "@opentelemetry/sdk-metrics": "^1.15.2",
    "@opentelemetry/sdk-node": "^0.41.2",
    "@opentelemetry/sdk-trace-node": "^1.15.2",
    "@twitter-api-v2/plugin-token-refresher": "^1.0.0",
    "captcha-generator-alphanumeric": "^1.10.2",
    "chart.js": "^4.3.3",
    "emoji-picker-element": "^1.18.3",
    "flowbite": "^1.8.1",
    "ga-gtag": "^1.1.7",
    "instagram-graph-api": "^5.0.1",
    "ioredis": "^5.3.2",
    "mdsvex": "^0.10.6",
    "ms": "^2.1.3",
    "nanoid": "^4.0.2",
    "pino": "^8.15.0",
    "pino-pretty": "^10.2.0",
    "postgres": "^3.3.5",
    "svelte-chartjs": "3.1.2",
    "svelte-file-dropzone": "^2.0.2",
    "svelte-local-storage-store": "^0.5.0",
    "tributejs": "^5.1.3",
    "tslog": "^4.9.2",
    "twitter-api-sdk": "^1.2.1",
    "twitter-api-v2": "^1.15.1",
    "uuid": "^9.0.1"
  },

dev dependencies:

"devDependencies": {
    "@faker-js/faker": "^8.0.2",
    "@iconify/svelte": "^3.1.4",
    "@playwright/test": "1.35.1",
    "@sveltejs/adapter-node": "^1.3.1",
    "@sveltejs/kit": "1.22.1",
    "@tailwindcss/typography": "^0.5.9",
    "@types/gtag.js": "^0.0.12",
    "@types/ms": "^0.7.31",
    "@types/nodemailer": "^6.4.9",
    "@types/pino": "^7.0.5",
    "@typescript-eslint/eslint-plugin": "^5.62.0",
    "@typescript-eslint/parser": "^5.62.0",
    "@vavite/node-loader": "^1.8.3",
    "autoprefixer": "^10.4.15",
    "classnames": "^2.3.2",
    "daisyui": "^3.6.1",
    "eslint": "^8.47.0",
    "eslint-plugin-canonical": "^4.9.0",
    "eslint-plugin-simple-import-sort": "^10.0.0",
    "eslint-plugin-svelte": "^2.33.0",
    "eslint-plugin-unused-imports": "^2.0.0",
    "flowbite-svelte": "^0.39.3",
    "highlight.js": "^11.8.0",
    "nodemailer": "^6.9.4",
    "postcss": "^8.4.28",
    "prettier": "^2.8.8",
    "prettier-plugin-svelte": "^2.10.1",
    "rome": "12.1.3",
    "svelte": "^3.59.2",
    "svelte-check": "^3.5.0",
    "svelte-debugger": "^1.0.5",
    "svelte-highlight": "^7.3.0",
    "svelte-preprocess": "^5.0.4",
    "svelte-share-buttons-component": "^1.5.5",
    "sveltekit-flash-message": "^2.4.4",
    "sveltekit-superforms": "1.2.0",
    "tailwindcss": "^3.3.3",
    "ts-prune": "^0.10.3",
    "ts-unused-exports": "^9.0.5",
    "tsc-silent": "^1.2.2",
    "tslib": "^2.6.2",
    "typescript": "^5.1.6",
    "vite": "^4.4.9",
    "vite-plugin-mkcert": "^1.16.0",
    "zod": "^3.22.2"
  },

vite config

import { sveltekit } from '@sveltejs/kit/vite';
import type * as vite from 'vite';
// enable if need https for localhost
import mkcert from 'vite-plugin-mkcert';

const isDev = process.env.NODE_ENV === 'development';
const isProd = process.env.NODE_ENV === 'production'
const host = 'my_site.com';
const server_config: vite.ServerOptions = {
    strictPort: true,
    port: 3000,
    // open: isDev,
    https: isDev,
    host: "0.0.0.0",
    cors: isDev
};
const config: vite.UserConfig = isProd ? {
    plugins: [
        sveltekit()
    ],
    server: {
        strictPort: true,
        port: 3000,
        host: "0.0.0.0",
        https: false,
        cors: true
    },
    build: {
        sourcemap: false,
        // cssMinify: true,
        chunkSizeWarningLimit: 5000000,
        // reportCompressedSize: false,
    }
} : {
    plugins: [
        sveltekit(),
        isDev &&
        mkcert({
            hosts: [host],
            autoUpgrade: true
        }),

    ],
    server: server_config,
    preview: {
        ...server_config
    },
    build: {
        sourcemap: 'inline',
        chunkSizeWarningLimit: 50000,
    }
};

export default config;
@joshmossas
Copy link

Hey @insanebaba what version of node are you running? I was running into a similar error in node v20.12.2. However when I downgraded to v20.11.1 the error went away

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants