-
Notifications
You must be signed in to change notification settings - Fork 181
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve
CancellationException
(#3039)
Motivation: 1. `H2ClientParentConnectionContext.StacklessCancellationException` was reused by `SpliceFlatStreamToMetaSingle`, which created a false impression in logs that this exception is related to HTTP/2. 2. We should capture the Subscriber's stack-trace for `CancellationException` in `BeforeFinallyHttpOperator` instead of a netty stack-trace, it will help to debug paths that subscribe to the payload post cancel. Modifications: 1. Make `H2ClientParentConnectionContext.StacklessCancellationException` a top-level class. 2. Wrap `CancellationException` with `Publisher.defer(...)` in `BeforeFinallyHttpOperator`. 3. Add an exception message in `DefaultBlockingIterableProcessor`. Result: Easier for users to reason about received `CancellationException`.
- Loading branch information
1 parent
0537138
commit 2f2bf85
Showing
5 changed files
with
41 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
...lk-http-netty/src/main/java/io/servicetalk/http/netty/StacklessCancellationException.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright © 2024 Apple Inc. and the ServiceTalk project authors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.servicetalk.http.netty; | ||
|
||
import io.servicetalk.concurrent.internal.ThrowableUtils; | ||
|
||
import java.util.concurrent.CancellationException; | ||
|
||
final class StacklessCancellationException extends CancellationException { | ||
private static final long serialVersionUID = 5434529104526587317L; | ||
|
||
private StacklessCancellationException(String message) { | ||
super(message); | ||
} | ||
|
||
@Override | ||
public Throwable fillInStackTrace() { | ||
return this; | ||
} | ||
|
||
static StacklessCancellationException newInstance(String message, Class<?> clazz, String method) { | ||
return ThrowableUtils.unknownStackTrace(new StacklessCancellationException(message), clazz, method); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters