Comments (3)
I'm about to open an MR with a proposed fix for this.
Scratch that. I realised that process.on('exit'
gets called for all exits, not just SIGKILLs. The code
that gets passed to this function is 0
when an OOMKill happens, which has me stumped.
from next.js.
Hi, any updates?
I did some research online but i couldn't find out a standard way to intercept the heap out of bound
exception.
The best i came up with is a file based approach, like the following
process.on("exit", (code)=>{
// if server directory is missing inside the build folder assume something went wrong
if (code === 0 && !_fs.existsSync(path.resolve('.next/server/'))) {
process.exit(1);
}
process.exit(code);
})
Still i don't know if this approach cover all the cases, i'd rather wait for a maintainer feedback.
And even though this seems to work for my case, i don't know if performing file system operations while your process is running out of heap memory is a good idea .
Also, the fact that node is killing its process with a 0 code might be more a nodejs related issue rather than a nextjs related one.
from next.js.
Thanks for your eyes @deh-code! As you might notice from my closed MR I originally thought I'd solved it with just a process.on("exit...
before I realised that it also fires on success. Your twist would likely work for this specific example (although a 137 exit code might be more accurate if we're assuming this can only happen on SIGKILL) but I find that I'm still left thinking that surely, surely this must be accounted for with a language construct I don't know about. Or something somewhere is catching and disguising the error.
To that end maybe another example with just a basic node program getting OOMed and hiding the exit code in the same way would be useful.
As a (rubbish) workaround, I'm just checking for existence of this path after I do a next build
in my Dockerfile at the moment
from next.js.
Related Issues (20)
- Unexpected Caching Behavior with revalidate in Next.js
- Nested intercepted routes fail
- Draft Mode does not work in Middleware
- Route group as a root of dynamic route shows 404 HOT 1
- Build issue with subpath imports of internal "compiled" package
- Generating static pages (0/6) [= ]G [AggregateError]
- RSC Fetch Logging deduplicates requests if they share the same URL, even if POST bodies are different HOT 2
- ### Goals HOT 1
- expect is not defined when running next.js with Jest
- Css and JS file not work when I deploy nextjs to vercel, I don't know what happened? HOT 2
- Issue compiling server component as prop in child component HOT 1
- Too much boilerplate, some people don't like it including me HOT 1
- template.tsx is rendered twice, when using Parallel Routes modal and reload.
- App Router Styled Components Bug when using ThemeProvider
- Unable to parse config export in source file error in middleware.js example HOT 1
- Headers are not set in Edge Runtime (Vercel) but does so locally
- next/font does not preload fonts that are used in dynamic imports
- Suspense does not work on page navigation (Next.js 15 Canary, App Router)
- NextJS 14.2.4 With-Supabase Build Error - Error: `cookies` was called outside a request scope.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next.js.