otp icon indicating copy to clipboard operation
otp copied to clipboard

os_mon_sysinfo:get_disk_info/1 does not work

Open lukebakken opened this issue 3 years ago • 4 comments
trafficstars

Describe the bug

The following always crashes on my Windows 10 system:

application:ensure_all_started(os_mon).
os_mon_sysinfo:get_disk_info(["C:\\"]).

To Reproduce

Start werl.exe, then run the above two functions.

Expected behavior

Output similar to that for os_mon_sysinfo:get_disk_info():

10> os_mon_sysinfo:get_disk_info().               
["C:\\ DRIVE_FIXED 720496750592 1013310287872 720496750592\n",
 "Y:\\ DRIVE_REMOTE 0 0 0\n","Z:\\ DRIVE_REMOTE 0 0 0\n"]

Affected versions

Tested with verson 25.0.2 on Windows 10 Pro Workstation.

Additional context https://github.com/rabbitmq/rabbitmq-server/pull/4328 https://github.com/rabbitmq/rabbitmq-server/pull/5241

lukebakken avatar Jul 15 '22 21:07 lukebakken

PS I figure this is as good as any reason as any to get Windows build running in my environment, so I'll see if I can debug it a bit.

lukebakken avatar Jul 17 '22 12:07 lukebakken

Seems like the only problem here is that this return should not be there.

This module is however an internal module and the function you are calling is not used by any other functionality in Erlang/OTP. So if you would like to use this API I would suggest you open a PR that exposes a function in disksup to fetch this data together with documentation and testcases for all platforms.

garazdawi avatar Aug 08 '22 11:08 garazdawi

Sure thing, I'll find time to do that. This is by far the best solution for RabbitMQ to use to get free disk space on Windows.

lukebakken avatar Aug 08 '22 19:08 lukebakken

Actually what we'd really like is to be able to use the built-in disk monitor, but the check frequency lower limit is 1 minute. I'll expand on that in another issue.

lukebakken avatar Aug 08 '22 19:08 lukebakken