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

CRaC restoration fails when Actuator's running on a separate port #38502

Closed
sdeleuze opened this issue Nov 22, 2023 · 2 comments
Closed

CRaC restoration fails when Actuator's running on a separate port #38502

sdeleuze opened this issue Nov 22, 2023 · 2 comments
Assignees
Labels
type: bug A general bug
Milestone

Comments

@sdeleuze
Copy link
Contributor

As reported originally on sdeleuze/spring-boot-crac-demo#3, restoration with spring-boot-starter-actuator is fine with the default configuration but fails with a custom management port.

To reproduce:

@wilkinsona
Copy link
Member

wilkinsona commented Nov 22, 2023

This can be reproduced with spring-boot-smoke-test-actuator by stopping and starting the context:

public static void main(String[] args) {
	SpringApplication application = new SpringApplication(SampleActuatorApplication.class);
	application.setApplicationStartup(new BufferingApplicationStartup(1024));
	ConfigurableApplicationContext context = application.run(args);
	context.stop();
	context.start();
}

Resulting failure:

Exception in thread "main" org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:287)
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:467)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:256)
	at org.springframework.context.support.DefaultLifecycleProcessor.start(DefaultLifecycleProcessor.java:170)
	at org.springframework.context.support.AbstractApplicationContext.start(AbstractApplicationContext.java:1459)
	at smoketest.actuator.SampleActuatorApplication.main(SampleActuatorApplication.java:67)
Caused by: org.springframework.context.ApplicationContextException: Failed to start bean 'webServerStartStop'
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:287)
	at org.springframework.context.support.DefaultLifecycleProcessor$LifecycleGroup.start(DefaultLifecycleProcessor.java:467)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at org.springframework.context.support.DefaultLifecycleProcessor.startBeans(DefaultLifecycleProcessor.java:256)
	at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:201)
	at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:965)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:619)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:146)
	at org.springframework.boot.actuate.autoconfigure.web.server.ChildManagementContextInitializer.onApplicationEvent(ChildManagementContextInitializer.java:86)
	at org.springframework.boot.actuate.autoconfigure.web.server.ChildManagementContextInitializer.onApplicationEvent(ChildManagementContextInitializer.java:1)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:178)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:171)
	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:149)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:445)
	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:378)
	at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:47)
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:284)
	... 6 more
Caused by: org.springframework.boot.web.server.PortInUseException: Port 8888 is already in use
	at org.springframework.boot.web.server.PortInUseException.lambda$0(PortInUseException.java:70)
	at org.springframework.boot.web.server.PortInUseException.lambda$1(PortInUseException.java:85)
	at org.springframework.boot.web.server.PortInUseException.ifCausedBy(PortInUseException.java:103)
	at org.springframework.boot.web.server.PortInUseException.ifPortBindingException(PortInUseException.java:82)
	at org.springframework.boot.web.server.PortInUseException.throwIfPortBindingException(PortInUseException.java:69)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:228)
	at org.springframework.boot.web.servlet.context.WebServerStartStopLifecycle.start(WebServerStartStopLifecycle.java:44)
	at org.springframework.context.support.DefaultLifecycleProcessor.doStart(DefaultLifecycleProcessor.java:284)
	... 22 more
Caused by: java.lang.IllegalArgumentException: standardService.connector.startFailed
	at org.apache.catalina.core.StandardService.addConnector(StandardService.java:235)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.java:286)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:214)
	... 24 more
Caused by: org.apache.catalina.LifecycleException: Protocol handler start failed
	at org.apache.catalina.connector.Connector.startInternal(Connector.java:1046)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:171)
	at org.apache.catalina.core.StandardService.addConnector(StandardService.java:232)
	... 26 more
Caused by: java.net.BindException: Address already in use
	at java.base/sun.nio.ch.Net.bind0(Native Method)
	at java.base/sun.nio.ch.Net.bind(Net.java:555)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
	at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:247)
	at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:202)
	at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1280)
	at org.apache.tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.java:1366)
	at org.apache.coyote.AbstractProtocol.start(AbstractProtocol.java:635)
	at org.apache.catalina.connector.Connector.startInternal(Connector.java:1043)
	... 28 more

The restart of the main web server causes the management context, including its web server, to be refreshed again.

@wilkinsona wilkinsona changed the title CRaC restoration fails with a custom management port CRaC restoration fails when Actuator's running on a separate port Nov 22, 2023
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 22, 2023
@wilkinsona wilkinsona added this to the 3.2.x milestone Nov 22, 2023
@wilkinsona wilkinsona self-assigned this Nov 22, 2023
@wilkinsona wilkinsona modified the milestones: 3.2.x, 3.2.0 Nov 22, 2023
@sdeleuze
Copy link
Contributor Author

Thanks for the quick fix @wilkinsona, I confirm this fixes the issue.

ndwlocatieservices added a commit to ndwnu/nls-routing-map-matcher that referenced this issue Nov 6, 2024
…o v3.2.0

This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [nu.ndw.nls.geometry:nls-geometry](https://spring.io/projects/spring-boot) ([source](https://github.com/spring-projects/spring-boot)) | compile | minor | `3.1.2` -> `3.2.0` |

---

### Release Notes

<details>
<summary>spring-projects/spring-boot (nu.ndw.nls.geometry:nls-geometry)</summary>

### [`v3.2.0`](https://github.com/spring-projects/spring-boot/releases/tag/v3.2.0)

[Compare Source](spring-projects/spring-boot@v3.1.2...v3.2.0)

#### ⭐ New Features

-   Auto-configure observations for RestClients [#&#8203;38500](spring-projects/spring-boot#38500)
-   Add support for Oracle Free, the replacement for Oracle XE, with Testcontainers and Docker Compose [#&#8203;38476](spring-projects/spring-boot#38476)
-   Provide dependency management for org.crac:crac [#&#8203;38378](spring-projects/spring-boot#38378)
-   Add new properties for Liquibase 4.24.0 [#&#8203;38274](spring-projects/spring-boot#38274)
-   Provide a way to create custom ApplicationContextFactory in SpringBootContextLoader [#&#8203;38205](spring-projects/spring-boot#38205)
-   Report friendly error when failing to find AOT initializer [#&#8203;38188](spring-projects/spring-boot#38188)

#### 🐞 Bug Fixes

-   Annotation based ConditionalOnBean checks can cause early initialization of FactoryBeans [#&#8203;38507](spring-projects/spring-boot#38507)
-   CRaC restoration fails when Actuator's running on a separate port [#&#8203;38502](spring-projects/spring-boot#38502)
-   App that depends on Tomcat and on Jetty's websocket-server module fails to start with IllegalStateException: WebSocketComponents has not been created [#&#8203;38286](spring-projects/spring-boot#38286)
-   App fails to start with a NoSuchMethodError when using Flyway 10.0.0 [#&#8203;38268](spring-projects/spring-boot#38268)
-   MeterRegistry throws BeanCreationNotAllowedException on shutdown [#&#8203;38240](spring-projects/spring-boot#38240)
-   Resolution of productionRuntimeClasspath configuration may select the wrong variant and contain a dependency's source jar [#&#8203;38233](spring-projects/spring-boot#38233)
-   Docker JSON parsing fails on certain locales [#&#8203;38220](spring-projects/spring-boot#38220)
-   FileNotFoundException is thrown serving resources due to JarUrlConnection.getLastModified() returning zero [#&#8203;38204](spring-projects/spring-boot#38204)
-   Failed to extract parameter names exception thrown when binding with non-enumerable property source [#&#8203;38201](https://github.com/spring-projects/spring...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants