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

LongPolling transport fails to timeout on reconnect #301

Open
1 task
joeldart opened this issue Nov 29, 2018 · 1 comment
Open
1 task

LongPolling transport fails to timeout on reconnect #301

joeldart opened this issue Nov 29, 2018 · 1 comment

Comments

@joeldart
Copy link
Member

Description

Once you have a connection set up for LongPolling, if we error out, we attempt to reconnect by design. The challenge with longPolling is that to determine we reconnected, we have no initialized indication like in serverSentEvents. This leads to 3 places you would evaluate "reconnected": connection succeeded, connection failed, connection still running. https://github.com/DyKnow/SignalR-ObjC/blob/feature-dev/SignalR.Client/Transports/SRLongPollingTransport.m#L99 currently is designed to handle connection still running, but the current passed-around nsnumber is not accurately updating. Instead, we should store this callback and cancel it on connection succceeded and connection failed.

The current problem is if the connection is immediately terminated or has an error, Signalr-ObjC will continue on in this retry loop as if it was simply intermittent communication issues. This does not happen in other clients.

Replication Steps

Note: you will have to setup fiddler on your mac or setup a network proxy to run through fiddler on a pc

  1. Create but do not initialize a fiddler rule to either terminate connection or return 503:
	public static RulesOption("Kill websocket")
	BindPref("fiddlerscript.rules.KillWS")
	var m_KillWS: boolean = false;
		
	public static RulesOption("Kill ServerSentEvents")
	BindPref("fiddlerscript.rules.KillSSE")
	var m_KillSSE: boolean = false;
		
	public static RulesOption("Kill LongPolling")
	BindPref("fiddlerscript.rules.KillLP")
	var m_KillLP: boolean = false;
...
	if (((m_KillWS && oSession.RequestHeaders.RequestPath.IndexOf("transport=webSockets") !== -1) ||
			(m_KillSSE && oSession.RequestHeaders.RequestPath.IndexOf("transport=serverSentEvents") !== -1) ||
			(m_KillLP && oSession.RequestHeaders.RequestPath.IndexOf("transport=longPolling") !== -1)) &&
			oSession.RequestHeaders.RequestPath.IndexOf("negotiate") === -1 //let negotiates through
		){
                 //note you cannot have both of these
		//	oSession.oRequest.pipeClient.EndWithRST();//<-- will kill connection
			oSession.oRequest.FailSession(503, "503", "This was a 503");<-- will sent a 503
			return;
		}
  1. Start connection and verify it uses longPolling (note, you might want to turn on KillSSE to force this)
  2. Turn on fiddler rule to kill long polling
  3. in fiddler, find the longPolling connect (or poll, depending), right click, terminate
  4. see how it continuously reconnects and never hits a reconnect timeout

Dev Requirements

  • use an nsblockoperation and the same incremental timeout strategy used in js client

Fixed In

Testing

joeldart added a commit that referenced this issue Nov 29, 2018
- the bool was not always catching our reconnect and was a little more difficult to track what was going on. Instead store the blockoperation and cancel in the right places
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

2 participants
@joeldart and others