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

Getting a panic in the inmemory dispatcher #1986

Closed
lionelvillard opened this issue Oct 1, 2019 · 13 comments · Fixed by #1988
Closed

Getting a panic in the inmemory dispatcher #1986

lionelvillard opened this issue Oct 1, 2019 · 13 comments · Fixed by #1988
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Milestone

Comments

@lionelvillard
Copy link
Member

lionelvillard commented Oct 1, 2019

Describe the bug

A cronjob sending an event to a ksvc causes this panic:

imc-dispatcher-665cddfb4f-wkmpx dispatcher panic: runtime error: invalid memory address or nil pointer dereference
imc-dispatcher-665cddfb4f-wkmpx dispatcher [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x13cc6b3]
imc-dispatcher-665cddfb4f-wkmpx dispatcher
imc-dispatcher-665cddfb4f-wkmpx dispatcher goroutine 58 [running]:
imc-dispatcher-665cddfb4f-wkmpx dispatcher knative.dev/eventing/vendor/go.opencensus.io/trace.(*Span).SetSpanID(...)
imc-dispatcher-665cddfb4f-wkmpx dispatcher 	/home/prow/go/src/knative.dev/eventing/vendor/go.opencensus.io/trace/trace.go:265
imc-dispatcher-665cddfb4f-wkmpx dispatcher knative.dev/eventing/pkg/tracing.AddSpanFromTraceparentAttribute(0x1b77180, 0xc0006e4270, 0x0, 0x0, 0x1bb89c0, 0xc000438a80, 0x1580ae0, 0xc0006ea260, 0x1, 0x4, ...)
imc-dispatcher-665cddfb4f-wkmpx dispatcher 	/home/prow/go/src/knative.dev/eventing/pkg/tracing/traceparent.go:83 +0x1f3
imc-dispatcher-665cddfb4f-wkmpx dispatcher knative.dev/eventing/pkg/channel.(*EventDispatcher).generateSendingContext(0xc0003a9860, 0xc000047ef5, 0x1, 0xc0001c87d0, 0x4a, 0xc000047ef0, 0x4, 0xc0006ee690, 0x0, 0xc000031600, ...)
imc-dispatcher-665cddfb4f-wkmpx dispatcher 	/home/prow/go/src/knative.dev/eventing/pkg/channel/event_dispatcher.go:120 +0xc9
imc-dispatcher-665cddfb4f-wkmpx dispatcher knative.dev/eventing/pkg/channel.(*EventDispatcher).executeRequest(0xc0003a9860, 0x1b77180, 0xc0006ee6c0, 0xc0001dd680, 0x1bb89c0, 0xc000438a80, 0x1580ae0, 0xc0006ea260, 0x1, 0x40c458, ...)
imc-dispatcher-665cddfb4f-wkmpx dispatcher 	/home/prow/go/src/knative.dev/eventing/pkg/channel/event_dispatcher.go:105 +0x3a7
imc-dispatcher-665cddfb4f-wkmpx dispatcher knative.dev/eventing/pkg/channel.(*EventDispatcher).DispatchEvent(0xc0003a9860, 0x1b77180, 0xc0006ee6c0, 0x1bb89c0, 0xc000438a80, 0x1580ae0, 0xc0006ea260, 0x1, 0xc0001b3980, 0x3e, ...)

Expected behavior
no panic

To Reproduce
Create a cronjob sending event to channel?

Knative release version
nightly

@lionelvillard lionelvillard added the kind/bug Categorizes issue or PR as related to a bug. label Oct 1, 2019
@grantr
Copy link
Contributor

grantr commented Oct 1, 2019

@Harwayne this looks like a tracing issue

@lionelvillard
Copy link
Member Author

was working before this PR: #1972

@lionelvillard
Copy link
Member Author

This is running in a cluster without tracing enabled.

@lionelvillard
Copy link
Member Author

It seems more complicated than a cronjob to event-display. The failing config is this one: https://github.com/lionelvillard/knative-examples/tree/master/examples/sequence/config

@Harwayne
Copy link
Contributor

Harwayne commented Oct 1, 2019

/assign

@lionelvillard
Copy link
Member Author

@Harwayne
Copy link
Contributor

Harwayne commented Oct 1, 2019

The failing line is:

s.data.SpanID = spanID

So either s or s.data is nil.

It is being called from here

_, span := trace.StartSpanWithRemoteParent(ctx, name, sc)
span.SetSpanID(sc.SpanID)
.

So either span or span.data is nil.

span is set to StartSpanWithRemoteParent.

func StartSpanWithRemoteParent(ctx context.Context, name string, parent SpanContext, o ...StartOption) (context.Context, *Span) {
var opts StartOptions
for _, op := range o {
op(&opts)
}
span := startSpanInternal(name, parent != SpanContext{}, parent, true, opts)
ctx, end := startExecutionTracerTask(ctx, name)
span.executionTracerTaskEnd = end
return NewContext(ctx, span), span
}

There is only one return from that method, line 201. On line 200, span.executionTraceTaskEnd is set, so that shows that span is not nil, span.data is.

startSpanInternal is used to create the span. span.data is set on

span.data = &SpanData{
. But there is a return before that on line 234. So I think we must be returning on 234, thus span.data is nil.

I'll have a PR to fix this soon.

@Harwayne
Copy link
Contributor

Harwayne commented Oct 1, 2019

here a simpler config: https://github.com/lionelvillard/knative-examples/tree/master/issues/eventing-1986

Note that for this to reproduce, tracing has to be set to disabled. Or at least a request has to go through that isn't sampled.

@lionelvillard
Copy link
Member Author

Can we reopen? Still not working. I'm testing against nightly, so it could an issue with the nightly image.

@Harwayne
Copy link
Contributor

Harwayne commented Oct 2, 2019

Can we reopen? Still not working. I'm testing against nightly, so it could an issue with the nightly image.

/reopen

Some additional details that will help.

  • Is it the same stack trace?
  • What image is the imc-dispatcher running as?
  • What does your config-tracing ConfigMap in knative-eventing look like?

@knative-prow-robot
Copy link
Contributor

@Harwayne: Reopened this issue.

In response to this:

Can we reopen? Still not working. I'm testing against nightly, so it could an issue with the nightly image.

/reopen

Can you give some more details? Is it the same stack trace? What image is the imc-dispatcher running as? What is your config-tracing configmap in knative-eventing look like?

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@akashrv
Copy link
Contributor

akashrv commented Oct 2, 2019

/milestone v0.10.0
/priority important-soon

@knative-prow-robot knative-prow-robot added the priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release. label Oct 2, 2019
@knative-prow-robot knative-prow-robot added this to the v0.10.0 milestone Oct 2, 2019
@lionelvillard
Copy link
Member Author

This is fixed in the master branch. The nightly build failed last night so I was still using the wrong image.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Categorizes issue or PR as related to a bug. priority/important-soon Must be staffed and worked on either currently, or very soon, ideally in time for the next release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants