Upgrade of Spring Cloud Gateway service instance fails with Service broker error: Index 0 out of bounds for length 0
search cancel

Upgrade of Spring Cloud Gateway service instance fails with Service broker error: Index 0 out of bounds for length 0

book

Article ID: 382901

calendar_today

Updated On:

Products

VMware Tanzu Application Service VMware Tanzu Platform Spring Essentials

Issue/Introduction

Attempting to manually upgrade service instance results in error:

cf update-service <service name> -c '{ "upgrade": true }'
Updating service instance <service name> in org <org> / space <space as admin...Job (6854c20b-1b14-4c9b-bb68-89e815573a8f) failed: update could not be completed: Service broker error: Index 0 out of bounds for length 0
FAILED

Service Broker logs shows errors such as:

2024-11-26T21:16:44.680Z ERROR 8 --- [p.spring-cloud-gateway-service-scg-service-broker] [     parallel-1] s.c.ServiceBrokerWebFluxExceptionHandler : Unknown exception handled: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0

...

Error has been observed at the following site(s): *__checkpoint ⇢ Handler org.springframework.cloud.servicebroker.controller.ServiceInstanceController#updateServiceInstance(Map, String, boolean, String, String, String, UpdateServiceInstanceRequest) [DispatcherHandler] Original Stack Trace:

at java.base/jdk.internal.util.Preconditions.outOfBounds(Unknown Source) ~[na:na] at java.base/jdk.internal.util.Preconditions.outOfBoundsCheckIndex(Unknown Source) ~[na:na] at java.base/jdk.internal.util.Preconditions.checkIndex(Unknown Source) ~[na:na] at java.base/java.util.Objects.checkIndex(Unknown Source) ~[na:na] at java.base/java.util.ArrayList.get(Unknown Source) ~[na:na] at io.pivotal.spring.cloud.servicebroker.appbroker.workflow.GatewayUpdateServiceInstanceWorkflow.lambda$buildResponse$4(GatewayUpdateServiceInstanceWorkflow.java:94) ~[!/:2.2.0]

Resolution

Check the backing application instance for the service.

  1. For the service instance that's failing to upgrade, run:  cf service --guid <service> to get the guid of the service.
  2. Run the command to target org / space for the backing app: cf t -o p-spring-cloud-gateway-service -s <service-guid>
  3. Check that app is running and app logs: cf app gateway and cf logs --recent gateway
  4. If the app is not running, then check to see if it ever properly started: cf events gateway and attempt restarting: cf restart gateway

If the gateway fails to start with an error:

Restarting app gateway in org p-spring-cloud-gateway-service / space <service guid> as admin... Waiting for app to start... App cannot start without a package to stage or a droplet to run. FAILED

This would be an indication that the droplet was never created for app, which likely means that backing application was never successfully created.

The recommended resolution would be to check with developers using service instance and have them manually delete and recreate the SCG service instance.

cf delete-service <service-name>
cf create-service p.gateway standard my-gateway -c '{ "host": "myhostname", "domain": "example.com" }'