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

[Debug Mode] Debugger doesn't terminate when code finishes or error **IF** a NPM package is inside deno.lock #16662

Closed
pietro-lopes opened this issue Nov 16, 2022 · 7 comments
Assignees
Labels
debugger Chrome DevTools inspector/debugger integration needs investigation requires further investigation before determining if it is an issue or not

Comments

@pietro-lopes
Copy link

pietro-lopes commented Nov 16, 2022

Title, and related to #16628

CODE RUNS FINE WITHOUT DEBUGGING

Tested on

deno 1.28.0 (release, x86_64-unknown-linux-gnu)
v8 10.9.194.1
typescript 4.8.3

OS: Pop 22.04 jammy
Kernel: x86_64 Linux 6.0.3-76060003-generic

With VSCode & Chrome Debugger

In this example code you can attach/launch a debugger with no problem when finishing program
Lock file will contain only remote imports

import { crypto } from "https://deno.land/[email protected]/crypto/mod.ts"
import { encodeToString } from "https://deno.land/[email protected]/encoding/hex.ts";
// import { keccak_256 } from "npm:@noble/[email protected]/sha3"

console.log(crypto.randomUUID())
// console.log(encodeToString(keccak_256("testing")))

Here you will add the NPM package noble/hashes to your lock file to run and debugger will not close when finishing
Lock file will contain remote & npm imports

import { crypto } from "https://deno.land/[email protected]/crypto/mod.ts"
import { encodeToString } from "https://deno.land/[email protected]/encoding/hex.ts";
import { keccak_256 } from "npm:@noble/[email protected]/sha3"

console.log(crypto.randomUUID())
console.log(encodeToString(keccak_256("testing")))

Here you can comment back the NPM package BUT it will still not close debugger.
Lock file will contain remote & npm imports

import { crypto } from "https://deno.land/[email protected]/crypto/mod.ts"
import { encodeToString } from "https://deno.land/[email protected]/encoding/hex.ts";
// import { keccak_256 } from "npm:@noble/[email protected]/sha3"

console.log(crypto.randomUUID())
// console.log(encodeToString(keccak_256("testing")))

Only way to fix it is by removing NPM packages from deno.lock or delete so it can generates back with only remotes.

@bartlomieju
Copy link
Member

Hi @pietro-lopes I just tried this code and cannot reproduce the problem. What do you mean by "debugger will not close when finishing"? As it is, the debugger never disconnects automatically if it is connected - you have to do so manually by closing the inspector window. Can you please provide the commands you used to get this problem?

@bartlomieju bartlomieju added the needs info needs further information to be properly triaged label Nov 16, 2022
@pietro-lopes
Copy link
Author

As it is, the debugger never disconnects automatically if it is connected - you have to do so manually by closing the inspector window

If I have to close manually, how will I know that code really finished or is hanging on some exception like this:
#16628 (comment)

Command used are in launch.json from .vscode:

      "runtimeExecutable": "/home/myusername/.deno/bin/deno",
      "runtimeArgs": [
        "run",
        "--config",
        "./deno.jsonc",
        "--inspect-brk",
        "--allow-all"
      ],
      "attachSimplePort": 9229

@bartlomieju
Copy link
Member

I missed that you are using VSCode debugger, I was talking about the Chrome DevTools debugger. I'll look into this problem.

@bartlomieju bartlomieju added needs investigation requires further investigation before determining if it is an issue or not and removed needs info needs further information to be properly triaged labels Nov 16, 2022
@bartlomieju
Copy link
Member

@pietro-lopes just to be completely sure - the problem that you are reporting is that after running the code, "the box" with play/step over/pause/stop buttons is not disappearing. Is that correct?

@bartlomieju bartlomieju added the debugger Chrome DevTools inspector/debugger integration label Nov 16, 2022
@bartlomieju bartlomieju self-assigned this Nov 16, 2022
@bartlomieju
Copy link
Member

Requires denoland/rusty_v8#1134

@bartlomieju
Copy link
Member

This issue will be fixed by #16831 and #16836

@bartlomieju
Copy link
Member

Done, this will be released in v1.28.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
debugger Chrome DevTools inspector/debugger integration needs investigation requires further investigation before determining if it is an issue or not
Projects
None yet
Development

No branches or pull requests

2 participants