SignalR: Server doesn't receive any requests if more than X connections established in one browser - signalr

Good day.
Background: ASP.NET MVC 3 / SignalR.
I'm developing typical chat component which will be used in a big portal. I wrote small emulator which opens new window with chat component and new SignalR connection in it.
The problem:
Everything works fine, but: Suddenly i noticed that if i open more than X windows/tabs with same component in one browser - server stops to receive any responses from any clients connected with it.
The X is:
5 for IE and Chrome
14 for FF.
I suppose it's a browser issue, because the value differs from one to another. Additionally i noticed that requests can stay pending for minutes! And there is no timeout..
Maybe someone faced with something like this, or know what can cause this strange behavior?
Thanx in advance, Jan.

I'm going to assume you're using IIS 7/7.5 on windows 7. If you are indeed using Windows7 then you need to use IIS Express since it only supports 10 concurrent connections (Client OS limit). Alternatively you can use Windows Server to get the full benefits of IIS.

This is the first post in three days of googling that came close to my experience. I am using the .NET client and have tried isolating the issue by creating an app with just the problem areas. The difference in our situation is this: I don't seem to have some connection limit on the client. In fact, I have no issues until I deploy my .Net hub to the windows server 2008 hyper vps. IIS express runs everything as smooth as butter. I've checked to make sure the asynchronous services and features are running and I've followed the performance tuning articles that david mentions in the documentation, adjusting the setting for thread queue maximums and the like. Note that the minute-two minute delays you describe are identical to mine. I updated to the latest version of SignalR (.4) from nuget and it broke my solution for some reason.
Can you tell me what version you're on? I suspect it could have something to do with security on the physical host where my vps is running. I am going to try it on a different virtualization platform to rule out hyper v issues.

Please, see my answer here: Is there a way to get number of connections in Signalr hub group?
The idea is to overwrite connectionid.

Related

How to detect a timeout in a .net application that is not resulting in an error, just an 8 second delay?

