oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
74.16k stars 2.77k forks source link

What is the stack size limit and how can I configure it? #7318

Open xlc opened 11 months ago

xlc commented 11 months ago

I have a program that runs perfectly fine in my macos M1 machine but throw stack overflow error on linux server

err: {
  "type": "RangeError",
  "message": "Maximum call stack size exceeded.",
  "stack":
      RangeError: Maximum call stack size exceeded.
          at mergeQueries (/home/bun/app/node_modules/drizzle-orm/sql/sql.js:19:18)
          at <anonymous> (/home/bun/app/node_modules/drizzle-orm/sql/sql.js:52:26)
          at <anonymous> (/home/bun/app/node_modules/drizzle-orm/pg-core/query-builders/insert.js:73:5)
          at <anonymous> (/home/bun/app/node_modules/drizzle-orm/pg-core/query-builders/insert.js:81:5)
          at then (/home/bun/app/node_modules/drizzle-orm/query-promise.js:20:54)
          at processTicksAndRejections (:61:39)
  "originalLine": 7,
  "originalColumn": 52
}

I noticed that this happens on dealing is huge object, so my suspection is that the stack size limit is higher on my mbp than the linux server.

Is there a way to check the stack size limit and how can I increase it?

xlc commented 11 months ago

The root cause is that it is trying to do a batch insert with too many items. Still, a same insert works on macos but not linux.