cluster: fixing debug port logic for forking workers
Checklist
-
make -j8 test
(UNIX), orvcbuild test nosign
(Windows) passes -
tests and/or benchmarks are included -
commit message follows commit guidelines
Affected core subsystem(s)
- cluster
Description of change
An attempt to fix #8495 (closed) and #9435 (closed)
You can set debug ports for workers in cluster with cluster.settings.execArgv
hacking once again!
The problem is, at current version, debug port for workers calculated from master's process.debugPort
, but a lot of software uses cluster.settings
which is being ignored.
After this changes, if you set a port in cluster.settings.execArgv
and not starting master with debug, port offset would be added to port in cluster.settings.execArgv
.
Debug port autoincrement logic seems to be preserved.
The other issue is, debug argument format evolved and current regex does not cover all the cases that node accepts. Parsing it with one regex is too hard now, so I had to write some js to do it.
Also, current logic changes every debug argument, while changing only last one is sufficient.