I've got a Windows 2008 Enterprise R2 Server running Ektron 8.02 SP3 that is causing me some trouble that I can't diagnose.
So my question isn't for a solution but simply how to better profile a .net application / windows server. Whenever you try to POST a form built by the software, it takes 8 seconds and change to return the page (on this specific server, it doesn't do it on other machines with the same codebase). It appears that it's trying to make a connection to something for 8 seconds, fails, then returns the page without error. Some more facts:
This is a beefy VM that is not being over utilized
The database is running on the same machine, so there is no lag there.
The 8 second delay even happens when submitting from the server itself
The event viewer for the server doesn't report any errors that seem related
Profile MSSQL doesn't report any issues either
Microsoft Network Monitor doesn't report any glaring networking issues, though its hard to say as the tool doesn't report long connection attempts clearly (from what I've seen of it)
I feel sufficiently confident that there is some process during the form POST on the server that is trying to make a connection somewhere, failing, and continue through the rest of the process. It doesn't report any errors and the forms all submit fine.
So, all that being said, is there anything else I can do to debug this? I feel like I'm shooting in the dark. Thanks for any help you can offer.
It sounds like this isn't an application you wrote. If so, the potential solutions are different.
A first level step would be to use Windows' Performance Monitor. Select the options (process and/or performance attribute to watch), then run the process through its paces.
If Performance Monitor can't help, you'll need to get into the real guts of the app. Most likely this will be more difficult than you want unless you're writing the app. You can debug a .NET app that is not your own using Reflector (paid) or ILSpy (free). HOWEVER, this can violate the license agreement (and likely does if the app has been purchased).
Apart from that, you're going to need to contact the product developer if you want to both stay sane and find this problem quickly.

What would cause a 1 second delay added onto all my POSTs on DEV but not LIVE?

Two Win2003 servers running ASP.NET sharing same SQL Server, one is DEV the other is LIVE. They are both clones of each other, one is the development box. The dev box is going really slow but I noticed it even happens on a 404 response even. When I browse to a fake URL with either domain to get a 404, the dev box was like 1.4 seconds and other box was like 200ms. So it wasn't recent code changes. Is there some IIS configuration or web.config setting that would cause this?
(I did a traceroute to both and it turned out equal)
It could be a lot of things:
The DEV machine is resolving or trying to resolve the clients' DNS name.
The DEV machine has to perform a DNS query for the DB machine.
The DEV machine not using connection pooling (check the connection string).
Is the KeepAlive setting the same in both machines?
Is there any AD authentication involved? Could that be slower from DEV?
What if you do the POST locally on DEV? Is it still slow?
Are you on the actual dev console?
If so, is it a Firefox or WebKit IPv6 issue? Many of us devs have IPv6 available on our own boxes, and some browsers are pretty slow with it if it's not set up completely. Try using IE and see if you get a fast response on your dev box.
When I access local apps in Chrome, it takes several seconds for the page to display. Same with Firefox until I disabled IPv6 in its config.
Since even a 404 Not Found is slow, that says it probably isn't related to your DB, unless perhaps you're doing some sort of logging or other DB access from Global.asax or an HttpModule.
Have you looked in the Windows error log to see if any errors are being reported?
If ping and tracert from your client to both servers looks OK, and if it also looks OK from the web servers to the DB, then you might look at things like:
Hardware problems (flakey network cables are a common culprit). Maybe try swapping your live and dev machines, and see if the problem stays on the same hardware. Flakey disks can also cause slowness as the controller retries.
IIS-related configuration errors. If the site works and is just slow, you might look at your back-end logging, tracing, etc, if you have any.
You might also look into upgrading to Win 2008. IIS 7 has some much-improved debug facilities, including things like Failed Request Tracing.

Internet Explorer hanging when debugging ASP.NET app

This problem is beginning to annoy.
After my machine (Vista Ultimate) has been up for a while, running my ASP.NET web site project for debugging in VS2008 results in Internet Explorer "hanging". It doesn't seem to get past the network access stage, you know when it says "Loading web site", or "Waiting for".
I've attached a screenshot of IE. Note the status bar. It stays like that forever. I have to restart it and cross my fingers for it to work the next time. Invariably, it doesn't.
This happened with IE7 and IE8.
I am using the ASP.NET Web Development Server/Cassini. I have tried restarting this each time which seemed ot have got it, but then not so any more.
I'm up to date on patches.
ie screenshot http://img40.imageshack.us/img40/5446/iehanging.png
So thankfully Microsoft have finally released Security Essentials.
This meant I could de-install AVG (Free and paid-for versions) from my machine.
Hey presto, it works!
I would check the following
1) that your not starting IE against the webserver againt the wrong port, if your using the development IIS then it changes ports at times. That combined with you setting up the browser to launch against a the old port could create this problem.
2) Stop the local IIS and restart it (Again make sure your pointing towards the correct port)
3) Make sure you dont have any hung IE in task manager ( this happens to me sometimes ). Basiclly you have a IE in task manager that uses less then 1mb of ram and does not show on the taskbar, if thats the case kill them.
This doesn't sound, strictly speaking, like a hang. Can that tab/other tabs be navigated to other sites? Is your machine configured to use a proxy?
Is the request actually sent? Using Fiddler2 from www.fiddler2.com with the URL http://ipv4.fiddler:56125/ will show you, and help determine where in IE the problem might be.
I just had a similar problem that took about a week to unravel. Using AVG 9 Business Edition.
I'm on a Windows 7 machine with Visual Studio 2010 SP1, debugging ASP.NET sites running in IIS, with the same "hang" behavior you're seeing. Disabling LinkScanner and Online Shield in AVG fixed the problem.

WAP vs XHTML-MP

Last year we develop intranet web site using WAP and ASP.NET for server side, the site was already on production and was considered successful. We use low end handset which had built in Openwave version 6.
Now we update the application using XHTML-MP, because we think this will be the future mobile application technology that will be supported. But the performance was very worse. We tested both application on same time and same module, the new application is 10 seconds (average) longer than the old one. We eliminate several possibility such as redirect and we already compress the page (both application pare are 2 kb size). During the test, we encountered the XHTML-MP application often get network error, such "Cannot resolve host name" and "Request Time Out", but not on the WAP application using the same device and browser. The application use the same proxy. We tested both using the direct access and using proxy (WAP Gateway).
We put logger in our application that track how long application was executed in server time, and it was less than a seconds.
We already invest so much time and money on this, but we can't figure out what is the cause of problem.
Does this mean that rendering XHTML-MP was longer than rendering WAP on Openwave browser? And why I haven't see any documents on Internet that mention about this? Is developing new web mobile using XHTML-MP are suggested?
Any help and suggestion are very appreciate.
ucin
May I ask how much css formatting are you doing? It's recommended that you don't use css extensively to format the page since many handsets don't have enough power to process that (at least a few years ago, that was the case).
This is obviously very device (or device range) specific, could you tell us which devices struggle to format xhtml?
If so, is it not possible to show WML to these old troublesome devices? You could look at their agent string for example to detect what markup to output them.

