Skip to content

OTEL_DENO=true deno run --watch does not respond to SIGINT or other signals and could stop the restarting loop #31540

@lukas-santiago

Description

@lukas-santiago

Previously, when Deno is in --watch mode, there was a problem with sigint signal handler (according to #30587) and that was solved. By this and my specific case I found an issue when OpenTelemetry mode is enabled. The Deno's signal handling stops working at all, no callbacks are reached. I tested just with SIGINT and SIGHUP likewise no one worked as expected. Thats the code to reproduce the issue:

// watch-error.ts
const ac = new AbortController();

Deno.addSignalListener("SIGINT", () => {
  console.log("SIGINT");
  setTimeout(() => ac.abort(), 1000);
});

Deno.addSignalListener("SIGHUP", () => {
  console.log("SIGHUP");
});

Deno.serve({ signal: ac.signal }, () => new Response("Hello World"));

And run with OTEL_DENO=true deno run -A --watch watch-error.ts.

I send the signals with btop tool and it works normal when the flag OTEL_DENO is missing. At first the CTRL+C in terminal don't working was the main issue but after a CTRL+C was unrecognized and I change some files the entire watching mode stucks trying to restarting the app then I need to send a SIGKILL to the process. One time at restarting with this issue it showed a blocking message and a timer implying that the "node_modules" or the process was locked but I'm not sure about the cause.

Version

deno 2.5.6 (stable, release, x86_64-unknown-linux-gnu)
v8 14.0.365.5-rusty
typescript 5.9.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    --watchrelated to the watch feature of the CLIneeds investigationrequires further investigation before determining if it is an issue or nototel

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions