{"record":{"id":"761902ef03a744fd","repo":"java-native-access/jna","slug":"no-results-after-timeout-ms","errorCode":null,"errorMessage":"No results after <timeout> ms.","messagePattern":"No results after <timeout> ms\\.","errorType":"exception","errorClass":"java.util.concurrent.TimeoutException","httpStatus":null,"severity":"error","filePath":"contrib/platform/src/com/sun/jna/platform/win32/COM/WbemcliUtil.java","lineNumber":307,"sourceCode":"            // Get the data from the query in step 6 -------------------\n            Pointer[] pclsObj = new Pointer[1];\n            IntByReference uReturn = new IntByReference(0);\n            Map<T, WString> wstrMap = new HashMap<>();\n            HRESULT hres = null;\n            for (T property : propertyEnum.getEnumConstants()) {\n                wstrMap.put(property, new WString(property.name()));\n            }\n            while (enumerator.getPointer() != Pointer.NULL) {\n                // Enumerator will be released by calling method so no need to\n                // release it here.\n                hres = enumerator.Next(timeout, pclsObj.length, pclsObj, uReturn);\n                // Enumeration complete or no more data; we're done, exit the loop\n                if (hres.intValue() == Wbemcli.WBEM_S_FALSE || hres.intValue() == Wbemcli.WBEM_S_NO_MORE_DATA) {\n                    break;\n                }\n                // Throw exception to notify user of timeout\n                if (hres.intValue() == Wbemcli.WBEM_S_TIMEDOUT) {\n                    throw new TimeoutException(\"No results after \" + timeout + \" ms.\");\n                }\n                // Other exceptions here.\n                if (COMUtils.FAILED(hres)) {\n                    throw new COMException(\"Failed to enumerate results.\", hres);\n                }\n\n                VARIANT.ByReference pVal = new VARIANT.ByReference();\n                IntByReference pType = new IntByReference();\n\n                // Get the value of the properties\n                IWbemClassObject clsObj = new IWbemClassObject(pclsObj[0]);\n                for (T property : propertyEnum.getEnumConstants()) {\n                    clsObj.Get(wstrMap.get(property), 0, pVal, pType, null);\n                    int vtType = (pVal.getValue() == null ? Variant.VT_NULL : pVal.getVarType()).intValue();\n                    int cimType = pType.getValue();\n                    switch (vtType) {\n                        case Variant.VT_BSTR:\n                            values.add(vtType, cimType, property, pVal.stringValue());","sourceCodeStart":289,"sourceCodeEnd":325,"githubUrl":"https://github.com/java-native-access/jna/blob/d036ad9781adad4b66693e8fa7098e4ac665e0a3/contrib/platform/src/com/sun/jna/platform/win32/COM/WbemcliUtil.java#L289-L325","documentation":"During WmiQuery's enumerateProperties loop, if the WMI enumerator returns WBEM_S_TIMEDOUT, a TimeoutException is thrown with the elapsed timeout value. The caller waited longer than the configured timeout (ms) for the next WMI result without receiving one.","triggerScenarios":"Calling execute(timeout) with a small timeout against a slow or unresponsive WMI provider; queries over remote namespaces with high latency; system under heavy load slowing the WMI service (WinMgmt).","commonSituations":"Enumerating large classes (Win32_Process with many properties) on loaded machines; remote WMI queries across slow network links; WMI service restarts/hangs; setting timeout to a few ms expecting immediate results.","solutions":["Increase the timeout passed to execute(int timeout) to a value realistic for the query.","Optimize the WQL query (select fewer properties, add WHERE clauses) to reduce enumeration time.","Retry the query, since WMI providers are often transiently slow.","Investigate WMI service health (winmgmt service, WMI logs) if timeouts persist."],"exampleFix":"// before\nWmiResult<Result> r = query.execute(100); // too short\n// after\nWmiResult<Result> r = query.execute(30_000);","handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    result = query.execute(timeoutMs);\n} catch (TimeoutException e) {\n    result = retryWithBackoff(query, Math.max(timeoutMs * 2, 30_000));\n}","preventionTips":["Set generous timeouts (seconds, not ms) for WMI","Narrow WQL queries with WHERE and fewer properties","Test against loaded systems and remote namespaces"],"tags":["windows","wmi","jna","timeout"],"backgroundTag":"request-timeout","analyzedSha":"d036ad9781adad4b66693e8fa7098e4ac665e0a3","analyzedAt":"2026-09-12T06:50:59.239Z","contentChangedAt":"2026-09-12T06:50:59.239Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}