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

Panic runtime error nil pointer on Windows for disk report #1415

Closed
n0dev opened this issue Feb 8, 2023 · 3 comments
Closed

Panic runtime error nil pointer on Windows for disk report #1415

n0dev opened this issue Feb 8, 2023 · 3 comments

Comments

@n0dev
Copy link

n0dev commented Feb 8, 2023

Describe the bug

This error came from a tool I wrote and was executed in a client environment that I don't have access to.

image

To Reproduce

Apologize, this error came from a tool I wrote and was executed in a client environment that I don't have access to. Not sure I have the steps to reproduce as I have a feeling this is specific to what the client has configured on its Windows machine.

However it sounds like we're going through despites the error (must be something else I guess...) and i is still nil in disk/disk_windows.go:107.

	for _, v := range lpBuffer {
		if v >= 65 && v <= 90 {
			i, err := getVolumeInformation(string(v), &warnings)
			if err != nil && !errors.Is(err, errDeviceNotReady) && !errors.Is(err, errInvalidDriveType) {
				continue
			}

			opts := []string{"rw"}
			if i.FileSystemFlags&fileReadOnlyVolume != 0 {
				opts = []string{"ro"}
			}
...

Expected behavior

Error to be re-thrown to parent.

Environment (please complete the following information):

  • Windows: Server. Not sure about the version but doubt it matters.
@shirou
Copy link
Owner

shirou commented Feb 18, 2023

perhaps this is same as #1396. please use latest version.

@davidnewhall
Copy link
Contributor

Latest version seems to do a new thing.

panic: send on closed channel

goroutine 138166 [running]:
github.com/shirou/gopsutil/v3/disk.PartitionsWithContext.func1()
	github.com/shirou/gopsutil/v3@v3.23.2/disk/disk_windows.go:159 +0x7e7
created by github.com/shirou/gopsutil/v3/disk.PartitionsWithContext
	github.com/shirou/gopsutil/v3@v3.23.2/disk/disk_windows.go:162 +0x1ea

@shirou
Copy link
Owner

shirou commented Apr 13, 2023

Fixed by #1430. Thank you so much!

@shirou shirou closed this as completed Apr 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants