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

How to generate CRaC image for app with database connection #336

Open
alapierre opened this issue Sep 9, 2024 · 1 comment
Open

How to generate CRaC image for app with database connection #336

alapierre opened this issue Sep 9, 2024 · 1 comment

Comments

@alapierre
Copy link

alapierre commented Sep 9, 2024

Issue description

I want to test CRaC image with Micronaut. My sample app use Micronaut Data and PostgreSQL database: https://github.com/alapierre/micronaut-sample. I'm trying to build image like that:

./mvnw package -Dpackaging=docker-crac -Dmaven.test.skip=true

but got error when checkpoint image starts:

INFO: Use -Djdk.crac.collect-fd-stacktraces=true to find the source.
STARTUPTIME 5887858889428 restore
STARTUPTIME 5887877052516 restore-finish
An exception during a checkpoint operation:
jdk.internal.crac.mirror.CheckpointException
	Suppressed: java.nio.channels.IllegalSelectorException
		at java.base/sun.nio.ch.EPollSelectorImpl.beforeCheckpoint(EPollSelectorImpl.java:401)
		at java.base/jdk.internal.crac.mirror.impl.AbstractContext.invokeBeforeCheckpoint(AbstractContext.java:43)
		at java.base/jdk.internal.crac.mirror.impl.AbstractContext.beforeCheckpoint(AbstractContext.java:58)
		at java.base/jdk.internal.crac.mirror.impl.BlockingOrderedContext.beforeCheckpoint(BlockingOrderedContext.java:64)
		at java.base/jdk.internal.crac.mirror.impl.AbstractContext.invokeBeforeCheckpoint(AbstractContext.java:43)
		at java.base/jdk.internal.crac.mirror.impl.AbstractContext.beforeCheckpoint(AbstractContext.java:58)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestore1(Core.java:153)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32918]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32908]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: sun.nio.ch.ServerSocketChannelImpl[/[0:0:0:0:0:0:0:0]:8080]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32932]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32960]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=51894]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32990]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32980]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32934]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32974]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=/192.168.20.52,port=5432,localport=32950]
		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:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenResourceException: FD fd=209 type=unknown path=anon_inode:[eventpoll]
		at java.base/jdk.internal.crac.mirror.Core.translateJVMExceptions(Core.java:117)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestore1(Core.java:188)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
	Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenResourceException: FD fd=210 type=unknown path=anon_inode:[eventfd]
		at java.base/jdk.internal.crac.mirror.Core.translateJVMExceptions(Core.java:117)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestore1(Core.java:188)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:294)
		at java.base/jdk.internal.crac.mirror.Core.checkpointRestoreInternal(Core.java:307)
Wait up to 60s for snapshot to be complete
0.0.0.0.0.0.0.0.0.0.0.0.Snapshotting failed
Killing 600

Postgres is running in docker, and Docker host IP is 192.168.20.52 - it accepts connections on 5432 host port.

application.yml db configuration for build:

datasources:
  default:
    db-type: postgres
    dialect: POSTGRES
    driver-class-name: org.postgresql.Driver
    url: jdbc:postgresql://192.168.20.52:5432/sample
    username: user
    password: secret

docker-compose:

version: '3'
services:

  db:
    image: postgres:15-alpine
    volumes:
      - pg_data:/var/lib/postgresql/data
    environment:
      - POSTGRES_PASSWORD=secret
      - POSTGRES_USER=user
      - POSTGRES_DB=sample
    ports:
      - "5432:5432"

volumes:
  pg_data:
@alapierre
Copy link
Author

when I changed url to container ID (jdbc:postgresql://d42abe54b25a:5432/sample), I've got:

Starting application
Started application as process 600
Waiting 10s for application to start
OpenJDK 64-Bit Server VM warning: Option CRTraceStartupTime was deprecated in version 21.0.4 and will likely be removed in a future release. Use option CRaCTraceStartupTime instead.
. __  __ _                                  _   
|  \/  (_) ___ _ __ ___  _ __   __ _ _   _| |_ 
| |\/| | |/ __| '__/ _ \| '_ \ / _` | | | | __|
| |  | | | (__| | | (_) | | | | (_| | |_| | |_ 
|_|  |_|_|\___|_|  \___/|_| |_|\__,_|\__,_|\__|
10:13:34.226 [main] INFO  org.hibernate.Version - HHH000412: Hibernate ORM core version 6.5.2.Final
10:13:34.255 [main] INFO  com.zaxxer.hikari.HikariDataSource - HikariPool-1 - Starting...
....failed
Killing 600

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant