7
lorentz
4y

For the first time in my life, I got an OOM error from Node. How TF do I debug this?

Comments
  • 0
    Oh sh*t looks bad
  • 2
    I had somewhat the same error last week :

    node --max-old-space-size=8192
  • 0
    @bedawang yeah but neither the codebase nor the libraries are that big, this is clearly a bug, I just don't know how to debug a memory leak because I've never had one in a GC'd language. This came about seconds after starting the app.
  • 0
    @homo-lorens In my case it only happens on my machine, so I wonder if it really is a bug in the codebase
  • 1
    Remove stuff until you stop getting the memory exception. Then start adding stuff back in. Same way you'd troubleshoot any other weird modules you didn't write, or even ones you did write.
  • 0
    You running in Docker or Kubernetes?
  • 0
    @devphobe yes docker why
  • 0
    @vomitmachine I was hoping for a method that isn't completely blackbox, but I guess that's all I can do.
  • 0
    That's it. I should stop video games.

    I read out of Mana
  • 1
    @homo-lorens your memory limits are lower than you might expect sometimes https://developer.ibm.com/languages...

    If that link doesn’t help, search for Docker node oom - there are plenty of workarounds.
  • 0
    @devphobe According to the sweep reports the program failed at 2GB. Not what I would expect from a basic app with fastify, typeorm, ts-node and an empty database, right after startup.
  • 1
    @homo-lorens TS is a memory hog on compile, especially in Docker for some strange reason. It only needs it for full builds. Partial builds often take way less memory. I’ve never dug in more than that, I just oversize my build containers. I bet you’ll be fine with less memory once you have a prebuilt production image
  • 1
    OK, the lesson here is to not be a fucking retard, or if I really have to, at least not rol my own DI without cycle detection while doing so.
  • 0
    Also, nothing indicates how half-baked Javascript is better than the fact that in the case of an async stack overflow there's absolutely no indication that it was in fact a stack overflow because there is no async stack just a regular linked list of regular objects constructed by Promise.
  • 1
    Promises and async are language features, yet the engine treats them like some kind of third party addition that it knows nothing about beside converting async syntax and prepending an implementation of Promise in a preprocessing step.
Add Comment