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

When using --inspect wait a little bit for inspector connection at program start #13664

Closed
dsherret opened this issue Feb 13, 2022 · 11 comments
Closed
Assignees
Labels
cli related to cli/ dir inspector related to the inspector integration

Comments

@dsherret
Copy link
Member

See denoland/vscode_deno#557 and past issue #12417

This is a extremely annoying issue as mostly beginners (me) will encounter this when running very simple scripts that run very fast. In practice once one gets a website running this isn't a issue anymore.

When debugging a small program it might execute and close before vscode connects. This leads to a poor user experience where vscode just keeps waiting to connect, but deno has already finished. There's no indication in the UI about what's going on and it's confusing.

To mitigate (not entirely prevent) this scenario, we could introduce a small delay at program start that delays for X milliseconds or until a connection is established. This delay should be long enough to eliminate this issue happening on most machines, but short enough that nobody would really notice it (especially people who are attaching a debugger after launching). We could perhaps even make this delay take into account the amount of time that's elapsed since deno started so it would likely only be hit for small programs.

@dsherret dsherret added cli related to cli/ dir inspector related to the inspector integration labels Feb 13, 2022
@dsherret dsherret self-assigned this Feb 13, 2022
@bartlomieju
Copy link
Member

@dsherret do you need help with this issue?

@dsherret
Copy link
Member Author

dsherret commented Mar 8, 2022

@bartlomieju I looked into this today tried implementing the suggestion about using a channel, but this isn't possible because then no code polls for new sessions. As a test, I tried doing just a spin loop polling for connections and it didn't work either because I think the breakpoints hadn't been set yet. Anyway, this looks like a bigger change than I expected and maybe we should do the other refactors you were going to do first.

@bartlomieju bartlomieju self-assigned this Mar 22, 2022
@dsherret dsherret removed their assignment Apr 13, 2022
@stale
Copy link

stale bot commented Jun 18, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 18, 2022
@dsherret dsherret removed the stale label Jun 18, 2022
@stale
Copy link

stale bot commented Sep 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 16, 2022
@sant123
Copy link

sant123 commented Sep 16, 2022

Not stale?

@stale stale bot removed the stale label Sep 16, 2022
@stale
Copy link

stale bot commented Nov 19, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

@csvn
Copy link

csvn commented Dec 3, 2022

I would be very interested in an option for this. It's annoying when breakpoints aren't hit because they're too "early". I also found it very confusing at first why the debugger did not stop on a small program.

@bartlomieju
Copy link
Member

@dsherret with recent refactor of inspector it should now be possible to implement it. The question remain how long should we wait before starting to execute code? 100ms seems to short...

@JustinGrote
Copy link

Is there a way to potentially have a --inspect-wait or some other option that will hold execution until a debugger connects? This is different than --inspect-brk in that it wouldn't break immediately and I wouldn't have to step the first break every time. This behavior is basically how all other debuggers (node, dotnet, etc.) tend to work, is there a limitation that would prevent this functionality?

@dsherret
Copy link
Member Author

dsherret commented Dec 9, 2022

We'd prefer to do --inspect-wait as you mentioned earlier denoland/vscode_deno#755 (comment)

I'm going to close this issue.

@dsherret dsherret closed this as not planned Won't fix, can't repro, duplicate, stale Dec 9, 2022
@JustinGrote
Copy link

@dsherret thanks, for some reason I thought that other issue was actually in a different repo, glad we are of like minds. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli related to cli/ dir inspector related to the inspector integration
Projects
None yet
Development

No branches or pull requests

5 participants