-
Notifications
You must be signed in to change notification settings - Fork 918
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
Add logic to remove duplicates from the bound port list to prevent internal services from being bound to the server twice. #5022
Add logic to remove duplicates from the bound port list to prevent internal services from being bound to the server twice. #5022
Conversation
…al service port and the management server port to be the same.
...nfigure/src/test/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtilTest.java
Outdated
Show resolved
Hide resolved
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.
Thanks for fixing the bug, @tomatophobia! ❤️
...toconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java
Outdated
Show resolved
Hide resolved
Could you check the failures of lint and flaky-tests? |
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.
Thanks @tomatophobia ! Happy with the changes once @ikhoon 's comment is addressed 🙇 👍 🙇
@DynamicPropertySource
static void registerPortProperties(DynamicPropertyRegistry registry) {
final int port = PortUtil.unusedTcpPort();
registry.add("armeria.internal-services.port", () -> port);
registry.add("management.server.port", () -> port);
}
@Test
void exposeActuatorServiceHasSingleCustomPrefixAtInternalPort() throws Exception {
...
} Thank you for review! 🙇♂️ I have found the cause of the flaky test failure, but it seems to contradict the assumptions of this PR. As mentioned in the comment of issue #5022, I proceeded with the assumption that it was a mistake for the user to set However, the above test intentionally tests the scenario where they are the same. So, I'm wondering if I can simply delete it or if I need to reconsider a solution. (I should have noticed it right after submitting the PR, and I apologize for the delay. 😭) |
Yes, I think we can simply remove the test. 😉 Could you also fix this line? 😉 Line 258 in d482f0c
|
Had a chat with @jrhee17 and we realized that this will break the current behavior if a user uses the same ports with So how about just deduping instead of raising an exception as the original issue suggested? |
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 have removed the previously written code. Following the revised direction, I added conditions to prevent the use of duplicate ports.
...toconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java
Outdated
Show resolved
Hide resolved
...toconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java
Outdated
Show resolved
Hide resolved
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 have modified the code using the dedupPorts
method to remove duplicates.
...toconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java
Outdated
Show resolved
Hide resolved
...toconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java
Outdated
Show resolved
Hide resolved
...toconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java
Outdated
Show resolved
Hide resolved
...toconfigure/src/main/java/com/linecorp/armeria/internal/spring/ArmeriaConfigurationUtil.java
Outdated
Show resolved
Hide resolved
050ef23
to
4115556
Compare
4115556
to
3ecce56
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.
Awesome! Thanks a lot! 👍 👍 👍
@tomatophobia Would you update the PR title and description to reflect the final change? |
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.
Thanks, @tomatophobia! 🙇
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.
Thanks, @tomatophobia! 👍
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #5022 +/- ##
============================================
- Coverage 74.18% 74.18% -0.01%
- Complexity 19464 19469 +5
============================================
Files 1672 1672
Lines 71749 71768 +19
Branches 9189 9197 +8
============================================
+ Hits 53230 53243 +13
- Misses 14191 14196 +5
- Partials 4328 4329 +1
☔ View full report in Codecov by Sentry. |
Motivation:
internal-services.port
andmanagement.server.port
are set to the same, the internal services are bound twice.Modifications:
Result: