0

Is there a limit on number of open tabs for an ASP.NET MVC application to be able to make another request? Why I'm asking this is because, I make some requests in a blank target and after having 5 open tabs, I am not able to invoke any action method unless I close one of those 5. To make sure it's not related to anything that deals with database stuff, I put a breakpoint to the first line of the desired action method. The first 5 requests go super fast. But the sixth one.. The breakpoint doesn't hit on the sixth request. It's only after I close any of the previously opened tabs that the breakpoint hits immediately.

To be honest, I'm not sure if this is even related to ASP.NET MVC, because I have this problem in Chrome and Firefox. With IE10, there's no such problem. Do you have any idea what the problem is?

Mikayil Abdullayev
  • 12,117
  • 26
  • 122
  • 206
  • Most likely, your machine is limited on resources (probably RAM) so those browsers aren't able to open another tab after 5. If that is the case, this has nothing at all to do with ASP.NET MVC. – NightOwl888 Jun 17 '16 at 09:06
  • I opened tons of tabs for another application developed in java and a lot more for various web sites. All went through smoothly. – Mikayil Abdullayev Jun 17 '16 at 09:56
  • Okay, did you profile your application (or at least check the task manager) to see if you are running low on RAM? It could be inefficiency of your application causing it, but the browser exhibiting symptoms as a result. If this is the case, it would explain why the java app works and this one doesn't. – NightOwl888 Jun 17 '16 at 10:24
  • It might help if you post the code of the offending action method and any services it uses. – NightOwl888 Jun 17 '16 at 10:25
  • This happens with any action method. So even the one that just redirects to google. – Mikayil Abdullayev Jun 17 '16 at 10:41
  • My suggestion is to check the solution out of source control and run the debugger on another machine (preferably one with more RAM). At least that will tell you whether it is an issue with the computer configuration (such as limited resources) or something within the application itself. – NightOwl888 Jun 17 '16 at 10:50
  • I don't think it's a problem with the computer as it's gor 12GB ram and the CPU is I7 -2600 3.40 Ghz (8 CPUs). – Mikayil Abdullayev Jun 17 '16 at 10:59
  • So I created a fresh MVC application with default template. Opened more than 10 tabs with no problem. So there's definitely a problem with my code. All my controllers are subclasses of a custom controller called BaseController which itself is a subclass of `Controller`. I put a breakpoint to the `OnActionExecuting` method but stil don't get it hit. Is there something that comes before `OnActionExecuting`? – Mikayil Abdullayev Jun 17 '16 at 11:11
  • Yes, [`OnAuthorization` and `OnException` happen before `OnActionExecuting`](https://msdn.microsoft.com/en-us/library/gg416513(VS.98).aspx), as well as routing, and `Application_BeginRequest` in `Global.asax`. IMO, there is [no good reason to create a base controller in MVC](http://stackoverflow.com/a/6119341/181087). You are already creating a filter by implementing `OnActionExecuting`, you might as well [register it globally](http://stackoverflow.com/a/28365933/181087) instead of forcing all of your controllers to inherit from a god object. – NightOwl888 Jun 17 '16 at 11:32

1 Answers1

1

I'm both glad and sad to have found the reason behind this weird behavior. I use SignalR for realtime notifications. As browsers have maximum number of concurrent connections, which is something around 6, I am not able to open an additional tab that has SignalR connection started. So this is a browser limitation. There are workarounds though. One of them is adopting subdomain approach like facebook does. Another one is limiting the number of open connections as described in this blogpost

Mikayil Abdullayev
  • 12,117
  • 26
  • 122
  • 206