sebhildebrandt / systeminformation

System Information Library for Node.JS
MIT License
2.65k stars 300 forks source link

Error when retrieving memory info on Windows Server 2012 R2 #918

Closed mountaindude closed 5 days ago

mountaindude commented 5 days ago

Describe the bug I get an error when retrieving memory info using SystemInformation.

What I experience seems to be similar to #857 but for memory data.

TypeError [ERR_INVALID_ARG_TYPE]: The "key" argument must be of type string or an instance of ArrayBuffer, Buffer, TypedArray, DataView, KeyObject, or CryptoKey. Received type number (137340747776)

That number (137..) is the amount of RAM on the server, I believe.

I am struggling a bit to debug it as I cannot reproduce the issue locally here, it only occurs at some servers where the app using systeminformation is deployed. The project using systeminformation is found here. I know - this is very vague and makes it difficult/impossible to debug this, but I still wanted to report it as it keeps happening here and there. Feels like there is a corner case bug hiding in SystemInformation.

Struggling to find a pattern for which servers it appears on. I have tried recreating it locally, to no avail. Current thinking is that it's happening on servers running the most recent WinSrv version (2022) or some very old version (2012 or older), which I have not tested my app on. Just a wild guess at this point though.

To Reproduce Cannot reproduce it locally, it only happens on some Windows Servers that I don't have access to. The problem has been reported on servers with 128 Gb to 768 GB RM, but I doubt the amount of RAM is causing this.

Current Output

Expected behavior Should be possible to get memory info without errors.

Environment (please complete the following information):

sebhildebrandt commented 5 days ago

Hi @mountaindude Thank you for reporting ... is there any chance to get the line number where this occurs?

mountaindude commented 5 days ago

Unfortunately not. The app I am using SystemInformation in catches the error and then just show the error message itself without any line numbers or stack dump (to avoid stressing the users of the app too much).

I can of course add more verbose logging, but that would involve getting those remote users to make changes on their servers - possible but not easy, especially in times of summer vacations.

I am installing a WinSrv 2012 R2 server right now to see if I can recreate the issue on that server. Will keep you posted.

mountaindude commented 5 days ago

No, my app works just fine on the Windows Server 2012 R2 server I just installed here.

Ok, I will add some better/more verbose logging to my app and see if I can get someone out there (someone who has reported this issue to begin with) to test it. That will give us a line number in SystemInformation where things go wrong.

mountaindude commented 5 days ago

Update:

Turned out to be a false alarm. I looked through (again..) SystemInformation's code for memory retrieval and couldn't figure out where that error would come from.

Taking a break for lunch and coming back afterwards, I realised the problem maybe wasn't in SystemInformation at all, but rather related to how the info returned from SystemInformation was used... Turned out to be correct.

So, closing this issue. Sorry for raising a false alert 😕