Skip to content

JS Client - No transport can be initialized if /start takes too long to complete #3104

@halter73

Description

@halter73

Functional impact

  • If a /start request takes ~5 seconds or more to complete with the default TransportConnectTimeout of 5 seconds, no transport will be able successfully initialize causing the JS client to be unable to connect. Long-running /start requests can be caused by long-running OnConnected methods.

Minimal repro steps

  • Install SignalR 2.1.0
  • Create a PersistentConnection or Hub with an OnConnected method that takes 5 seconds or more to complete.
  • Try to connect to the PersistentConnection or Hub with the JS client.

Expected result

  • After the appropriate 5 second delay, the JS client should connect to the server.
  • If the /start request does time out, the JS client shouldn't attempt to fall back to other transports.

Actual result

  • The JS client attempts to establish a connection with every available transport, but each attempt fails. Here is an example log:
"[09:18:30 GMT+0200] SignalR: Client subscribed to hub 'linkhub'." jquery.signalR-2.1.0.js:81
"[09:18:30 GMT+0200] SignalR: Negotiating with '/signalr/negotiate?clientProtocol=1.4&connectionData=%5B%7B%22name%22%3A%22linkhub%22%7D%5D'." jquery.signalR-2.1.0.js:81
"[09:18:30 GMT+0200] SignalR: Connecting to websocket endpoint 'ws://localhost:51369/signalr/connect?transport=webSockets&clientProtocol=1.4&connectionToken=bEf3FK30zNYsImb%2FLPNrVTD5ToKe4cIVEL2%2BIhk5L%2BYDYdVxf49Q1%2Bn%2F24tXMd6%2BWXi4iqAA0a3eE6AgbHvkwR0tOfQPAwMltoV5pi9tv7m8n30c7XtCt2aOy1K9umcs&connectionData=%5B%7B%22name%22%3A%22linkhub%22%7D%5D&tid=9'." jquery.signalR-2.1.0.js:81
"[09:18:30 GMT+0200] SignalR: Websocket opened." jquery.signalR-2.1.0.js:81
"[09:18:35 GMT+0200] SignalR: webSockets timed out when trying to connect." jquery.signalR-2.1.0.js:81
"[09:18:35 GMT+0200] SignalR: Closing the Websocket." jquery.signalR-2.1.0.js:81
"[09:18:35 GMT+0200] SignalR: Attempting to connect to SSE endpoint 'http://localhost:51369/signalr/connect?transport=serverSentEvents&clientProtocol=1.4&connectionToken=bEf3FK30zNYsImb%2FLPNrVTD5ToKe4cIVEL2%2BIhk5L%2BYDYdVxf49Q1%2Bn%2F24tXMd6%2BWXi4iqAA0a3eE6AgbHvkwR0tOfQPAwMltoV5pi9tv7m8n30c7XtCt2aOy1K9umcs&connectionData=%5B%7B%22name%22%3A%22linkhub%22%7D%5D&tid=8'." jquery.signalR-2.1.0.js:81
"[09:18:35 GMT+0200] SignalR: EventSource connected." jquery.signalR-2.1.0.js:81
"[09:18:40 GMT+0200] SignalR: serverSentEvents timed out when trying to connect." jquery.signalR-2.1.0.js:81
"[09:18:40 GMT+0200] SignalR: EventSource calling close()." jquery.signalR-2.1.0.js:81
"[09:18:40 GMT+0200] SignalR: This browser supports SSE, skipping Forever Frame." jquery.signalR-2.1.0.js:81
"[09:18:41 GMT+0200] SignalR: Opening long polling request to 'http://localhost:51369/signalr/connect?transport=longPolling&clientProtocol=1.4&connectionToken=bEf3FK30zNYsImb%2FLPNrVTD5ToKe4cIVEL2%2BIhk5L%2BYDYdVxf49Q1%2Bn%2F24tXMd6%2BWXi4iqAA0a3eE6AgbHvkwR0tOfQPAwMltoV5pi9tv7m8n30c7XtCt2aOy1K9umcs&connectionData=%5B%7B%22name%22%3A%22linkhub%22%7D%5D&tid=0'." jquery.signalR-2.1.0.js:81
"[09:18:41 GMT+0200] SignalR: Long poll complete." jquery.signalR-2.1.0.js:81
"[09:18:41 GMT+0200] SignalR: Opening long polling request to 'http://localhost:51369/signalr/poll?transport=longPolling&messageId=d-7E8B67B1-A%2C0%7CB%2C0%7CC%2C0%7CD%2C3%7CE%2C0&clientProtocol=1.4&connectionToken=bEf3FK30zNYsImb%2FLPNrVTD5ToKe4cIVEL2%2BIhk5L%2BYDYdVxf49Q1%2Bn%2F24tXMd6%2BWXi4iqAA0a3eE6AgbHvkwR0tOfQPAwMltoV5pi9tv7m8n30c7XtCt2aOy1K9umcs&connectionData=%5B%7B%22name%22%3A%22linkhub%22%7D%5D&tid=6'." jquery.signalR-2.1.0.js:81
"[09:18:45 GMT+0200] SignalR: longPolling timed out when trying to connect." jquery.signalR-2.1.0.js:81
"[09:18:45 GMT+0200] SignalR: Aborted xhr request." jquery.signalR-2.1.0.js:81
"[09:18:45 GMT+0200] SignalR: Stopping connection." jquery.signalR-2.1.0.js:81
"[09:18:45 GMT+0200] SignalR: Fired ajax abort async = true."

This issue was originally reported on the ASP.NET forums.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions