调试SignalR挂起 [英] Debugging SignalR hang

查看:205
本文介绍了调试SignalR挂起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Windows 7,SignalR2。

Windows 7, SignalR2.

我有一些HelloWorld SignalR代码适用于一个VS2013项目(即我的SignalR hello world playground)。

I have some HelloWorld SignalR code that works in one VS2013 project (Ie, my SignalR hello world playground).

当我将相同的代码添加到现有应用程序时,SignalR线程在永久中挂起在IIS中。这种情况每次都会发生。

When I add the same code to an existing application, SignalR threads "hang" in IIS "forever". This happens every single time.

我的SignalR控制台看起来像:

My SignalR console looks like:

我的perfMon计数器如下所示:

My perfMon counters look like this:

我的工作进程列表如下所示:

My worker process list looks like:

我正在寻找一些关于从哪里开始调试的技巧。在Java中,我会接受一个线程转储,我可以很容易地看到发生了什么。

I'm after some tips on where to start debugging. In Java, I would take a thread dump and I could see what is going on fairly easily.

当作为调试器连接时,这些线程在VS2013中不可见。

These threads are not visible in VS2013 when attached as a debugger.

在IIS / DotNet中似乎没有等价物?

There does not seem to be an equivalent in IIS/DotNet?

这是我的中心:

 public class Ep1DataImportHub : Hub
{
     public int recordsToBeProcessed = 100000;

        public void DoLongOperation()
        {
            for (int record = 0; record <= recordsToBeProcessed; record++)
            {
                if (ShouldNotifyClient(record))
                {
                    Clients.Caller.sendMessage(string.Format
                    ("Processing item {0} of {1}", record, recordsToBeProcessed));
                    Thread.Sleep(10);
                }
            }
        }

        private static bool ShouldNotifyClient(int record)
        {
            return record % 10 == 0;
        }
    }  

这是我的客户端,被截断为最简单的挂起方案。

Here is my client, truncated to the simplest hanging scenario.

$(function () {


    // Initialize the connection to the server
    var realtimeNotifier = $.connection.ep1DataImportHub;
    $.connection.hub.logging = true;
    $.connection.hub.start();
})

有很多关于带有SignalR 1的IIS中的SignalR挂起,但我使用的是SignalR 2。

There is lots of about SignalR hangs in IIS with SignalR 1, but I'm using SignalR 2.

有人可以告诉我如何开始调试正在进行的操作。这个工具看起来很有趣,但我不知道它是什么 https://github.com/SignalR / SignalR / issues / 1335 https://github.com/SignalR/SignalR / issues / 1335

Can someone please tell me how to start debugging what is going on. This tool looks interesting, but I have no idea what it is https://github.com/SignalR/SignalR/issues/1335 (https://github.com/SignalR/SignalR/issues/1335)

这是其中一个卡住线程的托管调用堆栈

Here is the Managed call stack of one of the stuck threads

System_Web_ni!DomainNeutralILStubClass.IL_STUB_PInvoke(IntPtr, Boolean, Boolean ByRef)+8f 
[[InlinedCallFrame] (System.Web.Hosting.UnsafeIISMethods.MgdExplicitFlush)] System.Web.Hosting.UnsafeIISMethods.MgdExplicitFlush(IntPtr, Boolean, BooleanByRef) 
System_Web_ni!System.Web.Hosting.IIS7WorkerRequest.ExplicitFlush()+20 
System_Web_ni!System.Web.HttpResponse.Flush(Boolean, Boolean)+c3 
System_Web_ni!System.Web.HttpWriter.WriteFromStream(Byte[], Int32, Int32)+a0 
Microsoft.Owin.Host.SystemWeb.CallStreams.DelegatingStream.Write(Byte[], Int32, Int32)+3a 
Microsoft.Owin.Host.SystemWeb.CallStreams.OutputStream.Write(Byte[], Int32, Int32)+3b 
Microsoft.AspNet.SignalR.Owin.ServerResponse.Write(System.ArraySegment`1)+24 
Microsoft.AspNet.SignalR.Hosting.ResponseExtensions.End(Microsoft.AspNet.SignalR.Hosting.IResponse, System.String)+c8 
Microsoft.AspNet.SignalR.PersistentConnection+d__f.MoveNext()+180 
mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+285 
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+9 
mscorlib_ni!System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()+a4 
System_Web_ni!System.Web.Util.SynchronizationHelper.SafeWrapCallback(System.Action)+b4 
mscorlib_ni!System.Threading.Tasks.Task.Execute()+6e 
mscorlib_ni!System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+285 
mscorlib_ni!System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)+9 
mscorlib_ni!System.Threading.Tasks.Task.ExecuteWithThreadLocal(System.Threading.Tasks.Task ByRef)+250 
mscorlib_ni!System.Threading.Tasks.Task.ExecuteEntry(Boolean)+85 
mscorlib_ni!System.Threading.ThreadPoolWorkQueue.Dispatch()+1ea 
[[DebuggerU2MCatchHandlerFrame]] 
[[ContextTransitionFrame]] 
[[DebuggerU2MCatchHandlerFrame]] 


推荐答案

你碰巧有一个 Application_PreSendRequestHeaders 方法已定义或您是否以其他方式附加到 HttpApplication.PreSendRequestHeaders 事件?

Do you happen to have an Application_PreSendRequestHeaders method defined or are you in some other way attached to the HttpApplication.PreSendRequestHeaders event?

我问,因为这似乎是报道的同一个问题这里。对于该线程中的至少一些人,删除PreSendRequestHeaders事件处理程序解决了该问题。

I ask, because this seems to be the same issue reported here. For at least some people on that thread, removing the PreSendRequestHeaders event handler resolved the issue.

当我们建议你永远不要使用PreSendRequestHeaders事件,我们正积极处理此问题,以便我们解决问题对于2.1.1。

While we recommend you never use the PreSendRequestHeaders event, we are actively working on this issue so we can get a fix out for 2.1.1.

如果您没有附加PreSendRequestHeaders事件,我们(SignalR团队)可以使用您的帮帮我。到目前为止,我们无法在不附加PreSendRequestHeaders事件的情况下重现此问题。如果您可以向我们提供不附加到此活动的应用程序,但仍然以这种方式挂起,我们将非常感谢。

If you are not attaching to the PreSendRequestHeaders event, we (the SignalR team) could use your help. So far, we have not been able to reproduce this issue without attaching to the PreSendRequestHeaders event. If you could provide us with an application that doesn't attach to this event, yet still hangs in this manner, we would greatly appreciate it.

SignalR的早期版本(2.0.3),没有向/ signalr / start发出请求,也没有遇到此挂起。因此,您可以通过将SignalR 2.1.0降级到2.0.3直到2.1.1发布来暂时解决此问题。

The previous version of SignalR (2.0.3), did not make requests to /signalr/start and does not experience this hang. So you can temporarily work around this issue by downgrading from SignalR 2.1.0 to 2.0.3 until 2.1.1 is released.

这篇关于调试SignalR挂起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