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

Crash when trying to access web gpu / worker threads #11138

Open
srinivaassunil opened this issue May 17, 2024 · 0 comments
Open

Crash when trying to access web gpu / worker threads #11138

srinivaassunil opened this issue May 17, 2024 · 0 comments
Labels
crash An issue that could cause a crash

Comments

@srinivaassunil
Copy link

How can we reproduce the crash?

setup a demo using this library
https://github.com/sb2702/websr and bun will crash as soon as encoding starts

JavaScript/TypeScript code that reproduces the crash?

import WebSR from "@websr/websr";
import { useEffect, useRef } from "react";
import { toast } from "sonner";


function Upscaler() {
  const gpu = useRef<GPUDevice | false | null>(null);
  useEffect(() => {
    const init = async () => {
      try {
        if (gpu.current) {
          return;
        }
        gpu.current = await WebSR.initWebGPU();
        if (!gpu) return toast.error("Browser/device doesn't support WebGPU");
        const targetCanvas = document.getElementById(
          "video-out"
        ) as HTMLCanvasElement;
        const video = document.querySelector("video-in") as HTMLVideoElement;
        if (!video) return;
        if (!targetCanvas) return;
        if (!gpu.current) return;
        const websr = new WebSR({
          source: video,
          network_name: "anime4k/cnn-2x-s",
          weights: await (await fetch("./cnn-2x-s.json")).json(),
          gpu: gpu.current,
          canvas: targetCanvas,
        });
        await websr.start();
      } catch (error) {
        console.log("error in init-->", error);
        throw error;
      }
    };
  }, []);

  return (
    <div className="w-full h-full p-10 bg-slate-200">
      <video
        id="video-in"
        src="/sample-video.mp4"
        controls
        autoPlay
        className="width-60 aspect-video"
      />
      <canvas id="video-out" />
    </div>
  );
}

Relevant log output

Bun v1.1.8 (89d25807) Windows x64
Args: "C:\Users\srini\.bun\bin\bun.exe", "--bun", "vite"
Features: jsc Bun.stdin(2) Bun.stdout abort_signal dotenv http_server spawn(2) transpiler_cache(17) tsconfig(2)
Builtins: "bun:jsc" "bun:main" "node:assert" "node:buffer" "node:child_process" "node:crypto" "node:dns" "node:events" "node:fs" "node:fs/promises" "node:http" "node:https" "node:module" "node:net" "node:os" "node:path" "node:perf_hooks" "node:process" "node:querystring" "node:readline" "node:stream" "node:string_decoder" "node:tls" "node:tty" "node:url" "node:util" "node:util/types" "node:zlib" "node:worker_threads" "ws" "node:v8"
Elapsed: 8713ms | User: 609ms | Sys: 93ms
RSS: 0.77GB | Peak: 0.79GB | Commit: 5.41GB | Faults: 211651

panic(main thread): Internal assertion failure
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.1.8/wa189d2580A6pghoFglq4L+g0uIwit1F+swC02ljLw+pjeuztkegzqkek37xG2t9t1CA0eNrzzCtJLcpLzFFILC5OLSrJzM9TSEvMzCktSgUAiSkKPg

error: script "start" exited with code 3

Stack Trace (bun.report)

Bun v1.1.8 (89d2580) on windows x86_64 [RunCommand]

panic: Internal assertion failure

@srinivaassunil srinivaassunil added the crash An issue that could cause a crash label May 17, 2024
@srinivaassunil srinivaassunil changed the title Crash when trying to access web gpu / workder threads Crash when trying to access web gpu / worker threads May 17, 2024
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
Projects
None yet
Development

No branches or pull requests

1 participant