From 60a74088fa041adc374e2f7227bfbabaeffeb56d Mon Sep 17 00:00:00 2001 From: Daniel J Walsh Date: Fri, 21 Dec 2018 08:00:49 -0500 Subject: Vendor in latest psgo code to fix race conditions When running podman top, the processes collected can exit befor psgo gets information on the processes. This can cause some weird errors and creates some CI flakes. psgo now properly ignores this situation rather then returning errors Signed-off-by: Daniel J Walsh --- vendor.conf | 4 ++-- .../psgo/internal/capabilities/capabilities.go | 14 ++++++++++++++ .../github.com/containers/psgo/internal/dev/tty.go | 14 ++++++++++++++ .../github.com/containers/psgo/internal/host/host.go | 14 ++++++++++++++ .../github.com/containers/psgo/internal/proc/attr.go | 14 ++++++++++++++ .../containers/psgo/internal/proc/cmdline.go | 14 ++++++++++++++ .../github.com/containers/psgo/internal/proc/ns.go | 14 ++++++++++++++ .../github.com/containers/psgo/internal/proc/pids.go | 14 ++++++++++++++ .../github.com/containers/psgo/internal/proc/stat.go | 14 ++++++++++++++ .../containers/psgo/internal/proc/status.go | 14 ++++++++++++++ .../containers/psgo/internal/process/process.go | 16 +++++++++++++++- .../containers/psgo/internal/types/types.go | 14 ++++++++++++++ vendor/github.com/containers/psgo/psgo.go | 20 +++++++++++++++++++- 13 files changed, 176 insertions(+), 4 deletions(-) diff --git a/vendor.conf b/vendor.conf index b272b537a..1ef9ada84 100644 --- a/vendor.conf +++ b/vendor.conf @@ -13,7 +13,7 @@ github.com/containernetworking/cni v0.7.0-alpha1 github.com/containernetworking/plugins 1562a1e60ed101aacc5e08ed9dbeba8e9f3d4ec1 github.com/containers/image d53afe179b381fafb427e6b9cf9b1996a98c1067 github.com/containers/storage db40f96d853dfced60c563e61fb66ba231ce7c8d -github.com/containers/psgo 5dde6da0bc8831b35243a847625bcf18183bd1ee +github.com/containers/psgo dc0bc9fac5b715034c4310ed4d795b3182360842 github.com/coreos/go-systemd v14 github.com/cri-o/ocicni 2d2983e40c242322a56c22a903785e7f83eb378c github.com/cyphar/filepath-securejoin v0.2.1 @@ -100,4 +100,4 @@ github.com/ulikunitz/xz v0.5.4 github.com/mailru/easyjson 03f2033d19d5860aef995fe360ac7d395cd8ce65 github.com/coreos/go-iptables 25d087f3cffd9aedc0c2b7eff25f23cbf3c20fe1 github.com/google/shlex c34317bd91bf98fab745d77b03933cf8769299fe -github.com/pkg/profile v1.2.1 \ No newline at end of file +github.com/pkg/profile v1.2.1 diff --git a/vendor/github.com/containers/psgo/internal/capabilities/capabilities.go b/vendor/github.com/containers/psgo/internal/capabilities/capabilities.go index 8aba94f39..c46468930 100644 --- a/vendor/github.com/containers/psgo/internal/capabilities/capabilities.go +++ b/vendor/github.com/containers/psgo/internal/capabilities/capabilities.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Package capabilities provides a mapping from common kernel bit masks to the // alphanumerical represenation of kernel capabilities. See capabilities(7) // for additional information. diff --git a/vendor/github.com/containers/psgo/internal/dev/tty.go b/vendor/github.com/containers/psgo/internal/dev/tty.go index 37be9972d..cc7d0a422 100644 --- a/vendor/github.com/containers/psgo/internal/dev/tty.go +++ b/vendor/github.com/containers/psgo/internal/dev/tty.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package dev import ( diff --git a/vendor/github.com/containers/psgo/internal/host/host.go b/vendor/github.com/containers/psgo/internal/host/host.go index 7c2a48cb2..4b145ecfb 100644 --- a/vendor/github.com/containers/psgo/internal/host/host.go +++ b/vendor/github.com/containers/psgo/internal/host/host.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Package host extracts data from the host, such as the system's boot time or // the tick rate of the system clock. package host diff --git a/vendor/github.com/containers/psgo/internal/proc/attr.go b/vendor/github.com/containers/psgo/internal/proc/attr.go index 0385ef9e6..9ef694bdc 100644 --- a/vendor/github.com/containers/psgo/internal/proc/attr.go +++ b/vendor/github.com/containers/psgo/internal/proc/attr.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package proc import ( diff --git a/vendor/github.com/containers/psgo/internal/proc/cmdline.go b/vendor/github.com/containers/psgo/internal/proc/cmdline.go index 1899dd2dc..669149543 100644 --- a/vendor/github.com/containers/psgo/internal/proc/cmdline.go +++ b/vendor/github.com/containers/psgo/internal/proc/cmdline.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package proc import ( diff --git a/vendor/github.com/containers/psgo/internal/proc/ns.go b/vendor/github.com/containers/psgo/internal/proc/ns.go index fbfbd4894..5d5ef2814 100644 --- a/vendor/github.com/containers/psgo/internal/proc/ns.go +++ b/vendor/github.com/containers/psgo/internal/proc/ns.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package proc import ( diff --git a/vendor/github.com/containers/psgo/internal/proc/pids.go b/vendor/github.com/containers/psgo/internal/proc/pids.go index ff1565cf1..ff4887364 100644 --- a/vendor/github.com/containers/psgo/internal/proc/pids.go +++ b/vendor/github.com/containers/psgo/internal/proc/pids.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package proc import ( diff --git a/vendor/github.com/containers/psgo/internal/proc/stat.go b/vendor/github.com/containers/psgo/internal/proc/stat.go index b238b4fcf..866a5cdda 100644 --- a/vendor/github.com/containers/psgo/internal/proc/stat.go +++ b/vendor/github.com/containers/psgo/internal/proc/stat.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package proc import ( diff --git a/vendor/github.com/containers/psgo/internal/proc/status.go b/vendor/github.com/containers/psgo/internal/proc/status.go index 364d9e9a2..68e2acff6 100644 --- a/vendor/github.com/containers/psgo/internal/proc/status.go +++ b/vendor/github.com/containers/psgo/internal/proc/status.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package proc import ( diff --git a/vendor/github.com/containers/psgo/internal/process/process.go b/vendor/github.com/containers/psgo/internal/process/process.go index 6a8dfb0c0..0afbf721d 100644 --- a/vendor/github.com/containers/psgo/internal/process/process.go +++ b/vendor/github.com/containers/psgo/internal/process/process.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package process import ( @@ -94,7 +108,7 @@ func FromPIDs(ctx *types.PsContext, pids []string) ([]*Process, error) { for _, pid := range pids { p, err := New(ctx, pid) if err != nil { - if os.IsNotExist(err) { + if os.IsNotExist(errors.Cause(err)) { // proc parsing is racy // Let's ignore "does not exist" errors continue diff --git a/vendor/github.com/containers/psgo/internal/types/types.go b/vendor/github.com/containers/psgo/internal/types/types.go index 9069e8000..1f6fe0eaa 100644 --- a/vendor/github.com/containers/psgo/internal/types/types.go +++ b/vendor/github.com/containers/psgo/internal/types/types.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + package types // PsContext controls some internals of the psgo library. diff --git a/vendor/github.com/containers/psgo/psgo.go b/vendor/github.com/containers/psgo/psgo.go index 3f3723600..47a50264f 100644 --- a/vendor/github.com/containers/psgo/psgo.go +++ b/vendor/github.com/containers/psgo/psgo.go @@ -1,3 +1,17 @@ +// Copyright 2018 psgo authors +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + // Package psgo is a ps (1) AIX-format compatible golang library extended with // various descriptors useful for displaying container-related data. // @@ -349,7 +363,7 @@ func JoinNamespaceAndProcessInfoByPids(pids []string, descriptors []string) ([][ for _, pid := range pids { ns, err := proc.ParsePIDNamespace(pid) if err != nil { - if os.IsNotExist(err) { + if os.IsNotExist(errors.Cause(err)) { // catch race conditions continue } @@ -364,6 +378,10 @@ func JoinNamespaceAndProcessInfoByPids(pids []string, descriptors []string) ([][ data := [][]string{} for i, pid := range pidList { pidData, err := JoinNamespaceAndProcessInfo(pid, descriptors) + if os.IsNotExist(errors.Cause(err)) { + // catch race conditions + continue + } if err != nil { return nil, err } -- cgit v1.2.3-54-g00ecf