Any reason why an ASP.Net 2.0 application with no code would take 2 minutes to load on first run?

I've asked this on server fault already but to no avail. So I'm hoping another ASP.Net Developer would have come across my issue.
I've got a Windows VPS running II6 and I'm migrating my ASP.Net applications across to the server. When I navigate to one of those applications it takes approximately 2 minutes to do anything. I created a hello world application and uploaded that, and that to takes 2 minutes to load the first time. If I restart the app pool I get exactly the same issue.
Any application that shares an app pool with another application will work once one application has loaded successfully in that app pool.
I.e. bob.example.com and jane.example.com are in an app pool called ABC1. If I access bob it will take 2-3 minutes to load. After bob has loaded, Jane will work instantly and bob will work instantly. After 5-10 minutes of being idle, or if I restart the app pool, exactly the same process happens again. During the time when bob and jane and working fine, if dave.example.com in app pool XYZ9 is loaded, I must wait 2-3 minutes for that to load too.
Has anyone come across this issue? I am in absolute panic mode at the moment as I need to get these migrated by the end of the weekend.
Oh, and those sites work instantly on the old server. The only difference is that the old server is 32-bit and the new server is 64-bit.
You say it takes two minutes to start up. What is the system doing during that time? In particular, what is w3wp.exe doing?
I suggest you run SysInternals' Process Monitor to learn a bit about what's going on. It will take a while to come up with a useful filter, but it should be worthwhile.
In particular, the latest versions of this tool can give you information about networking calls being made by the processes you're watching, which will be good if it turns out you've got issues with certificates, proxy servers, or both.
Instead of requesting a .aspx file, what happens if you request a plain .htm file? The difference is that HTML files don't go through ASP.NET, so if you still get the slowness issue, you'll know that it is more of an IIS thing than an ASP.NET thing.
Though not an answer, it's a step towards isolating the issue.
On shared virtual hosts (VPS), I've found that the disk access can be extraordinarily slow, and vary at times of day. When the application pool spins up, the process has to load from disk and it (presumably) needs to load the .Net framework.
(I asked a similar question here.)
Really, my virtual host is shockingly slow at times so I believe that 2 minutes can be attributable to disk I/O speed. And if your virtual server has a low amount of RAM, it will be worse.
I use a server monitoring service to hit a URL every 30 minutes. This helps keep the app loaded. ASP.net 4.0 has some features which promise to help.
I disabled recycling and that fixed everything...ish. Once it's loaded once it's loaded forever. Still doesn't fix the underlying problem, but 1and1 refuse to help regarding issues with IIS.
This could just be the initial appdomain compile startup cost but magnified because you're using a VPS.
What kind of spec have you got on that?
I don't have any clue on this question.
However, I read/heard somewhere that - in such a scenario it could be possible that your request goes out on the internet to check for the domain, when it should check first in the local network (related to DNS maybe).
This is totally based on what I can recollect of a similar problem people discussing on an article/podcast.
Could be that the server is probably having problems validating the signed assemblies certificates revocation chain lists. You can disable CRL checks and see if it performs better.
Update
To disable the Certificate Revocation List (CRL) check:
Open Internet Explorer
Go to Tools —> Internet Options…
Go to the Advanced tab
Locate the Security section and uncheck the Check for publisher’s certificate revocation option.
This disables globally, for the entire server, the CRL check, and has the side effect of disabling the authenticode CRL checks (ie. the ASP app pool checks). I'm not aware of any more fine grained method. Also, I don't know if this has to be done separately for the x86 version of IE (to apply to 32 bit apps) and to the x64 version of IE (for the 64 bit apps).
Does your application share the same application pool with other web applications? In other words, are you using a third-party VPS and have no control over app pool usage? If so, then the application initialization code for the other apps could be what's causing the slow startup time.
Under what identity is the application pool running? Domain, or local?
What forms of authentication are you using? If anonymous, what account is it using (domain or local)>
If you check task manager right after iisreset and hitting the website, does it show w3svc running, or are we waiting for it to start at all?
What about a static file, e.g., .htm?
That's all I have - hope this helps.

Resources