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

jaeger WithCollectorEndpoint usage #1405

Closed
glazychev-art opened this issue Dec 16, 2020 · 2 comments
Closed

jaeger WithCollectorEndpoint usage #1405

glazychev-art opened this issue Dec 16, 2020 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@glazychev-art
Copy link

Hello,
Could you please explain me, what's the right way to use the jaeger.WithCollectorEndpoint?
I've tried to run this example
https://github.com/open-telemetry/opentelemetry-go/blob/master/example/jaeger/main.go
but run it using go test and goroutine leak detector go.uber.org/goleak:

...
func TestJaeger(t *testing.T) {
	defer goleak.VerifyNone(t)
	ctx := context.Background()

	flush := initTracer()
	defer flush()

	tr := otel.Tracer("component-main")
	ctx, span := tr.Start(ctx, "foo")
	defer span.End()

	bar(ctx)
}
...

Output:

=== RUN   TestJaeger
    leaks.go:78: found unexpected goroutines:
        [Goroutine 18 in state IO wait, with internal/poll.runtime_pollWait on top of the stack:
        goroutine 18 [IO wait]:
        internal/poll.runtime_pollWait(0x7f8241792018, 0x72, 0x7e50e0)
        	/usr/local/go/src/runtime/netpoll.go:222 +0x55
        internal/poll.(*pollDesc).wait(0xc00009e518, 0x72, 0x7e5000, 0x965498, 0x0)
        	/usr/local/go/src/internal/poll/fd_poll_runtime.go:87 +0x45
        internal/poll.(*pollDesc).waitRead(...)
        	/usr/local/go/src/internal/poll/fd_poll_runtime.go:92
        internal/poll.(*FD).Read(0xc00009e500, 0xc000110000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        	/usr/local/go/src/internal/poll/fd_unix.go:159 +0x1a5
        net.(*netFD).Read(0xc00009e500, 0xc000110000, 0x1000, 0x1000, 0xc000066780, 0xc00004ad98, 0xc00004ac20)
        	/usr/local/go/src/net/fd_posix.go:55 +0x4f
        net.(*conn).Read(0xc00010e000, 0xc000110000, 0x1000, 0x1000, 0x0, 0x0, 0x0)
        	/usr/local/go/src/net/net.go:182 +0x8e
        net/http.(*persistConn).Read(0xc0000c4c60, 0xc000110000, 0x1000, 0x1000, 0xc00004aeb0, 0x469420, 0xc00004aeb0)
        	/usr/local/go/src/net/http/transport.go:1887 +0x77
        bufio.(*Reader).fill(0xc00010a060)
        	/usr/local/go/src/bufio/bufio.go:101 +0x105
        bufio.(*Reader).Peek(0xc00010a060, 0x1, 0x2, 0x0, 0x0, 0x0, 0xc00011a000)
        	/usr/local/go/src/bufio/bufio.go:139 +0x4f
        net/http.(*persistConn).readLoop(0xc0000c4c60)
        	/usr/local/go/src/net/http/transport.go:2040 +0x1a8
        created by net/http.(*Transport).dialConn
        	/usr/local/go/src/net/http/transport.go:1708 +0xcb7
        
         Goroutine 19 in state select, with net/http.(*persistConn).writeLoop on top of the stack:
        goroutine 19 [select]:
        net/http.(*persistConn).writeLoop(0xc0000c4c60)
        	/usr/local/go/src/net/http/transport.go:2340 +0x11c
        created by net/http.(*Transport).dialConn
        	/usr/local/go/src/net/http/transport.go:1709 +0xcdc
        ]
--- FAIL: TestJaeger (0.44s)
FAIL

As we can see, there is goroutine leak

@MrAlias MrAlias added the question Further information is requested label Jan 7, 2021
@Aneurysm9
Copy link
Member

I wonder whether this may be due to the fact that, similar to #1423, the SimpleSpanProcessor does not call Shutdown() on the underlying Exporter. This looks like the http.Client used by the collectorUploader maintaining keepalive on its connection and watching for it to close, so something may also need to be done in the Exporter to ensure that those connections are closed during Shutdown().

@MrAlias MrAlias added bug Something isn't working pkg:exporter and removed question Further information is requested labels Apr 6, 2021
@MrAlias
Copy link
Contributor

MrAlias commented Apr 6, 2021

I'm not able to reproduce:

$ pwd
.../go/src/go.opentelemetry.io/otel/example/jaeger

$  git rev-parse --short HEAD
e9aaa04b

$ tail -n2 ../../version.go | head -n1
	return "0.19.0"

$ go version
go version go1.16.2 linux/amd64

$ cat leak_test.go 
package main

import (
	"context"
	"testing"

	"go.opentelemetry.io/otel"
	"go.uber.org/goleak"
)

func TestJaeger(t *testing.T) {
	defer goleak.VerifyNone(t)
	ctx := context.Background()

	flush := initTracer()
	defer flush()

	tr := otel.Tracer("component-main")
	ctx, span := tr.Start(ctx, "foo")
	defer span.End()

	bar(ctx)
}

$go test -count=1 ./...  
ok  	go.opentelemetry.io/otel/example/jaeger	0.005s

@glazychev-art if this is still a issue you are having please reopen.

@MrAlias MrAlias closed this as completed Apr 6, 2021
@pellared pellared moved this to Closed in Go: Triage Nov 2, 2023
@pellared pellared added this to the untracked milestone Nov 8, 2024
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
Development

No branches or pull requests

4 participants