Closed jpkrohling closed 1 year ago
cc code owners: @anuraaga @Aneurysm9 @alolita
This seems to be another occurrence of that here: https://github.com/open-telemetry/opentelemetry-collector-contrib/runs/5973225036?check_suite_focus=true
So I'm looking into this and running this on a M1 Mac:
go test -v . -run=Test_PushMetrics/WAL/intGauge_case -count=10
The above command fails almost always (1-2 failures in the 10 count) with:
testing.go:1090: TempDir RemoveAll cleanup: unlinkat /var/folders/6n/rn9lc80129z68tqqzd4tyrxm0000gn/T/Test_PushMetricsWALintGauge_case518192279/001/prom_remotewrite: directory not empty
From this thread https://github.com/golang/go/issues/43547, it could be because a background goroutine is writing to the directory even after the end of the test. I tried using goleak
to check:
diff --git a/exporter/prometheusremotewriteexporter/exporter_test.go b/exporter/prometheusremotewriteexporter/exporter_test.go
index 0d14b3ed6..d21752045 100644
--- a/exporter/prometheusremotewriteexporter/exporter_test.go
+++ b/exporter/prometheusremotewriteexporter/exporter_test.go
@@ -29,6 +29,8 @@ import (
"github.com/prometheus/prometheus/prompb"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
+ "go.uber.org/goleak"
+
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config"
@@ -618,7 +620,9 @@ func Test_PushMetrics(t *testing.T) {
t.Run(name, func(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
+ opt := goleak.IgnoreCurrent()
+ defer goleak.VerifyNone(t, opt)
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if tt.reqTestFunc != nil {
tt.reqTestFunc(t, r, tt.expectedTimeSeries, tt.isStaleMarker)
And the failures ALL stopped, even with count=100 🙃
I'm a little lost as to what to do next.
(ignore the email sent through this comment, there is a t.Parallel()
which caused me to detect extra routines. Removing t.Parallel()
doesn't detect any leaks 🤦 )
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers
. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.
@kovrus, would you like to take a look at this one?
Pinging code owners: @Aneurysm9. See Adding Labels via Comments if you do not have permissions to add labels yourself.
This issue has been inactive for 60 days. It will be closed in 60 days if there is no activity. To ping code owners by adding a component label, see Adding Labels via Comments, or if you are unsure of which component this issue relates to, please ping @open-telemetry/collector-contrib-triagers
. If this issue is still relevant, please ping the code owners or leave a comment explaining why it is still relevant. Otherwise, please close it.
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself.
This issue has been closed as inactive because it has been stale for 120 days with no activity.
Seen here: https://github.com/open-telemetry/opentelemetry-collector-contrib/runs/5884764908?check_suite_focus=true