spring-cloud-aws icon indicating copy to clipboard operation
spring-cloud-aws copied to clipboard

Add Crac JDK support (SSM open socket)

Open tzvetkovg opened this issue 1 year ago • 4 comments

Type: Feature

I've been experimenting with https://github.com/CRaC/docs. However, when you attempt to do a crac checkpoint and you've got awssdk:ssm dependency in the pom then Crac checkpointing fails with

Suppressed: jdk.internal.crac.mirror.impl.CheckpointOpenSocketException: Socket[addr=ssm.eu-west-1.amazonaws.com/67.220.224.3,port=443,localport=36852] 2024-01-19 09:56:26 at java.base/jdk.internal.crac.JDKSocketResourceBase.lambda$beforeCheckpoint$0(JDKSocketResourceBase.java:68) ~[na:na] 2024-01-19 09:56:26 at java.base/jdk.internal.crac.mirror.Core.checkpointRestore1(Core.java:169) ~[na:na] 2024-01-19 09:56:26 at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:286) ~[na:na] 2024-01-19 09:56:26 at java.base/jdk.internal.crac.mirror.Core.checkpointRestore(Core.java:265) ~[na:na] 2024-01-19 09:56:26 at jdk.crac/jdk.crac.Core.checkpointRestore(Core.java:72) ~[jdk.crac:na] 2024-01-19 09:56:26 at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103) ~[na:na] 2024-01-19 09:56:26 at java.base/java.lang.reflect.Method.invoke(Method.java:580) ~[na:na] 2024-01-19 09:56:26 at org.crac.Core$Compat.checkpointRestore(Core.java:141) ~[crac-1.4.0.jar:na] 2024-01-19 09:56:26 ... 13 common frames omitted

as CraC JDK requires no open sockets and files before checkpointing.

Describe the solution you'd like

  1. Spring Cloud AWS to add support for Crac JDK to automatically pause the SSM open socket when checkpointing OR
  2. add an ability to manually stop/restart the SSM socket via a code property at runtime

tzvetkovg avatar Jan 19 '24 10:01 tzvetkovg

I think this is more complex than just open socket. On restore, secrets have to be fetched again. If you are able to provide a PR we are happy to look into it.

maciejwalkowiak avatar Feb 17 '24 16:02 maciejwalkowiak

I think an option would be to reload the ssm automatically at runtime with a different profile. In most cases one would take the crac snapshot in a profile like devl but when deploying you would want to switch to QA/PROD when you restore. So is there any way to refresh the ssm config and all related beans at runtime without destroying and recreating the whole app?

tzvetkovg avatar Apr 04 '24 08:04 tzvetkovg

There is a way to reload properties https://docs.awspring.io/spring-cloud-aws/docs/3.1.1/reference/html/index.html#propertysource-reload-2

maciejwalkowiak avatar Apr 04 '24 20:04 maciejwalkowiak

yeah but will that update the properties of all related beans. For instance, if you've got mongoDB or Kafka configured with the initial profile I guess you would have to manually re-create these beans with the new properties, it won't do it for you automatically?

tzvetkovg avatar Apr 05 '24 09:04 tzvetkovg