Sometimes when deploy and publishing a project on a hosting, an error may occur:
[vite:esbuild] The service is no longer running: write EPIPE
[vite:esbuild-transpile] The service was stopped: write EPIPE
esbuild-transpile The service was stopped: write EPIPE
fatal error: go routine deadlock
runtime: failed to create new OS thread (have 14 already; errno=11)
runtime: may need to increase max user processes (ulimit -u)
fatal error: newosproc
... and so on
The reason why there is an error in limiting the number of parallel processes and treads. This is a common situation for shared servers.
Example unix command ulimit -u
result 100 threads, not 10 000 threads.
esbuild
write on Go and goroutine uses max multithreading.
esbuild
have compiled version of go-sources /node_modules/@esbuild/linux-x64/bin/esbuild
without the ability to influence the maximum number of threads (runtime.GOMAXPROCS()
or debug.SetMaxThreads()
)
Yes. Every time then you exec npm run build
you must set variable GOMAXPROCS
Examples:
Before
npm run dev
After
export GOMAXPROCS=1
npm run dev
The variable GOMAXPROCS=1
says that the number of parallel goroutine processes should be limited to single-threading.
And now your esbuild
transform or render chunks cannot stopped and crash process by OS.
The problem was found on nuxt3 which used esbuild
three times:
- Client build (from vite and rollup)
- Server build (from vite and rollup)
- Nitro build (from rollup)