-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
AVA debug --break is hardcoded to bind to loopback interface. #2406
Comments
👋 |
@romashko-bo-ma it's been all of three days since this issue was accepted… so clearly not! Perhaps you'd be interested in picking this up? |
I can confirm, the above solution works perfectly, as far as I can see. Unfortunately, I'm not confident enough to submit a PR for this one - I have 20 years of C++ professional experience and using JS just for fun projects, so don't wanna dive deeper into the environments I do not control completely. Sorry for the excuse :) |
No worries @DYefimov, though it sounds like you're really close to having a workable PR? A good way to "force" things to happen in open source is to kick off a PR… I tend to respond to those first when I have time for AVA, instead of other coding tasks. |
What a diplomatic answer @novemberborn :) Actually, there is one more issue strongly connected to this one. Currently, AVA enters debug mode with the "debug flag cmd option", which requires a filename to "break on" supplied alongside. Where "counter-intuitive" is: one expects to put a breakpoint in any file, and start debugging. All the above in concise form: AVA doesn't following default nodejs debug behavior, causing frustration, and configurational disaster. Issues #2274 and #1505 have more info about this. ====== IMHO the root cause of all this nuisance is in node itself. It deceives developers into implementing hacks like AVA debug infrastructure. First of all, node don't have multi-threading (until lately, I believe - i.e. worker_threads), so one in need have only option - to fork. Fork is something that works on an operating system level. Thus, to implement graceful (convenient, intuitive) debugging behavior, the calling process (nodejs in our case) should implement it by itself in a convenient way. And this is the main issue. If we look closer into, for example, gdb - it has "follow-fork-mode" parameter, i.e. on fork - should we follow child or stay in a caller process? I'm not a nodejs professional, so not completely sure in the above statement, but it seems it works this way. If it is so, we have a couple of options here. Option 1. Option 2. Option 3. Conclusion. P.S. This is not a "have to", but a mere "have in mind". Spent a day digging deeper into this topic, because it got me so frustrated while configuring. And I'm still unhappy with the results, as passing debug file path with config option introduces unnecessary level of complexity on a layer that is not tailored for such kind of tasks. Convolution => most likely bad design. |
What is this default behavior you're referring to? The |
It's definitely useful. But IMHO this is a 'hack' approach from the users perspective. The default behavior would be:
To implement this, the best solution would be - utilization of multithreading. But as far as I can tell, multithreading should solve this 'hack' approach, and simplify debugging experience. |
But you don't call
How? You need to launch some other tool to attach a debugger first.
We want that regardless, actually. I considered using the |
Can't you just pass -- --inspect-brk to the underlying node process?
So, presumably, passing --inspect-brk to the underlying process should work?
Dealt with it too, having messaging though pipes between forks on top of it, plus serialization and other blackjack - yeah, it becomes messy really fast. And inconvenient to debug. That's why I was wondering about multithreading, and if forking is really necessary in this case.
Well, this answers most of the questions. IMHO this discussion is exhausted now. |
Dockerized AVA in debug mode is difficult to reach due to hardcoded binding to loopback interface (127.0.0.1).
file: ava/lib/worker/subprocess.js:188
require('inspector').open(options.debug.port, '127.0.0.1', true);
Hacking it to 0.0.0.0 fixes the problem.
It would be nice if it defaults to loopback, and read, for example, 'options.debug.ip' as an override.
There are couple workarounds but none of them are easy/convenient.
socat -d tcp-listen:xxxx,reuseaddr,fork tcp:127.0.0.1:xxxx &
But meh...
The text was updated successfully, but these errors were encountered: