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

update gopsutil #6957

Closed
tgross opened this issue Jan 17, 2020 · 7 comments
Closed

update gopsutil #6957

tgross opened this issue Jan 17, 2020 · 7 comments

Comments

@tgross
Copy link
Member

tgross commented Jan 17, 2020

The panic described in #6954 was caused by a missing length check in gopsutil which we've contributed upstream as shirou/gopsutil#822. Once that's been merged and released, we should update gopsutil

@tgross tgross added theme/fingerprint theme/dependencies Pull requests that update a dependency file labels Jan 17, 2020
@tgross tgross added this to the unscheduled milestone Jan 17, 2020
@tgross tgross self-assigned this Jan 17, 2020
@tgross tgross added theme/vendor-update and removed theme/dependencies Pull requests that update a dependency file labels Jan 17, 2020
@tgross
Copy link
Member Author

tgross commented Feb 13, 2020

@shishir-a412ed wrote in #6720 (comment):

On a different note, I was also looking to fix #6957 . I see you merged a fix in gopsutil however it has still not been vendor'ed into nomad. It looks like nomad doesn't use go modules or dep (I didn't see a go.mod or Gopkg.toml file). Which vendoring do you guys use?

We were waiting for a release from gopsutil, but it looks like https://github.com/shirou/gopsutil/releases/tag/v2.20.1 was just released a couple weeks ago. We generally make vendor updates only within major version releases (ex. 0.10.0 or 0.11.0) unless they are security impacting or widespread panics. So the plan would be to make this bump during the 0.11.0 window, which is now open because we releases 0.10.4-rc1 yesterday.

You're right that we don't currently use go modules, but we plan on getting there. We've run into some complications with nested modules and our api package which we want to be consumed by other applications, so it's been slow going.

In the meanwhile, we use govendor for managing dependencies.

@shishir-a412ed
Copy link
Contributor

@tgross I tried to vendor gopsutil into nomad using go vendoring.

$$ govendor fetch github.com/shirou/gopsutil@v2.20.1

It is updating a bunch of files, however it doesn't update the file which has the fix (/host/host_linux.go). Any idea what's going wrong?

smahajan@smahajan-VirtualBox:~/go/src/github.com/hashicorp/nomad$ git status
On branch vendor_update
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git checkout -- <file>..." to discard changes in working directory)

	modified:   vendor/vendor.json

Untracked files:
  (use "git add <file>..." to include in what will be committed)

	vendor/github.com/shirou/gopsutil/Gopkg.lock
	vendor/github.com/shirou/gopsutil/Gopkg.toml
	vendor/github.com/shirou/gopsutil/Makefile
	vendor/github.com/shirou/gopsutil/README.rst
	vendor/github.com/shirou/gopsutil/coverall.sh
	vendor/github.com/shirou/gopsutil/doc.go
	vendor/github.com/shirou/gopsutil/mktypes.sh
	vendor/github.com/shirou/gopsutil/v2migration.sh
	vendor/github.com/shirou/gopsutil/windows_memo.rst

@tgross
Copy link
Member Author

tgross commented Feb 18, 2020

Just checked and https://github.com/shirou/gopsutil/blob/v2.20.1/host/host_linux.go does have the fix, that's strange. The govendor docs say:

# Specify a specific version or revision to fetch
govendor fetch golang.org/x/net/context@a4bbce9fcae005b22ae5443f6af064d80a6f5a55
govendor fetch golang.org/x/net/context@v1   # Get latest v1.*.* tag or branch.
govendor fetch golang.org/x/net/context@=v1  # Get the tag or branch named "v1".

So I'm wondering if you want to use the syntax for the specific tag, rather than the "latest" (maybe there's something weird about the way it detects latest that isn't playing nice with the library's go mod setup.)

Something worth checking is to run make vendorfmt and then check the git diff of the vendor/vendor.json file. It might have a clue as to what govendor is doing there.

@shishir-a412ed
Copy link
Contributor

shishir-a412ed commented Feb 21, 2020

@tgross
Looking at the existing vendor/vendor.json. It seems I need to vendor github.com/shirou/gopsutil/host and NOT github.com/shirou/gopsutil

I am getting the following error when I try:

  1. govendor fetch github.com/shirou/gopsutil/host@=v2.20.1
  2. govendor fetch github.com/shirou/gopsutil/host@v2.20.1
Error: No label found for specified version "=v2.20.1" from github.com/shirou/gopsutil/host::github.com/hashicorp/gopsutil/host@=v2.20.1
Failed to fetch package "github.com/shirou/gopsutil/host"
github.com/kardianos/govendor/context.(*Context).Alter
	/home/smahajan/go/src/github.com/kardianos/govendor/context/modify.go:712
github.com/kardianos/govendor/run.(*runner).Modify
	/home/smahajan/go/src/github.com/kardianos/govendor/run/modify.go:152
github.com/kardianos/govendor/run.(*runner).run
	/home/smahajan/go/src/github.com/kardianos/govendor/run/run.go:98
github.com/kardianos/govendor/run.Run
	/home/smahajan/go/src/github.com/kardianos/govendor/run/run.go:44
main.main
	/home/smahajan/go/src/github.com/kardianos/govendor/main.go:35
runtime.main
	/usr/local/go/src/runtime/proc.go:203
runtime.goexit
	/usr/local/go/src/runtime/asm_amd64.s:1357

Any idea what's going wrong?
Also I observed that gopsutil uses dep and HashiCorp is using govendoring. Not sure if these two being different dependency management systems is causing a problem.

Can you give it a try? Just to make sure it's not a problem with my environment.

@tgross tgross removed their assignment Mar 5, 2020
@greut
Copy link
Contributor

greut commented Mar 14, 2020

Here is my (probably incomplete) understandings. The version of docker links to an old x/sys/windows

The recent gopsutils 2.19.12+, shirou/gopsutil@a61c905, needs a fresher version of x/sys/windows.

Going anywhere above 2.19.6 requires to bump docker, in order to be able to bump x/sys/windows and use gopsutils 2.20.2+

Been there, done that, #5807 -- didn't go through

@greut
Copy link
Contributor

greut commented Mar 17, 2020

Closed by #7350

@tgross tgross closed this as completed Mar 30, 2020
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 120 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants