Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

disk.IOCounters() returns ERROR_INVALID_FUNCTION when Google Drive is mounted as a disk in Windows. #1461

Open
2 of 6 tasks
zak-pawel opened this issue May 5, 2023 · 2 comments

Comments

@zak-pawel
Copy link

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

  1. ERROR_INVALID_FUNCTION (returned from windows.DeviceIoControl) can be ignored inside IOCountersWithContext (in the similar way as in mentioned https://github.com/giampaolo/psutil/blob/544e9daa4f66a9f80d7bf6c7886d693ee42f0a13/psutil/arch/windows/disk.c#L83)

or

  1. Filter based on names passed to IOCountersWithContext can be implemented (so consumer can get stats only for particular drives) - right now names are ignored.

Environment (please complete the following information):

  • gopsutil: [v3.23.3]
  • Windows: Microsoft Windows [Version 10.0.19045.2846]
  • Linux: [paste contents of /etc/os-release and the result of uname -a]
  • Mac OS: [paste the result of sw_vers and uname -a
  • FreeBSD: [paste the result of freebsd-version -k -r -u and uname -a]
  • OpenBSD: [paste the result of uname -a]

Additional context
Problem disappears after Google Drive is unmounted (Google Drive daemon is closed).

@zak-pawel
Copy link
Author

Moreover, it seems that (in my case) more properties were read than saved to drivemap
image

@shirou
Copy link
Owner

shirou commented May 13, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants