Skip to content

KeyValueDelegate caches empty path during Vault unavailability #889

@t1000robot

Description

@t1000robot

Description:
I'm using spring-vault-core version 3.1.1 with spring-boot version 3.2.6. I encountered an issue related to the KeyValueDelegate class when interacting with Vault.

Steps to reproduce:
Start the service, which accesses Vault during initialization to fetch some entities.
Simulate Vault unavailability during the first gRPC request to the service.
Observe that KeyValueDelegate caches an empty path ("") in its mountInfo property.
When Vault becomes available again, the service continues to use the cached empty path, causing failures.

Observed behavior:
The service throws an IllegalArgumentException with the message:
"Path must not be empty".
The issue persists until the service is restarted, as the cached empty path is not refreshed.

Expected behavior:
When Vault becomes available again, the mountInfo cache should refresh and fetch the correct path.

Workarounds attempted:
Overriding getMountInfo() — Not feasible due to multiple final/private/default.
Configuration options — No existing configurations seem to control the cache behavior for mountInfo.

Current solution:
Restarting pods when health probes fail due to Vault unavailability. However, this approach risks failed requests during the graceful shutdown process.

Questions:
Is there an existing way to avoid caching the empty path or to refresh mountInfo dynamically?
Are there plans to address this issue in future versions?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions