vshaxe / hashlink-debugger

Visual Studio Code Debugger for Haxe/HashLink applications
https://hashlink.haxe.org/
MIT License
57 stars 23 forks source link

Error Debugging in VSCode: Failed to connect on debug port #109

Closed SeiferTim closed 2 years ago

SeiferTim commented 2 years ago

This happens about 9 out of 10 times when I try to test/debug my project... it started up... maybe a week or two ago? I might eventually be able to debug if I keep hitting 'cancel' and then trying again, but it's frustrating. Nothing shows up in the Debug Console when this happens.

image

Not sure why it asks to open the launch.json, but here is mine:

{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Build + Debug",
            "type": "lime",
            "request": "launch"
        },
        {
            "name": "Debug",
            "type": "lime",
            "request": "launch"
        },
        {
            "name": "Macro",
            "type": "haxe-eval",
            "request": "launch"
        }
    ]
}

When I try to debug, this is all that is in my Terminal:

> Executing task: lime build hl -debug -clean --connect 6000 <

Terminal will be reused by tasks, press any key to close it.

...and my Output:

Haxe language server started
Haxe Path: haxe.exe
Using --server-connect
Haxe connected!
Listening on port 6000
Done.
Haxe server restart requested: DisplayArguments configuration was changed
Haxe Path: haxe.exe
Using --server-connect
Haxe connected!
Restarted Haxe server: DisplayArguments configuration was changed
Done.
Client connected
Client disconnected
Client connected
Client disconnected
Devyatyi9 commented 2 years ago

I have the same error in cli project, and I don't use additional dependencies.

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "HashLink/JIT build & debug",
      "type": "hl",
      "hxml": "build-hl.hxml",
      "request": "launch",
      "cwd": "${workspaceFolder}",
      "preLaunchTask": {
        "type": "haxe",
        "args": "active configuration"
      }
    },
    {
      "name": "Haxe interpreter",
      "type": "haxe-eval",
      "request": "launch"
    }
  ]
}
ncannasse commented 2 years ago

This is a known issue, we're working on a fix

ncannasse commented 2 years ago

This was fixed in 1.3.2 that was just published

SeiferTim commented 2 years ago

I still have the same problem about 1/5 of the time I try to debug - but the error message is less verbose and just says "failed to connect on debug port" and the same 2 options ("Open Launch.json" & "cancel")

ncannasse commented 2 years ago

@SeiferTim are you sure you're on 1.3.2 ?

SeiferTim commented 2 years ago

image

Yes.

SeiferTim commented 2 years ago

Version 1.3.4 - I was excited to see the changelog message "(again) fixed timeout issue when connecting on debug port" ...only to get the error on my first, second, third, and fourth attempt to debug. I didn't get it on attempts 5 or 6, and then I got it again on number 7. This is still pretty common... I looked in your source code, and it looks like you have a delay of 2000 ms? (2s) Can you expose that as a setting that the user can change?

ncannasse commented 2 years ago

If you edit the delay and increase it, does it work better? It's weird that hl.exe is taking more than 2s to launch.

Le sam. 30 juil. 2022 à 11:52, Tim I Hely @.***> a écrit :

Version 1.3.4 - I was excited to see the changelog message "(again) fixed timeout issue when connecting on debug port" ...only to get the error on my first, second, third, and fourth attempt to debug. I didn't get it on attempts 5 or 6, and then I got it again on number 7. This is still pretty common... I looked in your source code, and it looks like you have a delay of 2000 ms? (2s) Can you expose that as a setting that the user can change?

— Reply to this email directly, view it on GitHub https://github.com/vshaxe/hashlink-debugger/issues/109#issuecomment-1200126885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQAJ52CEOGSCKQ5JHLTVWT3MTANCNFSM5SO74O2Q . You are receiving this because you modified the open/close state.Message ID: @.***>

ncannasse commented 2 years ago

I mean change it manually in adapter.js

Le sam. 30 juil. 2022 à 14:27, Nicolas Cannasse @.***> a écrit :

If you edit the delay and increase it, does it work better? It's weird that hl.exe is taking more than 2s to launch.

Le sam. 30 juil. 2022 à 11:52, Tim I Hely @.***> a écrit :

Version 1.3.4 - I was excited to see the changelog message "(again) fixed timeout issue when connecting on debug port" ...only to get the error on my first, second, third, and fourth attempt to debug. I didn't get it on attempts 5 or 6, and then I got it again on number 7. This is still pretty common... I looked in your source code, and it looks like you have a delay of 2000 ms? (2s) Can you expose that as a setting that the user can change?

— Reply to this email directly, view it on GitHub https://github.com/vshaxe/hashlink-debugger/issues/109#issuecomment-1200126885, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHZXQAJ52CEOGSCKQ5JHLTVWT3MTANCNFSM5SO74O2Q . You are receiving this because you modified the open/close state.Message ID: @.***>

SeiferTim commented 2 years ago

I changed it to 30000 and it hasn't shown the error yet (a couple dozen builds so-far). My project is... very large. If that might be a factor.