Open tilenpirih opened 1 month ago
My guess is the socket object in our node:http imlementation needs to do some additional cleanup work that it is not currently doing.
In #14384:
protectedObjectTypeCounts: {
Promise: 20001,
UnlinkedProgramCodeBlock: 32,
UnlinkedModuleProgramCodeBlock: 26,
Function: 9,
DebugHTTPServer: 1,
GlobalObject: 1,
Timeout: 1,
},
In main:
{
objectTypeCounts: {
Object: 575954,
Function: 436286,
Array: 361073,
string: 232655,
JSLexicalEnvironment: 173841,
BufferList: 40003,
GetterSetter: 28880,
Promise: 24955,
"Immutable Butterfly": 23656,
Headers: 20002,
Request: 20001,
Response: 20001,
ProxyObject: 18242,
FunctionRareData: 13504,
AsyncFunction: 13189,
Note how in both cases, the Promise and the Headers/Request/Response are all still there. Something is keeping it alive forever. It's probably not emitting the close event.
Any estimations when this could be resolved? IMO memory leaks and stability should be very high priority.
Does it make any difference if you set nitro preset in your nuxt config
nitro: {
preset: 'bun'
},
This is ram usage after 100000 requests and it seems in a normal range. It's still 10x more compared to npm so there is probably still some room for improvements. But atleast it's solve me headaches with memory leaks for now.
What version of Bun is running?
1.1.29
What platform is your computer?
windows WSL - docker
What steps can reproduce the bug?
WORKDIR /usr/src/app FROM base AS build ENV NODE_ENV=production
COPY . /usr/src/app WORKDIR /usr/src/app RUN bun install RUN bun run build
FROM base AS app
COPY --from=build /usr/src/app/.output /prod/app WORKDIR /prod/app
EXPOSE 3000
CMD [ "bun", "run", "server/index.mjs" ]
FROM node:20-alpine AS base WORKDIR /usr/src/app FROM base AS build ENV NODE_ENV=production COPY . /usr/src/app RUN npm install RUN npm run build
FROM base AS app COPY --from=build /usr/src/app/.output /prod/app WORKDIR /prod/app
EXPOSE 3000 CMD [ "node", "server/index.mjs" ]