Application Hang in waiting/reading response from server under .Net FW 4.8
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 静か
- 技術スタック
- csharp
調査の方向性
提供された連続リクエストのログを再現の出発点となる詳細情報として使用し、ExecuteAsync を ExecuteRequestAsync、SendWithRedirectsAsync、HttpClient.SendAsync、CstMessageHandler.SendAsync の順に追跡します。content.LoadIntoBufferAsync 周辺で説明されている .NET Framework 4.8 のバッファリングおよびキャンセルの経路を調査します。リクエストがハングしなくなり、キャンセルが尊重され、リクエスト後のコールバックに到達すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
Under .Net Framework 4.8 and after the upgrade from RestSharp v106 to v114 and in a multi-threaded environment, we experience on rare occasions hangs of web requests through RestSahrp
To Reproduce
We have extensively introduced more logging on our client using interceptors and introduced our own custom message handler.
Find below two consecutive requests, the first one completing correctly and the second one did not finish. After SendAsync returns the next message AfterHttpRequest would have been expected but never came.
Request 1
2026-06-03 13:22:08.061 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Get RestClient with identifier: 2474
2026-06-03 13:22:08.062 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Http Resource: "cst-api/product-management/attributes/get-attribute-values/"
2026-06-03 13:22:08.062 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Http Request Parameters: [{ContentType:{Value:application/json,AsMediaTypeHeaderValue:{CharSet:null,Parameters:[],MediaType:application/json}},Name:,Value:{OwnerType:3,OwnerId:997,NodeId:null,Category:{Id:72,CstId:null},AttributeDefinitions:[{Id:371,CstId:null}],AttributeFallBackBehavior:{UseArticleFallback:true,UseDefaultArticleFallback:true,UseCategoryFallback:true,UseAttributeDefinitionFallback:true,UseRunAssemblyFallback:false,UseNodeFallback:false,UseWorkflowStepFallback:false,ArticleRoleTypeUsedInDefaultArticleFallback:{Id:0,CstIdentifier:00000000-0000-0000-0000-000000000000,Label:}},Simulated:false},Type:3,Encode:false}]
2026-06-03 13:22:08.062 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Http Request Body: {OwnerType:3,OwnerId:997,NodeId:null,Category:{Id:72,CstId:null},AttributeDefinitions:[{Id:371,CstId:null}],AttributeFallBackBehavior:{UseArticleFallback:true,UseDefaultArticleFallback:true,UseCategoryFallback:true,UseAttributeDefinitionFallback:true,UseRunAssemblyFallback:false,UseNodeFallback:false,UseWorkflowStepFallback:false,ArticleRoleTypeUsedInDefaultArticleFallback:{Id:0,CstIdentifier:00000000-0000-0000-0000-000000000000,Label:}},Simulated:false}
2026-06-03 13:22:08.063 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - ResilientWebRequestEx
2026-06-03 13:22:08.063 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] >> BeforeRequest 13:22:08.063 | POST cst-api/product-management/attributes/get-attribute-values/ | Parameters: 4
2026-06-03 13:22:08.063 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [RequestBody] : Chemspeed.ServiceLayer.Api.Common.ProductManagement.Attributes.AttributeContext
2026-06-03 13:22:08.064 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [HttpHeader] Cache-Control: no-cache
2026-06-03 13:22:08.064 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [HttpHeader] Connection: close
2026-06-03 13:22:08.064 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [HttpHeader] Authorization: Bearer eyJhbGciOi*****
2026-06-03 13:22:08.065 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] >> BeforeHttpRequest 13:22:08.065 | URI: http://192.168.135.10/cst-api/product-management/attributes/get-attribute-values/
2026-06-03 13:22:08.065 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] >> SendAsync to http://192.168.135.10/cst-api/product-management/attributes/get-attribute-values/ | ServicePoint connections: 0/20 | IdleSince: 13:22:08.057
2026-06-03 13:22:08.082 [17] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] << SendAsync returned for http://192.168.135.10/cst-api/product-management/attributes/get-attribute-values/ | ServicePoint connections: 1/20
2026-06-03 13:22:08.083 [17] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] >> Raw HttpResponseMessage received at 13:22:08.083 | Status: 200
2026-06-03 13:22:08.083 [17] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] Content-Length header: -1
2026-06-03 13:22:08.084 [16] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] << AfterHttpRequest 13:22:08.084 | Status: 200 OK
2026-06-03 13:22:08.084 [16] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] << AfterRequest 13:22:08.084 | 200 OK | Status: Completed | Content-Type: application/json | Size: 1259 bytes
2026-06-03 13:22:08.085 [16] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] >> BeforeDeserialization at 13:22:08.085 | Status: 200 | Content-Type: application/json | RawBytes buffered: 1259 bytes | Response body already in memory: True
2026-06-03 13:22:08.085 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Call to Uri succeeded: http://192.168.135.10/cst-api/product-management/attributes/get-attribute-values/
RestClient ResponseStatus: Completed, HTTP StatusCode : Description: OK : OK
Data: [{Id:53067,AttributeDefinition:{Id:371,CstIdentifier:a9717272-5f12-4005-a25c-b41edbfaf35c,Label:Located at,Comment:Module ID,ArrayDimension:0,DefaultUnit:2800,UnitLabel:Integer,Measurement:25,CategoryId:null,CategoryCstId:a618a3f0-fedc-4dc5-8c3d-3dad2c0c504c,CategoryLabel:null,DisplayOrder:0,ArchiveMode:0,MinValue:null,MaxValue:null,DefaultValueInfos:[],DefaultValueInfosInSI:[],InitialValueInfos:[],SelectOnly:null,AlwaysEditable:null},Category:{Id:72,Label:Shuttle Attributes,Comment:null,CstId:a618a3f0-fedc-4dc5-8c3d-3dad2c0c504c,AttributeDefinitions:[]},AttributeOwnerType:3,AttributeOwnerTypeName:null,AttributeValues:[{Id:4530072,AttributeId:0,AttributeDefinitionId:null,Value:{Bool:null,Int:14,Double:null,String:null,DateTime:null,File:null,DataType:2},ValueInDisplayUnit:{Bool:null,Int:14,Double:nu
Request 2
2026-06-03 13:22:08.087 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Get RestClient with identifier: 2474
2026-06-03 13:22:08.088 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Http Resource: "cst-api/product-management/attributes/get-attribute-values/"
2026-06-03 13:22:08.088 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Http Request Parameters: [{ContentType:{Value:application/json,AsMediaTypeHeaderValue:{CharSet:null,Parameters:[],MediaType:application/json}},Name:,Value:{OwnerType:3,OwnerId:998,NodeId:null,Category:{Id:72,CstId:null},AttributeDefinitions:[{Id:371,CstId:null}],AttributeFallBackBehavior:{UseArticleFallback:true,UseDefaultArticleFallback:true,UseCategoryFallback:true,UseAttributeDefinitionFallback:true,UseRunAssemblyFallback:false,UseNodeFallback:false,UseWorkflowStepFallback:false,ArticleRoleTypeUsedInDefaultArticleFallback:{Id:0,CstIdentifier:00000000-0000-0000-0000-000000000000,Label:}},Simulated:false},Type:3,Encode:false}]
2026-06-03 13:22:08.088 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - Http Request Body: {OwnerType:3,OwnerId:998,NodeId:null,Category:{Id:72,CstId:null},AttributeDefinitions:[{Id:371,CstId:null}],AttributeFallBackBehavior:{UseArticleFallback:true,UseDefaultArticleFallback:true,UseCategoryFallback:true,UseAttributeDefinitionFallback:true,UseRunAssemblyFallback:false,UseNodeFallback:false,UseWorkflowStepFallback:false,ArticleRoleTypeUsedInDefaultArticleFallback:{Id:0,CstIdentifier:00000000-0000-0000-0000-000000000000,Label:}},Simulated:false}
2026-06-03 13:22:08.089 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - ResilientWebRequestEx
2026-06-03 13:22:08.089 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] >> BeforeRequest 13:22:08.089 | POST cst-api/product-management/attributes/get-attribute-values/ | Parameters: 4
2026-06-03 13:22:08.089 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [RequestBody] : Chemspeed.ServiceLayer.Api.Common.ProductManagement.Attributes.AttributeContext
2026-06-03 13:22:08.090 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [HttpHeader] Cache-Control: no-cache
2026-06-03 13:22:08.090 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [HttpHeader] Connection: close
2026-06-03 13:22:08.090 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] Param [HttpHeader] Authorization: Bearer eyJhbGciOi*****
2026-06-03 13:22:08.091 [9] INFO Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [Interceptor] >> BeforeHttpRequest 13:22:08.091 | URI: http://192.168.135.10/cst-api/product-management/attributes/get-attribute-values/
2026-06-03 13:22:08.091 [9] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] >> SendAsync to http://192.168.135.10/cst-api/product-management/attributes/get-attribute-values/ | ServicePoint connections: 0/20 | IdleSince: 13:22:08.084
2026-06-03 13:22:08.110 [16] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] << SendAsync returned for http://192.168.135.10/cst-api/product-management/attributes/get-attribute-values/ | ServicePoint connections: 1/20
2026-06-03 13:22:08.110 [16] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] >> Raw HttpResponseMessage received at 13:22:08.110 | Status: 200
2026-06-03 13:22:08.110 [16] DEBUG Chemspeed.ServiceLayer.Api.Shared.CstRestclient - [CstMessageHandler] Content-Length header: -1
Expected behavior
No hanging of requests and respecting of cancellation token
Stack trace
Probably here:
ExecuteAsync(request, ct)
└─ ExecuteRequestAsync (creates timeoutCts+linked ct)
└─ OnBeforeRequest / OnBeforeHttpRequest ✅ logged
└─ SendWithRedirectsAsync
└─ HttpClient.SendAsync(msg, ResponseContentRead, ct)
└─ CstMessageHandler.SendAsync ✅ logged ">> SendAsync"
└─ HttpClientHandler.SendAsync → returns after headers
← finally block ✅ logged "<< SendAsync returned"
← CstMessageHandler returns to HttpClient
← HttpClient now must buffer chunked body via:
content.LoadIntoBufferAsync(maxSize, ct) ← ** HANGS HERE **
CT not observed on .NET 4.8 legacy stack
← SendWithRedirectsAsync never returns
← OnAfterHttpRequest never called ❌ missing from log
← OnAfterRequest never called ❌ missing from log
Desktop (please complete the following information):
- OS: Windows 10/11
- .NET FW 4.8
- Version 114
Additional context
Only seems to happen since we upgraded from v106, .Net FW 4.8 stayed the same.
- 主要言語
- C#
- スター
- 9.8k
- フォーク
- 2.3k
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
restsharp/RestSharp のほかの issue
-
RestClientOptions.UserAgent missing from requests with useClientFactory: true対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
Expose HTTP response trailers on RestResponse対応中かも @Benziza が 7 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
-
RestClient configured with Newtonsoft.Json serializer still instantiates System.Text.Json対応中かも @JiuYue0820 が 49 日前に担当しました。 オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 65/100
-
delete 940オープン
難易度 1/5 1時間未満 初心者へのやさしさ 35/100
-
js/calculator.jsオープン
難易度 5/5 1週間以上 初心者へのやさしさ 10/100
restsharp/RestSharp の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
PCL-Community/PCL-CE#3652 ·
メンテナーはふだん 1 日以内に返信
-
bug effort:S P3
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nightscout/nocturne#2012 ·
メンテナーはふだん 1 日以内に返信
-
area:frontend bug FE P3
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
klasolsson81/jobbliggaren#2010 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows untriaged
難易度 1/5 1時間未満 初心者へのやさしさ 65/100
メンテナーはふだん 1 日以内に返信
-
area: homeblaze type: bug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
RicoSuter/Namotion.Interceptor#630 ·
メンテナーはふだん 1 日以内に返信