Comments (4)
Hello @lucapivato, thanks for using EmbedIO!
I agree with you that something is wrong here, but I'm not sure it's FileModule's fault.
As your screenshot shows, the request for favicon.ico
went through WebServerBase<TOptions>.DoHandleContextAsync
in about one millisecond (15:19:01.404
> 15:19:01.405
). For reference, here is the code that writes the first and last log lines related to the request, at line 236 at 286 respectively.
Still, when the last of the three involved lines is logged, the HTTP context has an age (time elapsed since creation) of more than 18 seconds. This seems to indicate that most of that time was spent between the creation of the HTTP context and its handling, therefore in the not-yet-fully-explored (by me, at least) territory of HttpListener and related classes.
If you can (i.e. if your server runs on Windows) try replacing the first line of your code with the following and see if you observe the same behavior:
var server = new WebServer(o => o
.WithMode(HttpListenerMode.Microsoft)
.WithUrlPrefix("http://localhost:5000/"));
Also, the log of the first overly-delayed request and the two or three previous requests might help.
from embedio.
Yes, favicon is a side effect. After returning a js file of about 1Mb to 6Mb it starts hanging for other files too. I tried returning it directly WithAction() and using the OpenResponseStream() but it's more or less the same, the browser keeps spinning as if the connection was kept open. Tried closing the stream, flushing, etc. Tried writing directly to the OutputStream but same reasult.
.WithMode(HttpListenerMode.Microsoft) didn't change the behavior.
In case you want to test it, I have attached one of the js files. I don't know if the issue is the UTF-8 encoding (at one point we got an exception related to the 1252 encoding on MAUI but cannot reproduce), we tried with a 6Mb xml file and it worked fine. Tried the managed HttpListener directly in Windows and iOS with the same files and it worked fine.
Thank you.
from embedio.
Thanks for the file, but this issue does not seem to be about the specific file being requested.
The delay happens before EmbedIO even has a chance of dispatching the request; that's why using an ActionModule makes no difference. It looks like the request gets stuck in EmbedIO's request queue, as if the thread pool has no thread left to handle it, which is unusual to say the least.
Can you get a screenshot showing the sequence of requests made to the server? I think Chrome's DevTools may help with this.
A complete log from the server may also be of help. You can activate logging on file by adding the following line before server initialization:
using Swan.Logging; // <-- You need this too
Logger.RegisterLogger(new FileLogger("PATH_TO_LOG_FILE", false));
from embedio.
I'm stuck debugging this issue. I did come to the same conclusion that the thread pool get exhausted somehow, because all "life signs" vanishes after hitting the issue.
It seems to affect all module types.
For now my "solution" is to keep the JSON responses under 1MB (which is sometimes needed).
from embedio.
Related Issues (20)
- Post Request Body must be read HOT 8
- Socket connetion gives Status Code 500 HOT 1
- Content-Length and HTTP Head requests HOT 1
- When requesting a mp4 embedio is responding with identity in the content encoding header.
- Cannot control charset in ContentType header HOT 3
- How to send statuscode 202 HOT 1
- EmbedIO 3.5.0 NuGet package references wrong/old version of Unosquare.Swan.Lite HOT 22
- System.ObjectDisposedException when processing multiple requests at once HOT 2
- WithZipFile should open a read only handle(or have the option to) HOT 2
- Add XML as response type
- EmbedIO Dual-Stack Localhost Listener Causes Empty Replies HOT 1
- How can I custom the Server header HOT 2
- Disable request logging only
- Cookies issue
- EmbedIO.Samples console app does not work when PublishAot is set to true HOT 2
- Web Server does not work in Xamarin.iOS (IOS-17) HOT 3
- How to report progess via api - event-stream
- HttpContext.OnClose not firing HOT 1
- Getting rid of double quotes around strings in a Web API response (turning off JSON serialization) HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from embedio.