[BUG] webflux中SlotChainBuilder实例化异常后客户端被无限阻塞
まだ誰も着手していません。
評価
調査の方向性
SentinelReactorSubscriber.entryWhenSubscribed() から始め、issue に示されているカスタム SlotChainBuilder を使って sentinel-webflux-example で失敗を再現します。RuntimeException が Spring WebFlux と DefaultErrorWebExceptionHandler を通じてどのように伝播するかを確認します。クライアントリクエストがブロックされたままにならず、例外が処理された状態で終了し、logging またはエラーの伝播によって失敗を確認できれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Issue Description
Type: bug report
Describe what happened
在spring-webflux中使用sentinel
请求过程中实例化SlotChainBuilder报错后DefaultErrorWebExceptionHandler无法正常处理异常并且不会输出任何日志,客户端请求被无限阻塞.
原因是SentinelReactorSubscriber的entryWhenSubscribed()方法只处理了BlockException异常
private void entryWhenSubscribed() {
ContextConfig sentinelContextConfig = this.entryConfig.getContextConfig();
if (sentinelContextConfig != null) {
ContextUtil.enter(sentinelContextConfig.getContextName(), sentinelContextConfig.getOrigin());
}
try {
AsyncEntry entry = SphU.asyncEntry(this.entryConfig.getResourceName(), this.entryConfig.getResourceType(), this.entryConfig.getEntryType(), this.entryConfig.getAcquireCount(), this.entryConfig.getArgs());
this.currentEntry = entry;
this.actual.onSubscribe(this);
} catch (BlockException ex) {
this.entryExited.set(true);
this.cancel();
this.actual.onSubscribe(this);
this.actual.onError(ex);
} finally {
if (sentinelContextConfig != null) {
ContextUtil.exit();
}
}
}
Describe what you expected to happen
How to reproduce it (as minimally and precisely as possible)
- 使用sentinel示例项目sentinel-webflux-example
- 配置com.alibaba.csp.sentinel.slotchain.SlotChainBuilder的自定义实现
public class TestBuilder extends DefaultSlotChainBuilder {
@Override
public ProcessorSlotChain build() {
ProcessorSlotChain chain = super.build();
if(1==1){
// 强制抛出异常
throw new RuntimeException();
}
return chain;
}
}
Tell us your environment
jdk21、spring-webflux:3.2.9
Anything else we need to know?
entryWhenSubscribed()方法中处理包括BlockException的所有异常,问题解决
- 主要言語
- Java
- スター
- 23.1k
- フォーク
- 8.1k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
alibaba/Sentinel のほかの issue
-
[BUG] sentinel-spring-webflux-adapter 在 Spring WebFlux 6.2.x 下触发限流时抛出 NoSuchMethodError対応中かも @amalsaidov が 6 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
[BUG] sentinel-dashboard: upgrade Spring Boot 2.5.12 -> 2.5.15 for known CVEs対応中かも @vendrov が 29 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
[DOC] Correct method-name typo in WebMVC interceptor example対応中かも @vietdungnguyen2005 が 18 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
-
README: broken Keruyun (客如云) logo image link in "Who is using" section (404)対応中かも @525600Cloud2 が 86 日前に担当しました。 オープン
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
-
fix: replace printStackTrace with RecordLog in ConfigUtil再び着手できるかも @yichao0824 が 118 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
alibaba/Sentinel の issue をすべて見る
似ている issue
-
area: language
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
vitruv-tools/NeoJoin#432 ·
メンテナーはふだん 1 日以内に返信
-
Add contributing guide対応中かも @WadekarPrashant が今日担当しました。 オープンgood first issue
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
jenkinsci/gitea-checks-plugin#382 · コメント 1 件 ·
-
enhancement infra
難易度 2/5 1〜3時間 初心者へのやさしさ 67/100
メンテナーはふだん 1 日以内に返信
-
5.0.x backport bug
難易度 1/5 1時間未満 初心者へのやさしさ 68/100
spring-cloud/spring-cloud-function#1569 ·
メンテナーはふだん 1 日以内に返信
-
Move the spring-cloud-commons version and BOM import from the bus parent to the stream parent対応中かも @olegz が今日担当しました。 オープンtask
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
spring-cloud/spring-cloud-stream#3355 ·
メンテナーはふだん 1 日以内に返信