SignalR makes IIS hang after rebuild

Windows 8.1. IIS 8.5. SignalR versions:

<package id="Microsoft.AspNet.SignalR" version="2.1.2" targetFramework="net451" />
<package id="Microsoft.AspNet.SignalR.Core" version="2.1.2" targetFramework="net451" />
<package id="Microsoft.AspNet.SignalR.JS" version="2.1.2" targetFramework="net451" />
<package id="Microsoft.AspNet.SignalR.SystemWeb" version="2.1.2" targetFramework="net451" />

Whenever I rebuild my project/solution, IIS spikes to max CPU usage and I cannot reload my page. I checked procmon.exe and it reports an enormous amount (>20 000/s) of “RegOpenKey/RegQueryKey” operations like these ones:
Date & Time:    19.11.2014 10:47:20
Event Class:    Registry
Operation:  RegQueryKey
Result: SUCCESS
Path:   HKLM
TID:    23272
Duration:   0.0000059
Query:  HandleTags
HandleTags: 0x0

Date & Time:    19.11.2014 10:47:20
Event Class:    Registry
Operation:  RegOpenKey
Result: REPARSE
Path:   HKLMSYSTEMCurrentControlSetServicesSignalRPerformance
TID:    23272
Duration:   0.0000121
Desired Access: Read


Date & Time:    19.11.2014 10:47:20
Event Class:    Registry
Operation:  RegOpenKey
Result: NAME NOT FOUND
Path:   HKLMSystemCurrentControlSetServicesSignalRPerformance
TID:    23272
Duration:   0.0000062
Desired Access: Read

These are the steps I use to reproduce this issue:
  1. Everything works fine.
  2. I write some code and compile
  3. SignalR does a reconnect with WebSocket transport and gets this response in the response header: “HTTP/1.1 101 Switching Protocols”
  4. I do a request and IIS Worker process hangs and never comes back OR I wait t 2-3 minutes and things are working again.

I am experiencing this in IIS Express as well. Normally I resolve this by killing the IIS Worker process and reloading. Is this a permissions issue? Currently the application pool runs under my local user, but I have tried Application Pool Identity with the same results. What should be in “HKLMSystemCurrentControlSetServicesSignalRPerformance”? Currently there is no such registry key on my machine.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

I have not seen this behavior before. Are the 20,000/s “RegOpenKey/RegQueryKey” operations lasting from 2-3 minutes continuously? Are all of these operations accessing the “HKLMSystemCurrentControlSetServicesSignalRPerformance” path?

SignalR is designed to stop further loading of performance counters after any performance counter fails to load.

Perhaps installing the SignalR performance counters will resolve your issue. This will create HKLMSystemCurrentControlSetServicesSignalRPerformance.

You will have to ensure that your application pool runs under a user in the “Performance Monitor Users” group.

Method 2

Good news! It seems that this issue is officially raised and there is a fix applied. Just wanted to share this if anyone has the same problem.

https://github.com/SignalR/SignalR/issues/3414

Apparently, problem was caused by a CultureInfo that leaked from a different AppDomain. It happens in PerformanceCounter class constructor in System.Diagnostics namespace.

See detailed analysis here: http://www.zpqrtbnk.net/posts/appdomains-threads-cultureinfos-and-paracetamol

At the time of writing a new package is not yet released, but soon fix should become available through official NuGet feed. Fix is contained in Microsoft.AspNet.SignalR.Core package.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x