Skip to content

Crash report : segfault when requiring native aerospike module on windows (ERR_DLOPEN_FAILED) #19384

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

Closed
mithlesh-bit opened this issue Apr 30, 2025 · 1 comment
Labels
crash An issue that could cause a crash napi Compatibility with the native layer of Node.js runtime windows An issue that is known to occur on Windows

Comments

@mithlesh-bit
Copy link

mithlesh-bit commented Apr 30, 2025

How can we reproduce the crash?

Discription:
trying to use the aerospike npm module in bun on windows leads to a DLL load failure and segfault.

To reproduce:

  1. bun init
  2. bun add aerospike
  3. Create index.ts

Code:

import { serve } from "bun";
import Aerospike from "aerospike";

const client = Aerospike.client({ hosts: '127.0.0.1:3000' });
await client.connect();

const server = serve({
  port: 8000,
  async fetch(req) {
    const url = new URL(req.url);
    if (req.method === "POST" && url.pathname === "/api/add") {
      const tasks = [];
      for (let i = 0; i < 100; i++) {
        const key = new Aerospike.Key("test", "demo", `key${i}`);
        const record = { name: `user${i}`, age: i + 20 };
        tasks.push(client.put(key, record));
      }
      await Promise.all(tasks);
      return Response.json({ message: "100 records inserted" });
    }

    if (req.method === "GET" && url.pathname.startsWith("/api/get/")) {
      const id = url.pathname.split("/").pop();
      const key = new Aerospike.Key("test", "demo", id);
      try {
        const record = await client.get(key);
        return Response.json(record.bins);
      } catch {
        return new Response("Not found", { status: 404 });
      }
    }

    return new Response("Not Found", { status: 404 });
  },
});

console.log(`Bun API running at http://localhost:${server.port}`);

Run:
bun index.ts

Relevant log output

bun index.ts
107 |         return opts[p] || p;
108 |       })
109 |     );
110 |     tries.push(n);
111 |     try {
112 |       b = opts.path ? requireFunc.resolve(n) : requireFunc(n);
                                                     ^
error: LoadLibrary failed: A dynamic link library (DLL) initialization routine failed.
 code: "ERR_DLOPEN_FAILED"

      at bindings (C:\Users\DELL\Desktop\TEST\BUN\node_modules\bindings\bindings.js:112:48)
      at <anonymous> (C:\Users\DELL\Desktop\TEST\BUN\node_modules\aerospike\lib\aerospike.js:19:7)

Bun v1.2.11 (Windows x64)
============================================================
Bun v1.2.11 (cb6abd21) Windows x64
Windows v.win10_cu
CPU: sse42 avx avx2
Args: "C:\Users\DELL\AppData\Roaming\npm\node_modules\bun\bin\bun.exe" "index.ts"
Features: jsc tsconfig process_dlopen
Builtins: "bun:main" "node:fs" "node:path"
Elapsed: 235ms | User: 62ms | Sys: 46ms
RSS: 100.32MB | Peak: 100.92MB | Commit: 120.87MB | Faults: 25001

panic(main thread): Segmentation fault at address 0x7FF91633E7D4
oh no: Bun has crashed. This indicates a bug in Bun, not your code.

To send a redacted crash report to Bun's team,
please file a GitHub issue using the link below:

 https://bun.report/1.2.11/wa1cb6abd2kIgggQ_CSntdll.dllq65XCSntdll.dll2p4XCSntdll.dll633XCYKERNEL32.DLL2+xHq+Sg11jG6uv8F2l7snBq9i7EA2y//Bo9zvmW

Stack Trace (bun.report)

Bun v1.2.11 (cb6abd2) on windows x86_64 [AutoCommand]

Segmentation fault at address 0x7FF9011FE7D4

Features: tsconfig, process_dlopen, jsc

@mithlesh-bit mithlesh-bit added the crash An issue that could cause a crash label Apr 30, 2025
@github-actions github-actions bot added runtime windows An issue that is known to occur on Windows labels Apr 30, 2025
Copy link
Contributor

Thank you for reporting this crash.

For Bun's internal tracking, this issue is BUN-EV1.

@RiskyMH RiskyMH added the napi Compatibility with the native layer of Node.js label Apr 30, 2025
@RiskyMH RiskyMH closed this as completed May 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash An issue that could cause a crash napi Compatibility with the native layer of Node.js runtime windows An issue that is known to occur on Windows
Projects
None yet
Development

No branches or pull requests

2 participants