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

deno hangs when npm package has itself as a dependency #17420

Closed
jeiea opened this issue Jan 14, 2023 · 6 comments · Fixed by #17425
Closed

deno hangs when npm package has itself as a dependency #17420

jeiea opened this issue Jan 14, 2023 · 6 comments · Fixed by #17425
Labels
bug Something isn't working correctly node compat

Comments

@jeiea
Copy link
Contributor

jeiea commented Jan 14, 2023

Steps to reproduce

Environment

> deno --version
deno 1.29.3 (release, x86_64-pc-windows-msvc)
v8 10.9.194.5
typescript 4.9.4
> systeminfo
...
Microsoft Windows 11 Pro 10.0.22621 N/A Build 22621
...

Command

git clone https://github.com/jeiea/deno_report.git -b oci
code deno_report

Expected behavior

image

image

Actual behavior

LSP doesn't work at all.
image
It doesn't run, just hangs.
image

Additional context

The following is Deno Language Server output when problem occurs.

Starting Deno language server...
  version: 1.29.3 (release, x86_64-pc-windows-msvc)
  executable: C:\ProgramData\chocolatey\lib\deno\deno.EXE
Connected to "Visual Studio Code" 1.74.3
{"type":"mark","name":"update_cache"},
{"type":"measure","name":"update_cache","count":1,"duration":0},
{"type":"mark","name":"update_tsconfig"},
{"type":"mark","name":"request","count":1,"args":{"id":2,"method":"configure","compilerOptions":{"allowJs":true,"esModuleInterop":true,"experimentalDecorators":true,"isolatedModules":true,"jsx":"react","lib":["deno.ns","deno.window"],"module":"esnext","moduleDetection":"force","noEmit":true,"resolveJsonModule":true,"strict":true,"target":"esnext","useDefineForClassFields":true,"useUnknownInCatchVariables":false}}},
{"type":"measure","name":"request","count":1,"duration":1},
{"type":"measure","name":"update_tsconfig","count":1,"duration":125},
{"type":"mark","name":"request","count":2,"args":{"id":3,"method":"getSupportedCodeFixes"}},
{"type":"measure","name":"request","count":2,"duration":0},
{"type":"mark","name":"update_import_map"},
{"type":"measure","name":"update_import_map","count":1,"duration":0},
{"type":"mark","name":"update_registries"},
Enabling import suggestions for: https://deno.land
Enabling import suggestions for: https://x.nest.land
Download https://x.nest.land/.well-known/deno-import-intellisense.json
Download https://intellisense.nest.land/deno-import-intellisense.json
Enabling import suggestions for: https://crux.land
{"type":"measure","name":"update_registries","count":1,"duration":1120},
{"type":"mark","name":"request","count":3,"args":{"id":4,"method":"getAssets"}},
{"type":"measure","name":"request","count":3,"duration":1},
{"type":"measure","name":"initialize","count":1,"duration":1253},
Server ready.
{"type":"mark","name":"did_open","count":1,"args":{"textDocument":{"uri":"file:https:///d%3A/Repos/jeiea/2023/01/deno_report/main.ts","languageId":"typescript","version":1,"text":"import { IdentityClient } from \"npm:[email protected]\";\n// import { IdentityClient } from \"https://esm.sh/[email protected]?dev\";\n\nconsole.log(\"hello\");\nlet a: number = \"a\";\n"}}},
{"type":"measure","name":"did_open","count":1,"duration":0},
@dsherret
Copy link
Member

Does this only occur when using the lsp and deno run at the same time? Does it occur when only running deno run ...etc..? Does the deno and vscode process have access to %LOCALAPPDATA%\deno (usually C:\Users\<your-username>\AppData\Local\deno/`)? Do you have some special setup for your AppData directory?

Maybe related: #16577

@dsherret dsherret added the needs info needs further information to be properly triaged label Jan 14, 2023
@jeiea
Copy link
Contributor Author

jeiea commented Jan 14, 2023

deno run hangs always with the script regardless of the LSP. Debugging and formatting also hang.
It seems that deno and vscode have access to %LOCALAPPDATA%\deno, as the only difference between the two scripts test is editing and reloading the window.

I have no issue with #16577. I could run the command without problem so it may not be related.

@dsherret dsherret added bug Something isn't working correctly node compat and removed needs info needs further information to be properly triaged labels Jan 14, 2023
@dsherret dsherret changed the title deno hangs when run and lsp with npm specifier deno hangs when with npm:[email protected] specifier for run lsp Jan 14, 2023
@dsherret
Copy link
Member

Sorry, I should have tried this out as well. It also hangs for me with that specific npm specifier.

@bartlomieju
Copy link
Member

bartlomieju commented Jan 14, 2023

This oci-identity package is suspicious - if I check my cache folder there's no files there besides registry.json.

Running with --node-modules-dir doesn't even create node_modules/ directory.

Instaliing via npm install oci-identity gives a proper structure. Seems like a bug in NPM resolver?

@dsherret
Copy link
Member

dsherret commented Jan 14, 2023

@bartlomieju it's a deadlock. Basically this assertion would panic if it weren't for the lock on the previous line, which causes a deadlock:

assert_ne!(parent.id, child.id);

Specifically:

DEBUG RS - deno::npm::resolution::graph:566 - [email protected] - Resolved [email protected] to [email protected]

@dsherret dsherret changed the title deno hangs when with npm:[email protected] specifier for run lsp deno hangs when npm package has itself as a dependency Jan 14, 2023
@dsherret
Copy link
Member

It seems this package has itself as a dependency lol:

    "2.50.1": {
      "name": "oci-workrequests",
      "version": "2.50.1",
      "description": "OCI NodeJS client for WorkRequests",
      "repository": {
        "type": "git",
        "url": "git+https://github.com/oracle/oci-typescript-sdk.git"
      },
      "main": "./index.js",
      "typings": "./index",
      "scripts": {},
      "author": { "name": "Oracle Cloud Infrastructure" },
      "license": "(UPL-1.0 OR Apache-2.0)",
      "dependencies": { "oci-common": "2.50.1", "oci-workrequests": "2.50.1" },

dsherret added a commit that referenced this issue Jan 14, 2023
I'm not sure this properly handles scenarios where an npm package uses
an alias that resolves to itself, we can fix that if we find a package
that actually depends on that behavior.

Closes #17420
bartlomieju pushed a commit that referenced this issue Jan 16, 2023
I'm not sure this properly handles scenarios where an npm package uses
an alias that resolves to itself, we can fix that if we find a package
that actually depends on that behavior.

Closes #17420
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants