From 9738a2b2145067d19cb5e3c776ec9d233428b204 Mon Sep 17 00:00:00 2001 From: katarzyna-z Date: Tue, 30 Aug 2016 08:29:31 +0200 Subject: [PATCH] To reproduce hanging with longline --- cpu/cpu.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/cpu/cpu.go b/cpu/cpu.go index 8503426..0827046 100644 --- a/cpu/cpu.go +++ b/cpu/cpu.go @@ -30,6 +30,7 @@ import ( "strconv" "strings" "time" + "math/rand" "github.com/intelsdi-x/snap/control/plugin" "github.com/intelsdi-x/snap/control/plugin/cpolicy" @@ -362,7 +363,15 @@ func getStats(path string, stats map[string]map[string]interface{}, prevMetricsS return err } - fmt.Fprintf(os.Stderr, "Percentage value of %v could not be calculated due to invalid data reported by /proc/stat", getNamespaceMetricPart(metricName, percentageRepresentationType)) + //fmt.Fprintf(os.Stderr, "Percentage value of %v could not be calculated due to invalid data reported by /proc/stat", getNamespaceMetricPart(metricName, percentageRepresentationType)) + + letterBytes := "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + longLine := []byte{} + for i := 0; i < 8193; i++ { + longLine = append(longLine, letterBytes[rand.Intn(len(letterBytes))]) + } + + fmt.Fprintf(os.Stderr, "%v" , longLine) if percVal := float64(100 * (currVal - prevVal) / diffSum); percVal < 0 { fmt.Fprintf(os.Stderr, "Percentage value of %v could not be calculated due to invalid data reported by /proc/stat", getNamespaceMetricPart(metricName, percentageRepresentationType))