gopsutil
gopsutil copied to clipboard
`disk.IOCounters()` returns `ERROR_INVALID_FUNCTION` when Google Drive is mounted as a disk in Windows.
Describe the bug
disk.IOCounters(names ...string) returns ERROR_INVALID_FUNCTION when Google Drive is mounted as a disk in Windows.
To Reproduce Call:
disk.IOCounters(nil)
when Google Drive is mounted as a disk in Windows and observe returned ERROR_INVALID_FUNCTION. In my case it has letter G.
Expected behavior
ERROR_INVALID_FUNCTION(returned fromwindows.DeviceIoControl) can be ignored insideIOCountersWithContext(in the similar way as in mentioned https://github.com/giampaolo/psutil/blob/544e9daa4f66a9f80d7bf6c7886d693ee42f0a13/psutil/arch/windows/disk.c#L83)
or
- Filter based on
namespassed toIOCountersWithContextcan be implemented (so consumer can get stats only for particular drives) - right nownamesare ignored.
Environment (please complete the following information):
- [x] gopsutil: [v3.23.3]
- [x] Windows: Microsoft Windows [Version 10.0.19045.2846]
- [ ] Linux: [paste contents of
/etc/os-releaseand the result ofuname -a] - [ ] Mac OS: [paste the result of
sw_versanduname -a - [ ] FreeBSD: [paste the result of
freebsd-version -k -r -uanduname -a] - [ ] OpenBSD: [paste the result of
uname -a]
Additional context Problem disappears after Google Drive is unmounted (Google Drive daemon is closed).
Moreover, it seems that (in my case) more properties were read than saved to drivemap

Thank you for the report. I can reproduce on my Windows 11 + Google Drive veresion 74.0.3.0.
In the first investigation, the error is occurred at windows.DeviceIoControl. On normal C: drive, there is no error. Only Google drive mounted drive has this error.
windows.DeiveIoControl calls syscall, so it seems it is hard to investigate. I will try later.