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

Flaky test: TestSimpleSpanProcessorShutdownHonorsContextCancel #2289

Closed
MrAlias opened this issue Oct 15, 2021 · 4 comments · Fixed by #2290
Closed

Flaky test: TestSimpleSpanProcessorShutdownHonorsContextCancel #2289

MrAlias opened this issue Oct 15, 2021 · 4 comments · Fixed by #2290
Assignees
Labels
bug Something isn't working
Projects

Comments

@MrAlias
Copy link
Contributor

MrAlias commented Oct 15, 2021

Description

https://github.com/open-telemetry/opentelemetry-go/runs/3908587687?check_suite_focus=true

--- FAIL: TestSimpleSpanProcessorShutdownHonorsContextCancel (0.00s)
    simple_span_processor_test.go:165: SimpleSpanProcessor.Shutdown did not return context canceled, got <nil>
FAIL
FAIL	go.opentelemetry.io/otel/sdk/trace	0.424s
FAIL

func TestSimpleSpanProcessorShutdownHonorsContextCancel(t *testing.T) {
ctx, cancel := context.WithCancel(context.Background())
cancel()
ssp := sdktrace.NewSimpleSpanProcessor(&testExporter{})
if got, want := ssp.Shutdown(ctx), context.Canceled; !errors.Is(got, want) {
t.Errorf("SimpleSpanProcessor.Shutdown did not return %v, got %v", want, got)
}
}

Environment

  • OS: Microsoft Windows Server 2019 10.0.17763
  • Architecture: 386
  • Go Version: 1.17
  • opentelemetry-go version: 790cf48

Test Failure Logs

log.txt

@MrAlias MrAlias added the bug Something isn't working label Oct 15, 2021
@MrAlias MrAlias added this to Needs triage in Bugs via automation Oct 15, 2021
@MrAlias
Copy link
Contributor Author

MrAlias commented Oct 15, 2021

I'm able to reproduce this locally (Linux 5.14.8-arch1-1, Go 1.17):

docker run --rm -v "$PWD":/usr/src/go.opentelemetry.io/otel -w /usr/src/go.opentelemetry.io/otel/sdk/trace --env "GOARCH=386" golang:1.17 go test -run=TestSimpleSpanProcessorShutdownHonorsContextCancel -count 100000 -failfast ./...
go: downloading github.com/stretchr/testify v1.7.0
go: downloading github.com/google/go-cmp v0.5.6
go: downloading golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7
go: downloading github.com/pmezard/go-difflib v1.0.0
go: downloading github.com/davecgh/go-spew v1.1.0
go: downloading gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
--- FAIL: TestSimpleSpanProcessorShutdownHonorsContextCancel (0.00s)
    simple_span_processor_test.go:165: SimpleSpanProcessor.Shutdown did not return context canceled, got <nil>
FAIL
FAIL	go.opentelemetry.io/otel/sdk/trace	0.057s
ok  	go.opentelemetry.io/otel/sdk/trace/tracetest	0.522s [no tests to run]
FAIL

@MrAlias
Copy link
Contributor Author

MrAlias commented Oct 15, 2021

I'm able to reproduce without the GOARCH=386 (i.e. x86).

@MrAlias
Copy link
Contributor Author

MrAlias commented Oct 15, 2021

I'm able to reproduce on Go 1.15 and 1.16 as well.

@MrAlias
Copy link
Contributor Author

MrAlias commented Oct 15, 2021

This select statement looks to be the cause of the error:

select {
case err = <-done:
case <-ctx.Done():
err = ctx.Err()
}

Both cases are ready to be read and since the select order is random this will sporadically read that the exporter shutdown with no error instead of the already canceled context.

@MrAlias MrAlias moved this from Needs triage to Low priority in Bugs Oct 15, 2021
@MrAlias MrAlias self-assigned this Oct 15, 2021
Bugs automation moved this from Low priority to Closed Oct 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Bugs
  
Closed
Development

Successfully merging a pull request may close this issue.

1 participant