denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
94.63k stars 5.25k forks source link

Subscription to an empty stream with the watch([]) method often causes a panic #24327

Closed chabanov closed 1 month ago

chabanov commented 3 months ago
async function logs(engine: Deno.Kv, connector: Connector){
    try {
        const stream = engine.watch([]);
        for await (const entries of stream) {
            console.log(entries)
        }
    } catch (e) {
        console.log(e);
    }
}

Deno has panicked. This is a bug in Deno. Please report this at https://github.com/denoland/deno/issues/new. If you can reliably reproduce this panic, include the reproduction steps and re-run with the RUST_BACKTRACE=1 env var set and include the backtrace in your report.

Platform: macos aarch64 Version: 1.42.4 Args: ["deno", "run", "-A", "--unstable-kv", "--watch", "main.ts"]

thread 'main' panicked

yazan-abdalrahman commented 3 months ago

@chabanov Hello, I attempted to reproduce it, but it works. image

Can you provide me with the entire script of main.ts?

**" async function logs(engine: Deno.Kv, connector: Connector){ try { const stream = engine.watch([]); for await (const entries of stream) { console.log(entries) } } catch (e) { console.log(e); } }

const connector = {};

const kvEngine = await Deno.openKv();

logs(kvEngine, connector);

"**

littledivy commented 1 month ago

Cannot reproduce with latest Deno. Feel free to open another issue with the full backtrace if it still happens