Skip to content

debugger freeze everytime on specific breakpoints in typescript applications #205226

Closed

Description

@avan2s

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.86.1
  • OS Version: Ubuntu 22.04

In my company projects the debugger stucks sometimes. Now this issue occured on my open source project and hopefully the vscode dev team is able to help, why the debugger is freezing since several months from time to time.

Steps to Reproduce:

  1. Make sure docker and node lts is installed on your machine. On my side it is v20.10.0
  2. checkout the specific tag from the following repository and install the dependencies with: git clone [email protected]:avan2s/prisma-transactions.git && cd prisma-transactions && git checkout v0.1-vscode-hangup && npm i
  3. open vscode from terminal with code --disable-extensions . (it will also crash with plugins, but just to be sure, we have the same state)
  4. toggle auto attach Smart (F1 => Debug: Auto Attach => smart) and then open the vscode terminal
  5. set a breakpoint in the following line: https://github.com/avan2s/prisma-transactions/blob/0d8b0460015b303ab9091c1c983c62d819b46bbf/src/services/prisma-tx-propagation-extension.ts#L61
  6. in the vscode terminal execute npm run test:watch
  7. when the watcher is started press a for running all jest tests
  8. vscode stops at the breakpoint. Sometimes it freezes directly, but you can trigger the freeze by clicking in the watch variables on the Closure
    image
  9. vs code debugger freezes. You are unable to go to the next step from now on. Only way to escape is closing the vscode terminal

I think this issue is related to several debugger freezes i experienced in the last 4 month. Maybe this helps you to reproduce the issue.

Thanks for your help!

Activity

  1. avan2s commented on Feb 14, 2024

    @avan2s
    Author

    i can also confirm this issue exist for my macOs system: Apple M1 Sonoma 14.2.1 Darwin arm64 23.2.0
    vscode version: 1.86.1

    Especially frustrating, when you try to figure out hard bugs when it hangs up all the time and the only thing that works are console log statements.

  2. conceto-NKO commented on Feb 14, 2024

    @conceto-NKO

    I've successfully replicated the issue on my system as well. Below are the pertinent details of my MacBook Pro setup.

    macOS Version: Ventura 13.5 (22G74)
    Model Identifier: MacBookPro15,1
    Processor: 6-Core Intel Core i7, 2.6 GHz
    System Architecture: amd64
    Kernel Version: Darwin 22.6.0
    VSCode Version: 1.85.1

  3. ripkeanny commented on Feb 15, 2024

    @ripkeanny

    Can be replicated using:

    OS Version: Windows 10 Pro Version 22H2
    WSL Version: Ubuntu-20.04
    VSCode Version: 1.86.1

  4. connor4312 commented on Feb 15, 2024

    @connor4312
    Member

    /jsDebugLogs

  5. vscodenpa commented on Feb 15, 2024

    @vscodenpa

    Please collect trace logs using the following instructions:

    If you're able to, add "trace": true to your launch.json and reproduce the issue. The location of the log file on your disk will be written to the Debug Console. Share that with us.

    ⚠️ This log file will not contain source code, but will contain file paths. You can drop it into https://microsoft.github.io/vscode-pwa-analyzer/index.html to see what it contains. If you'd rather not share the log publicly, you can email it to [email protected]

  6. added
    info-needed
    on Feb 15, 2024
  7. avan2s commented on Feb 15, 2024

    @avan2s
    Author

    I added a launch.json file and configured the trace parameter and started the test with my npm package.json script npm run test:watch2, which allows me to attach with the launch.json:
    "test:watch2": "node --inspect-brk ./node_modules/.bin/jest -i --verbose --config jest-unit.json --watchAll"

    It started the debugger in watch mode, attached with the launch.json, and executed all tests with a. The breakpoint was set and the error was reproduced:

    {
        "version": "0.2.0",
        "configurations": [
            {
                "name": "Attach to Jest Tests",
                "type": "node",
                "request": "attach",
                "trace": true,
                "port": 9229,
                "restart": true,
                "skipFiles": ["<node_internals>/**"]
            }
        ]
    }

    The trace log file with jest watch with jest prompt, where i pressed a to execute all tests and reproduced the issue:
    vscode-debugadapter-70819bfc.json

    And also the trace log file with watchAll in order to prevent the prompt and executing the tests directly - also reproduced the issue:
    vscode-debugadapter-251a8652.json

    I have to mention that the file got bigger until the terminal was closed.

    If you want to try out yourself , the created launch.json and the npm run test:watch2 script is available here by checking out the tag with: git checkout v0.2-vscode-hangup-with-launch

  8. connor4312 commented on Feb 16, 2024

    @connor4312
    Member

    Thanks for the logs and the repro.

    This is because the debugger attempts to use the nodejs.util.inspect.custom symbol to represent variables in the Variables view. It looks like this is defined on the _prismaClient, but calling it blocks and crashes the program. You can see this by adding this line inside of createProxyHandlerForFunction:

    (_prismaClient as any)[Symbol.for('nodejs.util.inspect.custom')]();

    This eventually crashes with:

    RangeError: Maximum call stack size exceeded
        at enable (node:internal/inspector_async_hook:50:16)
        at formatRaw (node:internal/util/inspect:1052:7)
        at formatValue (node:internal/util/inspect:840:10)
        at formatProperty (node:internal/util/inspect:1945:11)
        at formatRaw (node:internal/util/inspect:1054:9)
        at formatValue (node:internal/util/inspect:840:10)
        at inspect (node:internal/util/inspect:364:10)
        at Fe.i.<computed> (/Users/connor/Downloads/prisma-transactions/node_modules/@prisma/client/runtime/library.js:26:8227)
        at formatValue (node:internal/util/inspect:805:19)
        at formatProperty (node:internal/util/inspect:1945:11)
        at formatRaw (node:internal/util/inspect:1054:9)
        at formatValue (node:internal/util/inspect:840:10)
        at inspect (node:internal/util/inspect:364:10)
        at Fe.i.<computed> (/Users/connor/Downloads/prisma-transactions/node_modules/@prisma/client/runtime/library.js:26:8227)
    ...
    

    I didn't debug further than this.

    Let me know if you run into other issues.

  9. added
    *out-of-scope
    on Feb 16, 2024
  10. andreasvh-conceto commented on Feb 16, 2024

    @andreasvh-conceto

    Hi Connor Peet (@connor4312),
    thx for your investigation and conclusion. This also explained why it only hangs up in debug mode.

    (_prismaClient as any)[Symbol.for('nodejs.util.inspect.custom')]();
    

    What would be your recommendation to fix such kind of an error? Just deleting the symbol from the _prismaclient? I never assigned this symbol there manually.

    Would be grateful for any explanation, what options I can consider.

    thx a lot 🙏

  11. avan2s commented on Feb 18, 2024

    @avan2s
    Author

    Thanks a lot, i will raise an issue on their side: prisma/orm#23181
    Best regards :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*out-of-scopeinfo-needed

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions