-
Notifications
You must be signed in to change notification settings - Fork 270
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
fix(backups): backup worker inspect failed: address already in use #8197
base: master
Are you sure you want to change the base?
Conversation
8c9ffd7
to
9152f6e
Compare
041e9ed
to
ea511dd
Compare
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.
I don't think that's the correct approach, what if there is multiple backup workers?
Any other solutions?
We could test which ports are currently used, and increment. |
const inspectArg = process.execArgv.find(arg => arg.startsWith('--inspect')) | ||
const execArgv = inspectArg | ||
? [inspectArg.replace(/^(--inspect)(=.*)?$/, (_, prefix) => `${prefix}=localhost:9230`)] | ||
: [] | ||
const worker = fork(PATH, [], { execArgv }) |
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.
I am ok with the port being static since this is a debug use but it should be configurable, either by a specific command param like --inspectBackupWorkerPort=
or in the config file
also, it could be a good idea to add this in the package.json script to be able to use yarn debug
for example
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.
Since the debug port of the main process is configurable and set by --inspect, I propose that we use this port incremented by 1 for the port of the backup process.
This is what is generally done for apps that use multiple ports (like proxies that use port 8080 and 8081).
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.
ok, if you use the port of the main nodejs process and increment this. It will limit to a singe backup job debuggable at once but it's enough to help the devs
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.
Done. I also added the ability to use --inspect-brk, which may be necessary if we need to intercept the worker start.
ea511dd
to
2c92cf6
Compare
2c92cf6
to
87506e4
Compare
87506e4
to
c73670a
Compare
Description
When launching a backup worker, if using node inspector it fails since the port is already in use.
This fix allows to use another port.
Checklist
Fixes #007
,See xoa-support#42
,See https://...
)Introduced by
CHANGELOG.unreleased.md
Review process
Notes: