spring-boot version: 3.3.1 spring version: 6.1.10 azul version: zulu22.30.13-ca-crac-jdk22.0.1-linux_x64

I am currently working on integrating CRaC support with Spring Boot 3.3.1, as detailed before. During the checkpoint phase, I encountered an issue. It appears that the application's try to connect to mariadb in aws.

We have added mvn crac dependency:

      <dependency>
            <groupId>org.crac</groupId>
            <artifactId>crac</artifactId>
            <version>1.4.0</version>
        </dependency>

We try to use on demand checkpoint and the errors occurs running this command

 docker exec -it 529fbf0be225 jcmd 129 JDK.checkpoint
An exception during a checkpoint operation:
jdk.internal.crac.mirror.CheckpointException
    Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=**************.amazonaws.com/********,port=3306,localport=48524]
        at java.base/jdk.internal.crac.JDKSocketResourceBase.lambda$beforeCheckpoint$0(JDKSocketResourceBase.java:68)
        at java.base/jdk.internal.crac.mirror.Core.checkpointRestore1(Core.java:169)
        at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:286)
        at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:299)
    Caused by: java.lang.Exception: This file descriptor was created by HikariPool-1 connection adder at epoch:1722520291505 here
        at java.base/jdk.internal.crac.JDKFdResource.<init>(JDKFdResource.java:60)
        at java.base/jdk.internal.crac.JDKSocketResourceBase.<init>(JDKSocketResourceBase.java:44)
        at java.base/jdk.internal.crac.JDKSocketResource.<init>(JDKSocketResource.java:38)
        at java.base/java.net.SocketImpl$1.<init>(SocketImpl.java:78)
        at java.base/java.net.SocketImpl.<init>(SocketImpl.java:77)
        at java.base/sun.nio.ch.NioSocketImpl.<init>(NioSocketImpl.java:139)
        at java.base/java.net.SocketImpl.createPlatformSocketImpl(SocketImpl.java:54)
        at java.base/java.net.Socket.createImpl(Socket.java:579)
        at java.base/java.net.Socket.<init>(Socket.java:185)
        at java.base/javax.net.DefaultSocketFactory.createSocket(SocketFactory.java:261)
        at org.mariadb.jdbc.client.impl.ConnectionHelper.standardSocket(ConnectionHelper.java:109)
        at org.mariadb.jdbc.client.socket.impl.SocketUtility.lambda$getSocketHandler$0(SocketUtility.java:37)
        at org.mariadb.jdbc.client.impl.ConnectionHelper.createSocket(ConnectionHelper.java:68)
        at org.mariadb.jdbc.client.impl.ConnectionHelper.connectSocket(ConnectionHelper.java:127)
        at org.mariadb.jdbc.client.impl.StandardClient.<init>(StandardClient.java:102)
        at org.mariadb.jdbc.Driver.connect(Driver.java:69)
        at org.mariadb.jdbc.Driver.connect(Driver.java:95)
        at org.mariadb.jdbc.Driver.connect(Driver.java:26)
        at com.zaxxer.hikari.util.DriverDataSource.getConnection(DriverDataSource.java:137)
        at com.zaxxer.hikari.pool.PoolBase.newConnection(PoolBase.java:360)
        at com.zaxxer.hikari.pool.PoolBase.newPoolEntry(PoolBase.java:202)
        at com.zaxxer.hikari.pool.HikariPool.createPoolEntry(HikariPool.java:461)
        at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:724)
        at com.zaxxer.hikari.pool.HikariPool$PoolEntryCreator.call(HikariPool.java:703)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
        at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
        at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
        at java.base/java.lang.Thread.run(Thread.java:1570)

but application console shows that logs -->

 [Attach Listener] jdk.crac: Starting checkpoint
 [Attach Listener] o.s.b.j.HikariCheckpointRestoreLifecycle : Evicting Hikari connections
 [Attach Listener] o.s.c.support.DefaultLifecycleProcessor  : Restarting Spring-managed lifecycle beans after JVM restore
 [Attach Listener] o.s.c.c.refresh.RefreshScopeLifecycle    : Refreshing context on restart.
 [Attach Listener] o.s.c.c.refresh.RefreshScopeLifecycle    : Refreshed keys: []
[Attach Listener] o.s.b.web.embedded.netty.NettyWebServer  : Netty started on port 10000 (http)
[Attach Listener] o.s.c.support.DefaultLifecycleProcessor  : Spring-managed lifecycle restart completed (restored JVM running for -1 ms)
[Attach Listener] o.s.c.support.DefaultLifecycleProcessor  : Restarting Spring-managed lifecycle beans after JVM restore

As you can see, it shows the evictin hikari connections, so why it's still trying to connecto con database. Thanks in advance

Comment From: snicoll

Where did you set the spring.context.checkpoint=onRefresh property? If you're looking for help on using CraC, please review the documentation and have a look to the smoke tests for reference. If that didn't help, we'll need a small sample we can use to reproduce.

Comment From: cristobalhermida

We are not using spring.context.checkpoint=onRefresh property, in that case, we create the checkpoint on demand with "jcmd 129 JDK.checkpoint" command, but we have also tried "onrefresh way" adding this property in dockerfile ENTRYPOINT [ "java", "-Dspring.context.checkpoint=onRefresh","-Djdk.crac.collect-fd-stacktraces=true" , "-XX:CRaCCheckpointTo=/cr", "-jar", "./caront-oauth.jar" ], and the result is the same

Comment From: snicoll

Did you look at the smoke tests and the documentation as I've requested? For instance this.

Comment From: cristobalhermida

Not yet, i am going to check this

Comment From: cristobalhermida

We added to application.yml the properties that are recommended to enable the Hikari pool suspension, but nothing changes, we still have the same error.

org.springframework.context.ApplicationContextException: Failed to take CRaC checkpoint on refresh
   at org.springframework.context.support.DefaultLifecycleProcessor$CracDelegate.checkpointRestore(DefaultLifecycleProcessor.java:536)
   at org.springframework.context.support.DefaultLifecycleProcessor.onRefresh(DefaultLifecycleProcessor.java:194)
   at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:981)
   at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:627)
   at org.springframework.boot.web.reactive.context.ReactiveWebServerApplicationContext.refresh(ReactiveWebServerApplicationContext.java:66)
   at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:754)
   at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:456)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:335)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1363)
   at org.springframework.boot.SpringApplication.run(SpringApplication.java:1352)
   at com.reviewpro.caront.Caront.main(Caront.java:13)
   at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
   at java.base/java.lang.reflect.Method.invoke(Method.java:580)
   at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:91)
   at org.springframework.boot.loader.launch.Launcher.launch(Launcher.java:53)
   at org.springframework.boot.loader.launch.JarLauncher.main(JarLauncher.java:58)
Caused by: org.crac.CheckpointException: null
   at org.crac.Core$Compat.checkpointRestore(Core.java:144)
   at org.crac.Core.checkpointRestore(Core.java:237)
   at org.springframework.context.support.DefaultLifecycleProcessor$CracDelegate.checkpointRestore(DefaultLifecycleProcessor.java:530)
   ... 15 common frames omitted
   Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=**************rds.amazonaws.com/******,port=3306,localport=52098]

Comment From: snicoll

Thanks for following up, but, as I've requested previously:

If that didn't help, we'll need a small sample we can use to reproduce.

To do so you can attach a zip to this issue or push the code to a GitHub repository.

Comment From: spring-projects-issues

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

Comment From: spring-projects-issues

Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.