pivotal-cf / java-cfenv

Apache License 2.0
91 stars 56 forks source link

Problem with binding Redis and SCS Config Server #204

Closed karolpawlak closed 1 year ago

karolpawlak commented 1 year ago

Hello Team,

We observed that one of our customers since switching to Spring Boot 3, their application no longer starts and that results in the error (full error stack attached):

"MSG": "Redis health check failed", "DATA": "boundedElastic-1 org.springframework.boot.actuate.data.redis.RedisReactiveHealthIndicator Redis health check failed org.springframework.data.redis.
RedisConnectionFailureException: Unable to connect to Redis\n at...

When the application was using Spring Boot 2.7.3, it worked no problem. Another interesting thing we noticed is that when you remove the Config Server and its dependency, everything works fine. They have managed to find a workaround by manually specifying the datasource configuration in the application.yml file. By redefining Redis properties by copying spring.redis.x to spring.data.redis.x, and it works.

They are using the following versions of products: TAS 2.13.9 Spring Cloud Services 3.1.40 Redis 3.1.3-build.2

We believe that the problem is in java-cfenv. The root cause: Spring Boot 3.0 now uses a new path for configuring Redis. It used to be spring.redis.x, now it’s spring.data.redis.x. I believe that the following source file should be looked into in java-cfenv.

You can find the sample app used for testing in this repository, it also contains a README with the description of the issue and a workaround https://github.com/benpart/redis-demo

Reproduction steps: FAIL

  1. Deploy the sample app and bind it to a Config Server and Redis instances
  2. Observe the error

INVESTIGATION

  1. Edit the app and remove the Config Server dependency.
  2. Deploy the app and bind it Redis instance
  3. Works

WORKAROUND

  1. Deploy the sample app but activate correctif profile, and bind it to a Config Server and Redis instances
  2. Works
karolpawlak commented 1 year ago

FYI since the Spring Cloud Bindings library does for Kubernetes service bindings what Java CFEnv does for CF/TAS services, that project has to make changes as well as shown here.

rama78 commented 1 year ago

Thanks @karolpawlak for reporting this. We have encountered a similar issue and hope that the fix will soon be available for us in the java-cfenv-boot dependency, thanks to @pivotal-david-osullivan. Our team plans to add JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{enabled: false}' to the manifest file to suppress the warning explained at https://via.vmw.com/EiBW. We would greatly appreciate it if a new release is available before the end of March with Redis fix.

karolpawlak commented 1 year ago

Great stuff, thanks @rama78. Well done @pivotal-david-osullivan 👏

rama78 commented 1 year ago

@pivotal-david-osullivan - can you please update when this bug will be fixed?

anthonydahanne commented 1 year ago

@pivotal-david-osullivan - can you please update when this bug will be fixed?

in progress: https://github.com/pivotal-cf/java-cfenv/pull/207

rama78 commented 1 year ago

Thanks, @anthonydahanne for the update .. looking forward to a new lease!