Skip to content
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

Allow Quarkus to pick a random debug port #33521

Merged
merged 1 commit into from
May 23, 2023
Merged

Conversation

geoand
Copy link
Contributor

@geoand geoand commented May 22, 2023

By passing a zero or negative value, Quarkus
will launch the dev-mode JVM process
using a random debugging port

Relates to: #33363

By passing a zero or negative value, Quarkus
will launch the dev-mode JVM process
using a random debugging port

Fixes: quarkusio#33363
@geoand
Copy link
Contributor Author

geoand commented May 22, 2023

As a follow-up, we could potentially force the use of a different port if the configured port is already taken.

@iocanel
Copy link
Contributor

iocanel commented May 22, 2023

Given that in the ServerSocket port 0 is the number that we use to pick the first available port. I would do the same here.
Of course expanding this to negative is possibly also fine. Sooo... yeah!

@geoand
Copy link
Contributor Author

geoand commented May 22, 2023

Yeah, I think it's pretty benign to do the same for negative numbers

@quarkus-bot
Copy link

quarkus-bot bot commented May 22, 2023

Failing Jobs - Building 70e8b6a

Status Name Step Failures Logs Raw logs
✔️ JVM Tests - JDK 11
✔️ JVM Tests - JDK 17
JVM Tests - JDK 17 Windows Build ⚠️ Check → Logs Raw logs
✔️ JVM Tests - JDK 19
✔️ Maven Tests - JDK 11
Maven Tests - JDK 11 Windows Build ⚠️ Check → Logs Raw logs

@geoand
Copy link
Contributor Author

geoand commented May 23, 2023

@maxandersen okay to merge?

@maxandersen
Copy link
Member

Yeah +1 though I'm mainly after having stable port used and then choose randomly if blocked.

Then one can start multiple quarkus dev and use discovery attach in IDEs that supports it.

@maxandersen
Copy link
Member

Actually. Wait a sec. Need to test something first.

@geoand
Copy link
Contributor Author

geoand commented May 23, 2023

Yeah +1 though I'm mainly after having stable port used and then choose randomly if blocked.

I can do that too after this one

@maxandersen
Copy link
Member

okey so here is what I was investigating - how intellij actually behave today. if you start two quarkus-dev listening on differeth http ports you end up with this view:

2023-05-23_10-02-22

note, one of those failed to listen and thus you can't know which is the right one if you are running multiple of the same app (different ones will have different path).

if you set explicit ports you get this:

2023-05-23_10-09-07

now you can actually differentiate.

Thus on its own this PR is of less use since if I need to set the -Ddebug value I would just set them explicitly as I did in the above.

so +1 on merging this but we really should be looking at getting dev mode by default to grab random debug port if requested is not available so you are always able to debug your quarkus dev mode.

@geoand
Copy link
Contributor Author

geoand commented May 23, 2023

we really should be looking at getting dev mode by default to grab random debug port if requested is not available so you are always able to debug your quarkus dev mode

Sure yeah, I'll have a look tomorrow

@geoand geoand merged commit 4c5e960 into quarkusio:main May 23, 2023
@quarkus-bot quarkus-bot bot added this to the 3.2 - main milestone May 23, 2023
@geoand geoand deleted the #33363 branch May 23, 2023 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants