WMI query with multiple sets causes stack overflow
26 February, 2021 at 3:35 am #3817
Hello again Glenn!
I’ve managed to work myself into a hole again. I’m attempting to use WMI queries to gather information and store it in variables via the
set:functionality. It seems that specifying a single variable via the WMI %name% return style doesn’t set the value, and instead only puts the literal string
%WhateverProperty%into the variable.
The big one though I ran into when attempting to collect multiple pieces of information in a single query. Specifying more than one variable in the
set:section causes a stack overflow during UpdateEntries (according to the log). DesktopInfo.exe then closes (and will leave DesktopInfo64.exe orphaned if it was running.
Windows version: Windows 10 Pro for Workstations 20H2 (19042.804)
Product version: 18.104.22.16842
Expected output: Result: MYMACHINE\myUserName WORKGROUP PC-Model
Actual output: Result: %UserName% %Workgroup% %Model% (Or a stack overflow with no output.)
Small ini to reproduce issue: (uncomment one of the WMI lines at a time. I left the stack overflow line in.)1234567891011121314151617181920212223242526[options]log=desktopinfo.loglog-level=debugdesktopinfo64=1inimonitortime=2[items]# Display DTI version as a sanity check.FILE=active:1,interval:0,color:%Highlight%,type:version,text:DTI Version,file:DesktopInfo.exe,display:%2# Uncomment one of the WMI lines below.# Works, shows expected values:#WMI=hidden:0,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,display:%UserName% %Workgroup% %Model%# Sets %FullUser% to the literal string "%UserName%", but also does not cause crash:#WMI=hidden:1,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,set:FullUser=%UserName%# Causes Stack Overflow on UpdateEntries:WMI=hidden:1,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,set:FullUser=%UserName% Workgroup=%Workgroup% Model=%Model%# OutputCOMMENT=text:Result: %FullUser% %Workgroup% %Model%
Log output from stack overflow:123456789101112131425-02-21 11:29:33:755 DEBUG UpdateEntries Complete.25-02-21 11:29:33:756 DEBUG GetFileWatch: DesktopInfo.exe 125-02-21 11:29:33:757 DEBUG FILE run, time: 0ms25-02-21 11:29:33:758 DEBUG FILE process25-02-21 11:29:33:759 DATA FILE 22.214.171.1244225-02-21 11:29:33:761 DATA FILE () True25-02-21 11:29:33:762 DEBUG WMI: Namespace=root\cimv2 Query=Win32_ComputerSystem25-02-21 11:29:33:778 DEBUG WMI run, time: 16ms25-02-21 11:29:33:779 DEBUG WMI process25-02-21 11:29:33:780 DATA WMI %rowcount%25-02-21 11:29:33:782 DATA WMI () True25-02-21 11:29:34:658 ERROR UpdateEntries: Stack overflow
2 March, 2021 at 12:26 am #3820rtrussParticipant
I was able to get this to work, i am not in a workgroup but it still worked with domain in its place
WMI=hidden:0,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,Row-text:FullUser| DOMAIN| Model,display:%UserName%| %DOMAIN%| %Model%
Workgroup and Model are already ‘known’ to dti i believe so a set would not be needed for those.
hope that helps.
2 March, 2021 at 12:58 am #3821
Hey rtruss, I appreciate that workaround. I was more demonstrating the stack overflow, as it seems to happen with any time I use multiple sets from a WMI query.
I did manage to work around it for my use case too: if I break each WMI query set into a single set per query, using
displayand a single, non-‘equals’ set like so:123WMI=hidden:1,interval:0,namespace:root\cimv2,query:Win32_ComputerSystem,set:FullUser,display:%UserName%
Everything works like I’d expect!
Obviously there’s un-needed overhead in running the query multiple times, but the majority of the data I’m collecting I’m doing with
interval:0, so it’s a relatively small issue for now!
3 March, 2021 at 9:47 am #3823
I’ve fixed the multi SET for WMI items. I couldn’t reproduce the stack overflow though. It’s possible I fixed it while working on other things.
3 March, 2021 at 3:27 pm #3824
Awesome news, Glenn!
I’ll keep my eye open for the next release and will see if I can reproduce it at all and let you know if it got fixed along the way!
5 March, 2021 at 8:52 am #3826
I just loaded up 2.10.1 and reproduced your error so I can say the bug has been fixed in the next release.
5 March, 2021 at 9:41 am #3829
Incredible! I wish everything had the same sort of turnaround you do, Glenn. Thanks a heap!
5 March, 2021 at 9:47 am #3830
Having said that, I notice it’s been 2 months since the last release which is unusual. I like to do updates monthly. But I have a good excuse (I think), I’ve been experimenting with a plugin system.
- You must be logged in to reply to this topic.