Application Hang in waiting/reading response from server under .Net FW 4.8
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Tranquilo
- Stack tecnológico
- csharp
- Área
- api, backend-api-design
Línea de trabajo
Rastrea ExecuteAsync a través de ExecuteRequestAsync, SendWithRedirectsAsync, HttpClient.SendAsync y CstMessageHandler.SendAsync, utilizando los registros proporcionados de solicitudes consecutivas como detalles iniciales para reproducir el problema. Investiga la ruta de buffering y cancelación de .NET Framework 4.8 descrita en torno a content.LoadIntoBufferAsync. La tarea estará terminada cuando las solicitudes ya no se queden bloqueadas, se respete la cancelación y se alcancen los callbacks posteriores a la solicitud.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- C#
- Estrellas
- 9.8k
- Forks
- 2.3k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de restsharp/RestSharp
-
RestClientOptions.UserAgent missing from requests with useClientFactory: truePosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
Expose HTTP response trailers on RestResponsePosiblemente ocupada @Benziza la tomó hace 7 días. Abierto
Dificultad 4/5 3-5 días Aptitud para principiantes 68/100
-
RestClient configured with Newtonsoft.Json serializer still instantiates System.Text.JsonPosiblemente ocupada @JiuYue0820 la tomó hace 49 días. Abiertobug
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
-
delete 940Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 35/100
-
js/calculator.jsAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
Todos los issues de restsharp/RestSharp
Issues similares
-
[C#]:主页联网更新的提示投稿横幅指向错误Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
PCL-Community/PCL-CE#3652 ·
Los mantenedores suelen responder en 1 día
-
area:frontend bug FE P3
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
klasolsson81/jobbliggaren#2010 ·
Los mantenedores suelen responder en 1 día
-
[aw] Upgrade availableAbiertoagentic-workflows untriaged
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
Los mantenedores suelen responder en 1 día
-
area: homeblaze type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
RicoSuter/Namotion.Interceptor#630 ·
Los mantenedores suelen responder en 1 día
-
Akka.Hosting enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100