Depending on when a request is cancelled, the before and after observation
starts and stops may be called out of order due to the order in
which their doOnCancel handlers are invoked.
To address this, the before filter-wrapper now always closes both the
before observation and the after observation. Since the before filter-
wrapper wraps the entire request, this ensures that either that was
started is stopped, and either that has not been started yet cannot
inadvertently be started by any unexpected ordering of events that
follows.
Closes gh-14031
@ -292,7 +292,13 @@ public final class ObservationWebFilterChainDecorator implements WebFilterChainP
@@ -292,7 +292,13 @@ public final class ObservationWebFilterChainDecorator implements WebFilterChainP
@Override
publicvoidstop(){
this.currentObservation.get().stop();
this.before.stop();
this.after.stop();
}
privatevoidclose(){
this.before.close();
this.after.close();
}
@Override
@ -357,11 +363,11 @@ public final class ObservationWebFilterChainDecorator implements WebFilterChainP
@@ -357,11 +363,11 @@ public final class ObservationWebFilterChainDecorator implements WebFilterChainP
@ -433,6 +439,21 @@ public final class ObservationWebFilterChainDecorator implements WebFilterChainP
@@ -433,6 +439,21 @@ public final class ObservationWebFilterChainDecorator implements WebFilterChainP