-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Increment debug port for each child process. #874
Conversation
CI has failed. |
This looks like might be a solution on node side?
|
the debug-port=0 is a good option, but will only support node 8.x later branches. If this is something that people will want I'll refine it (I have done so on my own project) to also include handling environment variables. Port conflicts are definitely an issue with the way commander handles sub commands (given the spawn nature of the process). |
@abetomo The CI is failing on syntax not on functionality. The lint seems extremely specific. |
I am leaning towards noting the port issue for debugging and including the two available debugging approaches in the README. i.e. debug sub-command directly, or use node support. I like the idea of suggesting a standard node solution that works for other products too. LTS maintenance for node 6 ends this month so I don't think node 8 is a problem moving forward. However, I only just found |
And I forgot to say explicitly @tcf909 , thanks for the contributions so far, whatever we decide! |
@shadowspawn I would say that using --inspect 0 (which is already supported) is not sustainable for development. Each time you start the process you need to attach to a new port. If we use incrementing ports you'll only need to define a few connections. |
Note to self: Visual Studio Code detects these patterns:
Also autoAttachChildProcesses: https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_automatically-attach-debugger-to-nodejs-subprocesses Code for VSCode pattern and port detection: |
The nodejs Long thread for node with people having port conflicts with spawn/fork. There is mention of debugging inspectors which can auto-detect child processes in debug mode (terminology?), initially in Chrome dev tools: |
After seeing that nodejs @tcf909 |
No specific reason. We don't accept host names in our code base for listening ports and wanted to make sure valid ips are passed through or caught at the point of identification and thrown (rather than passing down the stack and wondering what is wrong). We found different versions of node handle various scenarios differently when malformed data was passed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @tcf909
- I don't see any advantage to strong checking of the ip number, or that port is finite, as by the time we see them they have already been seen and used by node? I would prefer a simpler pattern.
- We don't want to increment port number "0" since now know that has its own special behaviour.
- Detect when port number not explicitly specified, and increment from the default port.
- Lint (as previously noted)
Let us know if you aren't interested in working through these changes. For me, deciding it is reasonable to increment the port was harder than the code! Can be picked up by someone else.
This is being considered for v3, but will need some work and to pass reviews. I am interesting in having a go (original author is not currently active). |
Closing favour of #991 Thank you for your contributions. |
When trying to debug a sub-command style program I ran into a port conflict with --inspect. This increments the debug port for spawned processes.