Kenta Iwasaki
Kenta Iwasaki
I'll put my high-level thoughts down in points here since my thoughts are a little all over the place when it comes to Zig's async story. The perspective I'm coming...
> TIL this is valid TypeScript... 🫠> > ```ts > enum MyEnum { > Zero = 42, > One = 42, > Two = 42 > } > >...
> Getting the same with latest bun version. Was not facing in bun 1.0.35 Tested it out with bun 1.0.35+940448d6b and got the same issue.
I unfortunately have some deadlines to attend to so I can't look further into this for a bit, but it looks like the main issue has to do with a...
To further expand on findings from the comment above, the following places were checked: - Buffer pooling in `HTTPServerWritable` is not the problem. The capacity and length of buffers are...
I got some time today to continue investigating this. I extracted the core parts of the Next.js server runtime that only deals with WritableStream and AbortController and reproduced the memory...
bun-debug logs running the memory leak reproduction: ``` [RequestContext] create (src.bun.js.api.server.NewRequestContext(false,false,src.bun.js.api.server.NewServer(ZigGeneratedClasses.JSHTTPServer,false,false))@200005e0100) [RequestContext] render [RequestContext] doRender [RequestContext] finalize (src.bun.js.api.server.NewRequestContext(false,false,src.bun.js.api.server.NewServer(ZigGeneratedClasses.JSHTTPServer,false,false))@200005e0100) [RequestContext] finalizeWithoutDeinit (src.bun.js.api.server.NewRequestContext(false,false,src.bun.js.api.server.NewServer(ZigGeneratedClasses.JSHTTPServer,false,false))@200005e0100) [RequestContext] finalizeWithoutDeinit: has_finalized false [RequestContext] finalizeWithoutDeinit: response_jsvalue != .zero...
The memory leak has been isolated to the following line: ```ts await readable.pipeTo(writer, { signal: controller.signal }); ``` Specifically, passing in `controller.signal` here causes the memory leak to happen.
Filed PR #10086. `pipeTo` no longer leaks memory. It seems like there may potentially be some far more minor memory leaks in the NextJS standalone build, though. Will look into...
Really appreciate the swift response and detailed writeup. For the time being, I'm happy to isolate separate queries and have them independently executed one by one as a transaction rather...