-
-
Notifications
You must be signed in to change notification settings - Fork 21.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
Automatic remote debugger port assignment #34651
Conversation
f8c7b1c
to
8202af6
Compare
40beba1
to
14f42ef
Compare
d7f6578
to
8d15d23
Compare
I don't understand this.... can you elaborate further? |
The
The game knows the debugging port because the code is changing the settings of the editor: EDIT: @Faless One thing to notice is that if the user opens the EDIT: @Faless Any ideas why |
@Faless @akien-mga This could also be solved by making the |
I'm not sure how putting it in the project settings would help, the problem
is that the debugger server doesn't know anything about what (if anything)
is being launched and has no way to communicate back to the editor.
I'm planning to work on this, there's also work in #33925 to expose the
preset currently being launched to the debugger (since we need the export
platform) so that object might be used to pass the information between the
two.
Additionally, after #36244 I would like to have a generic way to start the
debugger (without the need to start the game at all), so we would still
need a generic editor debugger port.
…On Mon, Feb 17, 2020, 15:30 Zak Stam ***@***.***> wrote:
@Faless <https://github.com/Faless> @akien-mga
<https://github.com/akien-mga> This could also be solved by making the Remote
debugger port a *Per project* setting instead of an *Editor* setting.
Unfortunately i don't have time to do this myself ATM but if none takes the
time to do it, i will look into it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#34651?email_source=notifications&email_token=AAM4C3UQ2U7P2BBT3DF3OVTRDKNQZA5CNFSM4KANAUKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEL6TSYI#issuecomment-587020641>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAM4C3UQT5V4BQNJVL52A7TRDKNQZANCNFSM4KANAUKA>
.
|
Here is my situation: Unless i am misunderstanding, #36244 is solving the need of running the same game inside the same editor multiple times. I don't see how this would solve my situation (unless you are planing on making the debugger as a standalone? Or somehow use the debugger of one editor for both projects?). Puting the debugger port in the project settings instead will allow me to assign different port for each project and wont have to go through changing it every time (of course the "Automatic" part is gone in this case but atleast this can solve the problem with an one time setting). |
Would it work if the editor debugging port was set to a random port in a predefined range on every startup? Each instance would automatically use a different port this way. The port would still be the same across game restarts, as long as you don't close the editor. |
Yeah that would work i guess. But how can you make sure you are not using a port that is already in use (by another program i mean)? EDIT: Maybe a |
As I mentioned, the main problem right now is that the debugger server doesn't know anything about what (if anything) is being launched and has no way to communicate back to the editor.
The problem, again, is communicating that properly to the game being lunched. |
I'm confused by that. Is the game that is being run using a debugger server as you say? By looking at
A few points to make things clearer (or help you correct me if i'm wrong):
|
To be honest, I don't like the idea of changing an editor setting just because we can't listen to a port. |
Indeed this is more of a hack than a proper fix but i didn't see any other easy way to overcome the issue. But as far as 3.2 Stable branch is concerned here are my points:
As of this, if you check the code in the PR it only retries for 6 times and then it gives up with an error: int remote_port = (int)EditorSettings::get_singleton()->get("network/debug/remote_port");
int max_tries = 6; // Maybe expose this so that users can increase it?
int current_try = 0;
int delay = 0;
while (true) {
if (delay >= 1000) {
if (server->listen(remote_port) != OK) {
EditorNode::get_log()->add_message(String("Remote debugger failed listening on port: ") + itos(remote_port) + String(" Retrying on new port: " + itos(remote_port + 1)), EditorLog::MSG_TYPE_WARNING);
remote_port++;
current_try++;
} else {
EditorSettings::get_singleton()->set("network/debug/remote_port", remote_port);
break;
}
if (current_try >= max_tries) {
EditorNode::get_log()->add_message(String("Remote debugger error listening for connections. No free port"), EditorLog::MSG_TYPE_ERROR);
break;
}
delay = 0;
}
delay++;
}
If you still think this is not worth it then let me so i can close the PR. |
I was thinking something more like ( 1b06c6f ) i.e. that |
Cool, i'l make the changes.
Can you please elaborate on this one. Is it relevant to this PR (Should i check something specific in this PR?) or is it a general observation? |
More a general observation, we need to double check that emitting |
f96507e
to
8d15d23
Compare
To rebase, follow the PR workflow article, or if you prefer a graphical client, check out my Git workflow for Godot video. If you aren't sure how to resolve a particular conflict, resolve in favor of master, then re-add your changes manually.
I recommend you don't do this, a force push while the PR is closed will break the PR (GitHub bug). |
|
1575101
to
18a5c03
Compare
18a5c03
to
0e49da1
Compare
I'm not even sure how this was closed.. Anyway, sorry for the mess. I will create a new PR with the changes. @aaronfranke Thanks for the help! |
This is an attempt to automatically assign a free port for the
remote debugger
when you want to run multiple instances of the editor. This should be especially helpful when someone wants to test a network server/client situation and solves the problem of needing multiple editor files in order to have different settings. In fact, in Linux(i suppose in windows also) i can not run the same version of the editor and have different settings.A few points for review:
Added a warning for when the port is changed:

NOTE: If a user opens and then closes the editor settings after the port has been changed then the new port settings will be saved.
EDIT: This does not seem to be working in windows.Fixed by #36321server->listen(remote_port)
seems to be returning OK even if the port is used by another program.