question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

denon [script name] doesn't kill app on reload

See original GitHub issue

I have a simple web server application running with oak. When I use the command denon run --allow-net app.ts the auto reload successfully kill the webserver on each reload.

But when I use the denon dev command and using the denon.json file, the application isn’t killed on each reload. For example, if I run the webserver on 8080 port, then change it to 8081 then save, I end up with 2 webserver. If I doesn’t change the port between two save, I hand up with an error saying one app already use this port.

Here is my denon.json file 01

And my app.ts file 02

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:36 (12 by maintainers)

github_iconTop GitHub Comments

3reactions
dale-robertscommented, Jan 5, 2021

I have also confirmed this to still be a problem, using Windows 10, Deno 1.6.3, and Denon 2.4.5. I believe the problem is that when the killAll() routine in deamon.ts calls p.close() under Windows, this is not actually killing the process. Can confirm this with ProcessExplorer, and see that the original process ID is never killed, and subsequent processes die due to the Socket reuse error.

I’m not a Github guru, so I’m just posting my small change here, adding p.kill() to the Windows case, which fixes the problem for me.

if (Deno.build.os === "windows") {
     logger.debug(`closing (windows) process with pid ${p.pid}`);
     p.close(); // This original line does NOT end the process.
     p.kill(9); // <<<<<< This added line DOES end the Windows process.
} else {
     logger.debug(`killing (unix) process with pid ${p.pid}`);
     p.kill(9);
}

Could also just get rid of the whole “if” and use kill() always. But I’m sure p.close() was added specially for Windows for some reason, and based on other reports here it seems to sometimes work, so I’m not sure why it is not working for all of us. I’m also not sure whether kill() has any bad/unintended effects in Windows.

1reaction
MustachedNinjacommented, Jan 6, 2021

Thanks @dale-roberts , I submitted a pull request for your suggestion: #120

Read more comments on GitHub >

github_iconTop Results From Across the Web

Close qvw after reload script ended - Qlik Community - 1886392
When I use a macro as below, qvw B is not opened, and when I delete the closing part B does not close....
Read more >
Raycast Marketplace
Search Note By Name. This script searches for a note, given its exact name, or a substring, the search does not consider case....
Read more >
Siriusxm app login problems - cattolimonica.it
Reinstall the Surfshark app, then restart your device and try to log in again. ... Every 6 months or so, the Sirius XM...
Read more >
0.116: Entities card row editor, restore snapshots and performance ...
Did restart and flush cache on browser (Chrome on PC). Same problem with Android Mobile App with the same two integrations.
Read more >
NextJs <Link> doesn't rerun scripts - Stack Overflow
As far as I can tell this happens because the <Link> tag makes it a Single-Page Application and doesn't refresh the page when...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found