dotnet / aspnetcore

ASP.NET Core is a cross-platform .NET framework for building modern cloud-based web applications on Windows, Mac, or Linux.
https://asp.net
MIT License
35.58k stars 10.06k forks source link

dotnet core 1.1 web application all requests in pending state #2317

Closed aleha84 closed 6 years ago

aleha84 commented 6 years ago

Year ago started to develop web service (WEB API) based on dotnet core 1.0 with push notifications ability. Used for this SignalR, because I was already familiar with this library from .net framework.

Unfortunately there wasn't any official release for this library under dncore, so i used this: "Microsoft.AspNetCore.SignalR.Server": "0.2.0-*" from https://dotnet.myget.org/F/aspnetcore-ci-dev/api/v3/index.json

All works fine as expected. After a few month of development migrated to dot net core 1.1. All was fine. The web application is used like a service (widget). Requests are sent to it from another web site (making initial requests, get js scripts, establishing websocket connection). A month ago first release was made to production server (windows server 2016). All worked fine as expected. Over 500-600 simultaneous connections were being handled.

After that time, a lot of work was made (mostly busines logic and replacing EF with Dapper). And it was discovered that locally on the dev environment no more than 10 websocket connections could be established. All other requests (GET requests) to the service are in pending state. If one connection is closed, then the next receives response.

If I remove establishing of websocket connection from js ($.connection.hub.start()), then all is fine, no pending requests. No exception, no errors or warnings in logs. IIS logs don't have any entries either, like no requests were made.

On production, when the release has been applied, the situation is similar. Just pending state on all requests.

If switching back to the branch without the new features (without Dapper), locally it still handles only 10 connections, but on production all is fine, all same 500-600 connections are stable.

Dev environment dotnet core sdk versions installed: 1.0.1, 1.0.4, 1.1.0, 1.1.5, 1.1.6, 2.0.2, 2.0.3, 2.1.2 Server dotnet core runtime versions installed: 1.0.4, 1.0.5, 1.0.8, 1.1.1, 1.1.2, 1.1.5, 2.0.3

Could it be possible that application created on 1.1.5 framework version will work incorrect with aspnetcore iis module version 2.0.3 installed?

deps.json main diff between working and failing version:

"Dapper/1.50.2": {
            "dependencies": {
              "System.Collections": "4.3.0",
              "System.Collections.Concurrent": "4.3.0",
              "System.Collections.NonGeneric": "4.3.0",
              "System.Data.SqlClient": "4.3.1",
              "System.Dynamic.Runtime": "4.3.0",
              "System.Linq": "4.3.0",
              "System.Reflection": "4.3.0",
              "System.Reflection.Emit": "4.3.0",
              "System.Reflection.Emit.Lightweight": "4.3.0",
              "System.Reflection.Extensions": "4.3.0",
              "System.Reflection.TypeExtensions": "4.3.0",
              "System.Runtime": "4.3.0",
              "System.Runtime.Extensions": "4.3.0",
              "System.Runtime.InteropServices": "4.3.0",
              "System.Text.RegularExpressions": "4.3.0",
              "System.Threading": "4.3.0",
              "System.Xml.XDocument": "4.3.0",
              "System.Xml.XmlDocument": "4.0.1"
            },
            "runtime": {
              "lib/netstandard1.3/Dapper.dll": {}
            },
            "compile": {
              "lib/netstandard1.3/Dapper.dll": {}
            }               
}
.....
"compile": {
          "ref/netstandard1.0/System.Reflection.Emit.Lightweight.dll": {}
        },
.....
"Dapper/1.50.2": {
      "type": "package",
      "serviceable": true,
      "sha512": "sha512-6VcCiiOxVhgMwgMCuQuaff8I5IyDamrzeOjuUH1iMExh8R5TJqwkVCpwdVJGQdwSCqWsQA/PerrrK7T6mONthQ=="
    },  
}

I created a separate branch to migrate from 1.1 to 2.0 and use Microsoft.AspNetCore.SignalR -Version 1.0.0-alpha2-final, but there is no direct compatibility, and lack of functionality (at least it's not possible to send a message to a specified range of connections ids). So lots of additional work and tests needed, and I'm not sure if it will help at all.

Here is a sample for reproduction. MainSite is .Net Framework project. Service is .Net Core 1.1 project Both must be hosted in IIS. MainSite binding: localhost:8080, Service binding: localhost:8081. On my current development machine, I can establish 3 websocket connectionsbefore I start receiving a failure. Installed DotNetCore.1.0.7_1.1.4-WindowsHosting.exe to enable ANCM in IIS. (DotNetCore.1.0.8_1.1.5-WindowsHosting can not be installed because of the bug) Steps to reproduce:

  1. Open MainSite page. Open dev console. Current connected clients count should be logged.
  2. Open MainSite in new tab once more. Current connected clients count should increment.
  3. Open MainSite once more in new tab. Nothing happens.
  4. Open dev console of current new opened tab, go to Netwark tab, Refresh page. See Pending Request. Open one more tab with MainSIte. In Netrowk tab connection to Hub or to widget should be in pending state.
  5. Close second tab, third tab should recieve response.
BrennanConroy commented 6 years ago

Dupe of issue in SignalR repo