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
Retry when Spring tests fails to start a Server
with a random port obtained in advance
#4395
Conversation
…obtained in advance Motivation: If a random port (0) for internal services or managed services is specified in Spring configuration, the Spring integration module allocate available ports early and use them to configure additional service later. https://github.com/line/armeria/blob/948763acc7911c951e37dbd35132edd253ea3934/spring/boot2-actuator-autoconfigure/src/main/java/com/linecorp/armeria/spring/actuate/ArmeriaSpringActuatorAutoConfiguration.java#L258-L260 This is not a problem in production mode. However, in testing situation, many test servers are started with a random port and the available ports can be acquired by them. line#4391 line#4329 Modifications: - Add `RetryableArmeriaServerGracefulShutdownLifecycle` to retry a server with a backoff at most N times. Result: - This is not a perfect answer for the failure but it might reduce the number of failures. - Fixes line#4391 line#4329
Codecov Report
@@ Coverage Diff @@
## master #4395 +/- ##
============================================
- Coverage 73.84% 73.81% -0.04%
- Complexity 17702 17718 +16
============================================
Files 1505 1509 +4
Lines 66105 66198 +93
Branches 8309 8313 +4
============================================
+ Hits 48815 48862 +47
- Misses 13296 13330 +34
- Partials 3994 4006 +12
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Question) Would it be possible to just pass 0 for the internal/management port? (The same as we do when we create a |
That's a good idea. 👍 We could probably pass |
We can easily migrate armeria/zookeeper3/src/test/java/com/linecorp/armeria/common/zookeeper/ZooKeeperTestUtil.java Lines 49 to 67 in 1b4cd2a
But it is a different issue. Internal services use port-based virtual hosting that needs a pre-known port number. armeria/core/src/main/java/com/linecorp/armeria/server/ServerBuilder.java Lines 1446 to 1447 in 91c787f
So I'd like to leave it as a known issue. |
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.
👍 👍 👍
...c/test/java/com/linecorp/armeria/spring/RetryableArmeriaServerGracefulShutdownLifecycle.java
Outdated
Show resolved
Hide resolved
…spring/RetryableArmeriaServerGracefulShutdownLifecycle.java Co-authored-by: minux <songmw725@gmail.com>
This PR has been reverted because the changes cause build failures with Spring Boot 2.7.3 |
…obtained in advance (line#4395) Motivation: If a random port (0) for internal services or managed services is specified in Spring configuration, the Spring integration module allocate available ports early and use them to configure additional service later. https://github.com/line/armeria/blob/948763acc7911c951e37dbd35132edd253ea3934/spring/boot2-actuator-autoconfigure/src/main/java/com/linecorp/armeria/spring/actuate/ArmeriaSpringActuatorAutoConfiguration.java#L258-L260 This is not a problem in production mode. However, in testing situations, many test servers are started simultaneously with a random port and the available ports can be acquired by them. line#4391 line#4329 Modifications: - Add `RetryableArmeriaServerGracefulShutdownLifecycle` to retry a server with a backoff at most N times. Result: - This is not a perfect answer for the failure but it might reduce the number of failures. - Fixes line#4391 line#4329
Motivation:
If a random port (0) for internal services or managed services is
specified in Spring configuration, the Spring integration module
allocate available ports early and use them to configure additional
service later.
armeria/spring/boot2-actuator-autoconfigure/src/main/java/com/linecorp/armeria/spring/actuate/ArmeriaSpringActuatorAutoConfiguration.java
Lines 258 to 260 in 948763a
This is not a problem in production mode.
However, in testing situations, many test servers are started simultaneously
with a random port and the available ports can be acquired by them. #4391 #4329
Modifications:
RetryableArmeriaServerGracefulShutdownLifecycle
to retry aserver with a backoff at most N times.
Result:
number of failures.
com.linecorp.armeria.spring.actuate.ArmeriaSpringActuatorAutoConfigurationSecureTest.normal()
#4391 Test failure:LocalArmeriaPortHttpsTest.testPortConfiguration
#4329