Files
bun.sh/test/leaksan.supp
Zack Radisic a89e61fcaa ssg 3 (#22138)
### What does this PR do?

Fixes a crash related to the dev server overwriting the uws user context
pointer when setting abort callback.

Adds support for `return new Response(<jsx />, { ... })` and `return
Response.render(...)` and `return Response.redirect(...)`:
- Created a `SSRResponse` class to handle this (see
`JSBakeResponse.{h,cpp}`)
- `SSRResponse` is designed to "fake" being a React component 
- This is done in JSBakeResponse::create inside of
src/bun.js/bindings/JSBakeResponse.cpp
- And `src/js/builtins/BakeSSRResponse.ts` defines a `wrapComponent`
function which wraps
the passed in component (when doing `new Response(<jsx />, ...)`). It
does
    this to throw an error (in redirect()/render() case) or return the
    component.
- Created a `BakeAdditionsToGlobal` struct which contains some
properties
    needed for this
- Added some of the properties we need to fake to BunBuiltinNames.h
(e.g.
    `$$typeof`), the rationale behind this is that we couldn't use
`structure->addPropertyTransition` because JSBakeResponse is not a final
    JSObject.
- When bake and server-side, bundler rewrites `Response ->
Bun.SSRResponse` (see `src/ast/P.zig` and `src/ast/visitExpr.zig`)
- Created a new WebCore body variant (`Render: struct { path: []const u8
}`)
  - Created when `return Response.render(...)`
  - When handled, it re-invokes dev server to render the new path

Enables server-side sourcemaps for the dev server:
- New source providers for server-side:
(`DevServerSourceProvider.{h,cpp}`)
- IncrementalGraph and SourceMapStore are updated to support this

There are numerous other stuff:
- allow `app` configuration from Bun.serve(...)
- fix errors stopping dev server
- fix use after free related to in
RequestContext.finishRunningErrorHandler
- Request.cookies
- Make `"use client";` components work
- Fix some bugs using `require(...)` in dev server
- Fix catch-all routes not working in the dev server
- Updates `findSourceMappingURL(...)` to use `std.mem.lastIndexOf(...)`
because
  the sourcemap that should be used is the last one anyway

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Co-authored-by: Claude Bot <claude-bot@bun.sh>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Alistair Smith <hi@alistair.sh>
2025-09-30 05:26:32 -07:00

124 lines
4.6 KiB
Plaintext

leak:bun.js.api.server.ServerAllConnectionsClosedTask.schedule
leak:bunfig.Bunfig.parse__anon
leak:resolver.resolver.Resolver.parsePackageJSON
leak:resolver.package_json.PackageJSON.parse__anon
leak:resolver.resolver.Resolver.parseTSConfig
leak:JSC::Identifier::fromString
leak:bun.js.bindings.JSGlobalObject.JSGlobalObject.create
leak:Zig__GlobalObject__create
leak:_objc_msgSend_uncached
leak:WTF::fastMalloc
leak:WTF::AutomaticThread::start
leak:Bun__transpileFile
leak:WTF::SymbolRegistry::symbolForKey
leak:js_printer.printAst__anon
leak:Bun__resolveSync
leak:JSC::moduleLoaderParseModule
leak:JSC::ScriptExecutable::newCodeBlockFor
leak:JSC::Parser<JSC::Lexer<unsigned char>>::parseFunctionExpression
leak:JSC::Parser<JSC::Lexer<unsigned char>>::parsePrimaryExpression
leak:JSC::Parser<JSC::Lexer<unsigned char>>::parseStatement
leak:JSCInitialize
leak:getaddrinfo_send_reply
leak:start_wqthread
leak:CRYPTO_set_thread_local
leak:BIO_new
leak:_tlv_get_addr
leak:Bun::generateModule
leak:Zig::ImportMetaObject::createFromSpecifier
leak:Zig::GlobalObject::moduleLoaderResolve
leak:JSModuleLoader__import
leak:dyld::ThreadLocalVariables
leak:JSC__JSModuleLoader__loadAndEvaluateModule
leak:uws_create_app
leak:lshpack_wrapper_decode
leak:lshpack_wrapper_init
leak:bun.js.ipc.onData2
leak:bun.js.node.fs_events.InitLibrary
leak:bun.js.node.fs_events.FSEventsLoop._schedule
leak:Bun__Path__join
leak:Bun__Path__resolve
leak:Zig::GlobalObject::moduleLoaderImportModule
leak:bake.FrameworkRouter.JSFrameworkRouter.getFileIdForRouter
leak:ast.Macro.MacroContext.call
leak:bun.js.webcore.Blob.findOrCreateFileFromPath__anon
leak:BunString::toWTFString(BunString::ZeroCopyTag)
leak:bun.js.node.node_fs_binding.Bindings(.mkdtemp).runSync
leak:bun.js.ModuleLoader.fetchBuiltinModule
leak:boringssl.checkX509ServerIdentity
leak:cli.pack_command.bindings.jsReadTarball
leak:ZigString__toErrorInstance
leak:JSC::moduleLoaderModuleDeclarationInstantiation
leak:JSC::arrayProtoFuncSort
leak:bindgen_Fmt_jsFmtString
leak:bun.js.api.bun.dns.GetAddrInfoRequest.run
leak:deps.tcc.State.init__anon
leak:dynamic_library.DlDynLib.open
leak:Zig::ImportMetaObject::finishCreation
leak:uws_add_server_name_with_options
leak:bun.js.webcore.Body.Value.fromJS
leak:sys.Error.toSystemError
leak:bun.js.webcore.Blob.getNameString
leak:JSC::callIntlDateTimeFormat
leak:functionRunProfiler
leak:JSC::JSModuleLoader::evaluateNonVirtual
leak:patch.PatchFile.apply
leak:bun.js.ModuleLoader.RuntimeTranspilerStore.TranspilerJob.runFromJSThread
leak:bun.js.webcore.blob.Store.initS3WithReferencedCredentials
leak:s3.list_objects.S3ListObjectsV2Result.toJS
leak:bun.js.webcore.S3Client.S3Client.write
leak:s3.list_objects.getListObjectsOptionsFromJS
leak:bun.js.node.node_fs.NodeFS.realpathInner
leak:sys.Error.toShellSystemError
leak:lazyLoadSQLite
leak:JSC::intlAvailableLocales
leak:getaddrinfo
leak:bun.js.api.filesystem_router.FileSystemRouter.constructor
leak:JSC::intlSegmenterAvailableLocales
leak:URL__getHref
leak:bun.js.api.bun.dns.Resolver.globalLookupService
leak:jsHTTPParser_execute
leak:Resolver__nodeModulePathsJSValue
leak:URL__host
leak:bun.js.node.node_os.version
leak:bun.js.node.node_os.release
leak:JSC::stringProtoFuncReplaceUsingRegExp
leak:WebCore::parseTypeAndSubtype
leak:bun.js.node.util.parse_args.parseArgs
leak:JSC::IntlDateTimeFormat::initializeDateTimeFormat
leak:WebCore__DOMURL__fileSystemPath
leak:bun.js.node.node_fs_watcher.FSWatcher.Arguments.fromJS
leak:WebWorker__updatePtr
leak:bun.js.node.zlib.NativeZlib.Context.init
leak:sql.postgres.PostgresSQLStatement.structure
leak:sql.postgres.DataCell.parseArray__anon
leak:sql.postgres.protocol.FieldMessage.FieldMessage.init
leak:JSC::intlCollatorAvailableLocales
leak:Bun__canonicalizeIP
leak:dlopen
leak:Bun::evaluateCommonJSModuleOnce
leak:fse_run_loop
leak:Zig::NapiClass_ConstructorFunction
leak:bun.js.webcore.fetch.FetchTasklet.toResponse
leak:JSC::jsonProtoFuncStringify
leak:deps.lol-html.HTMLString.toString
leak:libarchive.libarchive-bindings.Archive.readNew
leak:Zig::SourceProvider::create
leak:fromErrorInstance
# JSC_TO_STRING_TAG_WITHOUT_TRANSITION
leak:TLSSocket__create
leak:WebCore::JSReadableStreamDefaultReaderPrototype::finishCreation
leak:WebCore::JSReadableStreamDefaultControllerPrototype::finishCreation
# file comments below are where it was first seen, not an exhaustive list
# test/js/node/tls/node-tls-cert.test.ts
leak:create_ssl_context_from_bun_options
# test/js/node/test/parallel/test-inspector-enabled.js
leak:bun.js.Debugger.startJSDebuggerThread
# test/js/sql/sqlite-sql.test.ts
leak:WebCore::jsSQLStatementOpenStatementFunction
# ci, test/js/node/test/parallel/test-dgram-unref-in-cluster.js
leak:bun.js.api.bun.udp_socket.UDPSocket.udpSocket