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

Bug: Span has already been finished; will not be reported again #129

Open
shtaft opened this issue Feb 21, 2020 · 2 comments
Open

Bug: Span has already been finished; will not be reported again #129

shtaft opened this issue Feb 21, 2020 · 2 comments

Comments

@shtaft
Copy link

shtaft commented Feb 21, 2020

Hey team! We've recently stumbled on a bit of a contrived bug in this library when using it with Webflux.

We are subscribing to a Flux. This Flux makes requests to a paged API. Each element emitted by the Flux is a response (page).

In our situation, we'd like to perform a one-time action on the first page. We achieved this using take. When calling take(1) on the Flux, a "complete" event is fired for the first element emitted by the flux, which is captured in the TracingClientResponseSubscriber onComplete handler here. Shortly afterwards, however, a cancel event is fired for the Flux (this is the behavior of take). This cancel event is picked up in the TracingClientResponseSubscriber subscription here.

The end result is that the span is "finished" twice, and a warning is logged.

Expected Behavior

Span is only finished once

Actual Behavior

Spans are finished twice when using the take API- once during a complete event, and again when a cancel event is fired. When using the Flux.take API, a cancel event can follow a complete event.

The work around currently is to not use take() or anything that will emit a complete event followed by a cancel event.

@pavolloffay
Copy link
Collaborator

hi @shtaft thanks for reporting this issue. The multiple finish type of error is sometimes hard to solve if the framework invokes calculation multiple times.

Would you like to submit a PR to fix this? IIRC in some cases we had used a wrapper for span to avoid double finish.

@micand91
Copy link

Hi,

Is there any progress or proposed solution/workaround for this issue? My analysis concludes that this does not have any functional impact on our application, besides the WARN trace that pollutes the log. I am correct in analysis?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants