Skip to content
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

Infinite wait for connection().Start().Wait() when connection.Closed event is triggered #2852

Closed
eriksundberg opened this issue Feb 3, 2014 · 3 comments

Comments

@eriksundberg
Copy link

Hi!

Background info:
OS: Windows 7
IIS: 6.1
VS: 2012
.net: 4.0
SignalR: 1.2
Barebone code-sample can be found at:
https://github.com/ekaerik/SignalRTestApp
(New to git, not sure everything is in order)

We have a issue regarding when the SignalR server goes down and the connection gets disconnected, we want to wait for the connection to start before we send new messages.

To isolate the issue we created a new solution only containing a console and web project, nothing else but bare bone. We use regular IIS for our web to have full control over the app-pool.

  1. Debug the Console application, after you see some dots in the output, stop the IIS app pool for the web project.
  2. Wait for "Closed event triggered" in console output
  3. Start app pool again
  4. BUG?: Connection does not reconnect when we wait for Start() task to finish

If you change:
SignalRTestApp.Program.Main(...) line 20 from:
connection.Start().Wait();
to:
connection.Start();

It will work as we think would be expected: When app pool starts running connection will reconnect and the Console will send stuff again.

Did we miss something obvious?

@halter73
Copy link
Member

halter73 commented Mar 4, 2014

You are hitting a deadlock caused by Connection.Start() taking the same lock held by the method that calls Connection.Closed. The workaround as you point out is to not block on Start(). You can use await or ContinueWith.

@DamianEdwards
Copy link
Member

Given the workaround provided this doesn't meet our requirements for fixing in 1.x.

@kzish
Copy link

kzish commented Aug 31, 2015

i have signalr Self host application in windows forms but i cannot enable cross domain i suspect this is the source of my problem, because my web client is connecting fine but my xamarin android client is not able to connect
please help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants