Hi,
We have a service, which runs kestrel. Our customers sometimes send big requests with 4MB data in the Request.Form collection. In that case, it takes more than 10 sec to read the form collection, using Request.ReadFormAsync method. When running kestrel on the service, based on dotnetframework, it may take more than 30 sec
We found, that this happens when the request contains a mix of Unicode characters, like text, translated to other languages (in our case there are many languages) with some quotes, "<>" characters or even "abc".
The main problem seems to be in the fact, that ReadFormAsync uses Uri.UnescapeDataString method, which takes most of the time (see enclosed dotTrace snapshot)
In our benchmarks (enclosed) we can see that Uri.UnescapeDataString takes about 39 sec, but WebUtility.UrlDecode takes 14 ms
Steps to reproduce the behavior:
In enclosed solution restore packages
Run with Ctrl+F5 (that will load the servers and perform benchmarks)
See benchmarks results
Enclosed are demo solution to reproduce the issue, benchmarks results and dotTrace snapshot:
Hi, We have a service, which runs kestrel. Our customers sometimes send big requests with 4MB data in the Request.Form collection. In that case, it takes more than 10 sec to read the form collection, using Request.ReadFormAsync method. When running kestrel on the service, based on dotnetframework, it may take more than 30 sec
We found, that this happens when the request contains a mix of Unicode characters, like text, translated to other languages (in our case there are many languages) with some quotes, "<>" characters or even "abc". The main problem seems to be in the fact, that ReadFormAsync uses Uri.UnescapeDataString method, which takes most of the time (see enclosed dotTrace snapshot) In our benchmarks (enclosed) we can see that Uri.UnescapeDataString takes about 39 sec, but WebUtility.UrlDecode takes 14 ms
Steps to reproduce the behavior:
Enclosed are demo solution to reproduce the issue, benchmarks results and dotTrace snapshot:
EscapeTest.zip readFormSnapshot.zip BenchmarkDotNet.Artifacts.zip