{"record":{"id":"527894073af7466f","repo":"alibaba/nacos","slug":"fuzzy-watch-result-future-timeout-for-unit-tomill","errorCode":null,"errorMessage":"fuzzy watch result future timeout for {unit.toMillis(timeout)} millis","messagePattern":"fuzzy watch result future timeout for (.+?) millis","errorType":"exception","errorClass":"TimeoutException","httpStatus":null,"severity":"warning","filePath":"client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigFuzzyWatchContext.java","lineNumber":547,"sourceCode":"            public Set<String> get() throws InterruptedException, ExecutionException {\n                synchronized (ConfigFuzzyWatchContext.this) {\n                    while (!ConfigFuzzyWatchContext.this.initializationCompleted.get()) {\n                        ConfigFuzzyWatchContext.this.wait();\n                    }\n                }\n                return new HashSet<>(ConfigFuzzyWatchContext.this.getReceivedGroupKeys());\n            }\n            \n            public Set<String> get(long timeout, TimeUnit unit)\n                throws InterruptedException, TimeoutException {\n                if (!ConfigFuzzyWatchContext.this.initializationCompleted.get()) {\n                    synchronized (ConfigFuzzyWatchContext.this) {\n                        ConfigFuzzyWatchContext.this.wait(unit.toMillis(timeout));\n                    }\n                }\n                \n                if (!ConfigFuzzyWatchContext.this.initializationCompleted.get()) {\n                    throw new TimeoutException(\n                        \"fuzzy watch result future timeout for \" + unit.toMillis(timeout)\n                            + \" millis\");\n                }\n                return new HashSet<>(ConfigFuzzyWatchContext.this.getReceivedGroupKeys());\n            }\n        };\n        \n        return future;\n    }\n}\n","sourceCodeStart":529,"sourceCodeEnd":558,"githubUrl":"https://github.com/alibaba/nacos/blob/9b989acdf181d00898f2e8839257bb2b2a3cefe3/client/src/main/java/com/alibaba/nacos/client/config/impl/ConfigFuzzyWatchContext.java#L529-L558","documentation":"Thrown as TimeoutException by the Future returned from ConfigFuzzyWatchContext.createNewFuture().get(timeout, unit) when initializationCompleted is still false after waiting unit.toMillis(timeout). The context waits on its intrinsic monitor for the server to finish the initial fuzzy-watch sync; if it does not complete in time, the bounded get throws.","triggerScenarios":"Calling future.get(N, unit) on a fuzzy-watch future whose server-side initialization has not finished within N (e.g. server slow, many matched configs, or connection issue delaying the sync).","commonSituations":"Large config namespace matching many keys (slow initial sync), server under load, network delay, or too-short a timeout relative to the matched set size.","solutions":["Increase the timeout passed to get() to match the expected sync duration.","Reduce the dataId/group pattern breadth so fewer configs match and sync faster.","Verify the server is healthy and the gRPC connection is stable so the init handshake completes.","If acceptable, use the no-timeout get() that blocks until completion."],"exampleFix":"// before\nSet<String> keys = future.get(2, TimeUnit.SECONDS);\n\n// after\nSet<String> keys = future.get(30, TimeUnit.SECONDS);","handlingStrategy":"try-catch","validationCode":"// size the timeout to the expected sync duration for the matched set size\nlong timeoutMs = Math.max(5_000, matchedKeyEstimate * 50L);","typeGuard":null,"tryCatchPattern":"try {\n    Set<String> keys = future.get(30, TimeUnit.SECONDS);\n} catch (TimeoutException te) {\n    log.warn(\"fuzzy watch init not complete in time; retry or widen pattern\");\n}","preventionTips":["Size the get(timeout) to the matched-set scale.","Narrow dataId/group patterns to reduce sync volume.","Ensure server/gRPC health so the init handshake completes promptly."],"tags":["config","fuzzy-watch","timeout","client"],"backgroundTag":null,"analyzedSha":"9b989acdf181d00898f2e8839257bb2b2a3cefe3","analyzedAt":"2026-08-14T07:17:31.569Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}