on setProvider call, shutting down the previous provider should happen before creating the new one
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 50/100
Research direction
Start at the setProvider entry point and trace how the existing provider is shut down and how the replacement is initialized. Reproduce the provider replacement shown in the issue, then verify that shutdown finishes before initialization begins and that the Unleash duplicate-client error no longer occurs.
Written by the indexing model from the issue text.
Description
Hi,
I noticed that if I use setProvider to set a provider, then later I want to replace it with another provider (in my case, I do this to supports changing the api key I use to connect to the provider without stopping my application, so I recreate the provider with the new key) the following happens in parallel:
- the shutting down of the old provider
- the initialization of the new one
For Unleash, this can be a problem as shown in those logs:
server-1 | {"timestamp":"2026-04-28T10:55:47.302964637Z","logger":"io.getunleash.repository.FeatureBackupHandlerFile","level":"INFO","thread":"openfeature-provider-thread-1","message":"Unleash will try to load feature toggle states from temporary backup"}
server-1 | {"timestamp":"2026-04-28T10:55:47.304799269Z","logger":"io.getunleash.repository.PollingFeatureFetcher","level":"INFO","thread":"openfeature-provider-thread-1","message":"Starting polling client"}
server-1 | {"timestamp":"2026-04-28T10:55:47.485565437Z","logger":"io.getunleash.DefaultUnleash","level":"ERROR","thread":"openfeature-provider-thread-1","message":"You already have 1 clients for AppName [my-app] with instanceId: [xxxxxxxx] running. Please double check your code where you are instantiating the Unleash SDK"}
server-1 | {"timestamp":"2026-04-28T10:55:47.485655434Z","logger":"dev.openfeature.contrib.providers.unleash.UnleashProvider","level":"INFO","thread":"openfeature-provider-thread-1","message":"finished initializing provider"}
server-1 | {"timestamp":"2026-04-28T10:55:47.485682289Z","logger":"dev.openfeature.sdk.FeatureProviderStateManager","level":"INFO","thread":"openfeature-provider-thread-1","message":"Provider Unleash transitioned from state NOT_READY to state READY"}
server-1 | {"timestamp":"2026-04-28T10:55:47.486912037Z","logger":"dev.openfeature.contrib.providers.unleash.UnleashProvider","level":"INFO","thread":"openfeature-provider-thread-2","message":"shutdown"}
server-1 |
As we can see the shutdown of the original client happens after the initialization of the new one and we get an ERROR message from the Unleash library.
- Dominant language
- Java
- Stars
- 128
- Forks
- 61
- Avg merge
- 5h 57m
- Merged PRs (30d)
- 26
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from open-feature/java-sdk
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
open-feature/java-sdk#2019 · 1 comment ·
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
open-feature/java-sdk#2014 · 1 comment ·
-
v0.9.0
Difficulty 5/5 Over a week Newbie friendliness 35/100
open-feature/java-sdk#1999 ·
-
multi-provider
Difficulty 5/5 Over a week Newbie friendliness 35/100
open-feature/java-sdk#1882 ·
-
open-feature/java-sdk#1792 · 1 assignee ·
All issues in open-feature/java-sdk
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
infinispan/infinispan#18150 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
opensearch-project/k-NN#3597 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100