Closed acollins1991 closed 4 months ago
Create a Bun runtime project with the 'JavaScript/TypeScript code that reproduces the crash' code, updating PATH TO FILE to a file to build.
To get the exact scenario this script should be run using 'bun test' inside a monorepo setup, but have not tested if this is necessary.
The failure seems to occur when this line is run;
const code = props.code.bind(this);
in node_modules/aws-cdk-lib/aws-lambda/lib/function.js (https://github.com/aws/aws-cdk/blob/c1a3075c697b9673980315cab21cba0eea18782c/packages/aws-cdk-lib/aws-lambda/lib/function.ts#L912)
import * as cdk from "aws-cdk-lib"; import type { IFunction } from "aws-cdk-lib/aws-lambda"; import * as lambda from 'aws-cdk-lib/aws-lambda'; import { Construct } from "constructs"; import path from "path" const bunFunction = await Bun.build({ entrypoints: [PATH TO FILE], outdir: 'dist', target: 'bun', minify: true, external: ["*"] }) export class BunCdkStack extends cdk.Stack { constructor(scope: Construct, id: string, props?: cdk.StackProps) { super(scope, id, props); const fn: IFunction = new lambda.Function(this, 'HelloHandler', { code: lambda.Code.fromAsset(path.dirname(bunFunction.outputs[0].path)), handler: 'index.handler', runtime: lambda.Runtime.PROVIDED_AL2, }); } }
root@342491c2aaba:/workspaces/distributed-rendering-businesses-monorepo# bun test packages/cdk bun test v1.1.8 (89d25807) packages/cdk/__tests__/cdk.spec.ts: starting ============================================================ Bun v1.1.8 (89d25807) Linux x64 (baseline) Args: "bun", "test", "packages/cdk" Features: jsc bunfig dotenv(2) external tsconfig Builtins: "node:buffer" "node:constants" "node:crypto" "node:fs" "node:os" "node:path" "node:stream" "node:string_decoder" "node:util" "node:util/types" Elapsed: 938ms | User: 556ms | Sys: 381ms RSS: 2.13GB | Peak: 1.07GB | Commit: 2.13GB | Faults: 2 panic(main thread): Segmentation fault at address 0x0
Bun v1.1.8 (89d2580) on linux x86_64_baseline [TestCommand]
89d2580
Segmentation fault at address 0x00000000
ld-temp.o:0
void WTF::URLParser::parse<char16_t>
??
js_parser.zig:15837
src.js_parser.NewParser_
js_parser.zig:5676
string_immutable.zig:0
src.defines.Define.forIdentifier
js_parser.zig:0
js_parser.zig:15619
bun.zig:392
src.string_immutable.cat
js_parser.zig:13069
fixed_buffer_stream.zig:65
fmt.allocPrint__anon_479888
Duplicate of https://github.com/oven-sh/bun/issues/5398
Closing as duplicate
How can we reproduce the crash?
Create a Bun runtime project with the 'JavaScript/TypeScript code that reproduces the crash' code, updating PATH TO FILE to a file to build.
To get the exact scenario this script should be run using 'bun test' inside a monorepo setup, but have not tested if this is necessary.
The failure seems to occur when this line is run;
const code = props.code.bind(this);
in node_modules/aws-cdk-lib/aws-lambda/lib/function.js (https://github.com/aws/aws-cdk/blob/c1a3075c697b9673980315cab21cba0eea18782c/packages/aws-cdk-lib/aws-lambda/lib/function.ts#L912)
JavaScript/TypeScript code that reproduces the crash?
Relevant log output
Stack Trace (bun.report)
Bun v1.1.8 (
89d2580
) on linux x86_64_baseline [TestCommand]Segmentation fault at address 0x00000000
ld-temp.o:0
:void WTF::URLParser::parse<char16_t>
??
js_parser.zig:15837
:src.js_parser.NewParser_
js_parser.zig:5676
:src.js_parser.NewParser_
string_immutable.zig:0
:src.defines.Define.forIdentifier
js_parser.zig:0
:src.js_parser.NewParser_
js_parser.zig:15619
:src.js_parser.NewParser_
bun.zig:392
:src.string_immutable.cat
js_parser.zig:13069
:src.js_parser.NewParser_
fixed_buffer_stream.zig:65
:fmt.allocPrint__anon_479888