Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault when using AWS CDK lib #11002

Closed
acollins1991 opened this issue May 11, 2024 · 2 comments
Closed

Segmentation fault when using AWS CDK lib #11002

acollins1991 opened this issue May 11, 2024 · 2 comments
Labels
bug Something isn't working crash An issue that could cause a crash

Comments

@acollins1991
Copy link

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?

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,
    });
  }
}

Relevant log output

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

Stack Trace (bun.report)

Bun v1.1.8 (89d2580) on linux x86_64_baseline [TestCommand]

Segmentation fault at address 0x00000000

@acollins1991 acollins1991 added bug Something isn't working crash An issue that could cause a crash labels May 11, 2024
@Jarred-Sumner
Copy link
Collaborator

Duplicate of #5398

@Jarred-Sumner Jarred-Sumner marked this as a duplicate of #5398 May 13, 2024
@Jarred-Sumner
Copy link
Collaborator

Jarred-Sumner commented May 13, 2024

Closing as duplicate

@Jarred-Sumner Jarred-Sumner closed this as not planned Won't fix, can't repro, duplicate, stale May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash An issue that could cause a crash
Projects
None yet
Development

No branches or pull requests

2 participants