-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exception on browser close #3358
Comments
Has anyone got any fix or workaround for this ? |
This issue has been closed as part of issue clean-up as described in https://blogs.msdn.microsoft.com/webdev/2018/09/17/the-future-of-asp-net-signalr/. If you're still encountering this problem, please feel free to re-open and comment to let us know! We're still interested in hearing from you, the backlog just got a little big and we had to do a bulk clean up to get back on top of things. Thanks for your continued feedback! |
Last I recall, this issue was a wont fix and by design. THIS ISSUE is why I don't use SignalR. |
Unfortunately this issue is beyond SignalR's control since it is coming from the ASP.NET hosting infrastructure. The underlying TCP connection is being closed by the browser while SignalR is in the middle of invoking a method so the exception occurs. Browsers don't provide us a way to guarantee the connection stays open (they don't want JavaScript to be able to hold on to resources after the page is unloaded) so the browser forcibly closes the connection and triggers this exception on the server. |
Then don't host it in ASP.NET.
…On Thu, Sep 20, 2018, 6:50 PM Andrew Stanton-Nurse ***@***.***> wrote:
Unfortunately this issue is beyond SignalR's control since it is coming
from the ASP.NET hosting infrastructure. The underlying TCP connection is
being closed by the browser while SignalR is in the middle of invoking a
method so the exception occurs. Browsers don't provide us a way to
guarantee the connection stays open (they don't want JavaScript to be able
to hold on to resources after the page is unloaded) so the browser forcibly
closes the connection and triggers this exception on the server.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3358 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbT_RevVOqTwHX575PiWhDmE7xTZY4cks5udBungaJpZM4DEvna>
.
|
You're welcome to not host your app on ASP.NET, SignalR supports Owin self-host just fine. |
Does the exception on browser close behavior change if you change the host?
…On Fri, Sep 21, 2018 at 12:12 PM Andrew Stanton-Nurse < ***@***.***> wrote:
You're welcome to not host your app on ASP.NET, SignalR supports Owin
self-host just fine.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#3358 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbT_fzB2XbZyH_naP2Ys2j1wmTwIO2Oks5udQ_ogaJpZM4DEvna>
.
|
It would depend on the host's behavior when the underlying TCP connection is terminated. SignalR doesn't have any control over that behavior. What's the goal you're trying to achieve here? Just suppressing the exception? |
To be clear, SignalR isn't really in control of the events that trigger this exception. Calling |
Hey guys, as I have already found one sibling who was facing same issue and i posted there.
(#2804)
Since it was closed thread I am putting it here to bring it to the notice and could get more information. Here are the details.
We have setup SignalR (2.1.1) server and client in 2 different virtual directories on IIS. We are hosting them on Amazon servers that also configured with ELB (load balancing)
Our requirement is : When user close or refresh the browser/tab then we need to make a hub call to notify server and back to back 2nd call to stop its current hub. ie. this line : $.connection.hub.stop();
We have keep both calls as follows:
window.onbeforeunload = function (e) {
if (!isCloseAppInvoked) { InvokeCloseApp(); }
return undefined; //To avoid native js message that asks "Are you sure you want to leave this page" };
function onBeforeUnload_Success(response) { $.connection.hub.stop(); }
function onBeforeUnload_Error(response) { }
Now, the scenario is- Referring the same closed post - If we remove window.onbeforeunload from respective pages, we don't see any instance of exception. We have confirmed this in many test cycles. Also we see these in chrome and firefox also regardless IE.
And as we re-enable this, we get following exceptions.
Global.asax.cs:: Application_Error() :: System.Web.HttpException
The client disconnected.
at System.Web.Hosting.IIS7WorkerRequest.EndRead(IAsyncResult asyncResult)
at System.Web.HttpBufferlessInputStream.EndRead(IAsyncResult asyncResult)
at System.IO.Stream.b__e(Stream stream, IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory
1.FromAsyncTrimPromise
1.Complete(TInstance thisRef, Func`3 endMethod, IAsyncResult asyncResult, Boolean requiresSynchronization)--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.IO.StreamReader.d__28.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at System.IO.StreamReader.d__19.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.OwinRequest.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.SignalR.Owin.ServerRequest.d__3.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.AspNet.SignalR.Transports.LongPollingTransport.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Owin.Mapping.MapMiddleware.d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.StageAsyncResult.End(IAsyncResult ar)
at Microsoft.Owin.Host.SystemWeb.IntegratedPipeline.IntegratedPipelineContext.EndFinalWork(IAsyncResult ar)
at System.Web.HttpApplication.AsyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
/beastappscore/signalr/send?transport=longPolling&clientProtocol=1.4&connectionToken=tB9RjeQKi3ZQVa%2FaoJQeWvYoAykSJGi4vWvWAm5VRBGQjYp5bj4IEI2je%2FVqDzMJpnuTI614AGnVAyJz1HOrEZARVK0vuhpPkama%2B6Ebq9DuOSAgZI8gV3ZU2UECkvKI&connectionData=%5B%7B%22name%22%3A%22marketdatahub%22%7D%5D
Please let us know your thoughts. We are more happy to give you further configuration details whatever you want.
Thanks in advance..
The text was updated successfully, but these errors were encountered: