From 9e1f75c6a4c8765e6a63bb078fd513a1afa3070a Mon Sep 17 00:00:00 2001 From: blanet Date: Fri, 23 Apr 2021 17:02:08 +0800 Subject: command: Add test to detect goroutine leaks Add TestNewNonExistent to help detecting goroutine leaks when spawning a non-existent command with nil stderr. When we `New` a command with nil stderr, a default stderr would be created to help logging possible cmd errors, and in the meanwhile we use io.Pipe to implement log size and line size limiting. However, if we encounter an error from the latter `cmd.Start()`, the PipeWriter will be left unclosed and related goroutine leaks. Signed-off-by: blanet --- NOTICE | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'NOTICE') diff --git a/NOTICE b/NOTICE index 261bb9fbd..7a826cf45 100644 --- a/NOTICE +++ b/NOTICE @@ -12225,6 +12225,30 @@ LICENSE - go.opencensus.io 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. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +LICENSE - go.uber.org/goleak +The MIT License (MIT) + +Copyright (c) 2018 Uber Technologies, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ LICENSE - golang.org/x/crypto Copyright (c) 2009 The Go Authors. All rights reserved. -- cgit v1.2.3