IE 10 Web Sockets Security Error when simultaneous connection limit reached #1744

Closed
dangreendotnet opened this Issue Mar 23, 2013 · 7 comments

Comments

Projects
None yet
6 participants
@dangreendotnet

I have found that when using websockets IE 10 throws SCRIPT5022: SecurityError if more that 6 pages with signalr are opened using window.open().

If you click the open new window button on the Default.aspx page the 7th SignalrPage.aspx page will throw the error.
If you just load the SignalrPage.aspx page in new windows, you can open as many windows as you want without error.

I have created a repo project and tested this on windows server 2012 and IE 10 on the same server.

Here is a link to my repo project
https://skydrive.live.com/redir?resid=453C883288932B34!7350

@davidfowl

This comment has been minimized.

Show comment Hide comment
@davidfowl

davidfowl Mar 24, 2013

Member

This might be a browser issue. Does it only happen in IE? Does it happen without SignalR and just 7 normal a websocket connections?

Member

davidfowl commented Mar 24, 2013

This might be a browser issue. Does it only happen in IE? Does it happen without SignalR and just 7 normal a websocket connections?

@dangreendotnet

This comment has been minimized.

Show comment Hide comment
@dangreendotnet

dangreendotnet Mar 25, 2013

It only happens in IE 10, I did not test it outside of signalr, the issue is that when IE 10 throws this error signalr does not handle it and stops connecting, it should fall back to another connection method if web sockets fail.

It only happens in IE 10, I did not test it outside of signalr, the issue is that when IE 10 throws this error signalr does not handle it and stops connecting, it should fall back to another connection method if web sockets fail.

@dangreendotnet

This comment has been minimized.

Show comment Hide comment
@dangreendotnet

dangreendotnet Mar 28, 2013

I fixed my local copy by wrapping the web socket connection logic in a try catch, if i had more time I would submit it.

                try {
                    connection.log("Connecting to websocket endpoint '" + url + "'");
                    connection.socket = new window.WebSocket(url);
                    connection.socket.ID = ++that.currentSocketID;
                    connection.socket.onopen = function () {
                        opened = true;
                        connection.log("Websocket opened");

                        if (that.attemptingReconnect) {
                            that.attemptingReconnect = false;
                        }

                        if (onSuccess) {
                            onSuccess();
                        } else if (changeState(connection,
                                             signalR.connectionState.reconnecting,
                                             signalR.connectionState.connected) === true) {
                            $connection.triggerHandler(events.onReconnect);
                        }
                    };
                }
                catch (e) {
                    connection.log("Websocket failed trying to connect with error " + e.Message);
                    if (onFailed) {
                        // The connection failed, call the failed callback
                        onFailed();
                    }
                    else {
                        $connection.triggerHandler(events.onError, [e]);
                        if (reconnecting) {
                            // If we were reconnecting, rather than doing initial connect, then try reconnect again
                            that.reconnect(connection);
                        }
                    }
                    return;
                } 

I fixed my local copy by wrapping the web socket connection logic in a try catch, if i had more time I would submit it.

                try {
                    connection.log("Connecting to websocket endpoint '" + url + "'");
                    connection.socket = new window.WebSocket(url);
                    connection.socket.ID = ++that.currentSocketID;
                    connection.socket.onopen = function () {
                        opened = true;
                        connection.log("Websocket opened");

                        if (that.attemptingReconnect) {
                            that.attemptingReconnect = false;
                        }

                        if (onSuccess) {
                            onSuccess();
                        } else if (changeState(connection,
                                             signalR.connectionState.reconnecting,
                                             signalR.connectionState.connected) === true) {
                            $connection.triggerHandler(events.onReconnect);
                        }
                    };
                }
                catch (e) {
                    connection.log("Websocket failed trying to connect with error " + e.Message);
                    if (onFailed) {
                        // The connection failed, call the failed callback
                        onFailed();
                    }
                    else {
                        $connection.triggerHandler(events.onError, [e]);
                        if (reconnecting) {
                            // If we were reconnecting, rather than doing initial connect, then try reconnect again
                            that.reconnect(connection);
                        }
                    }
                    return;
                } 
@davidfowl

This comment has been minimized.

Show comment Hide comment
@davidfowl

davidfowl Mar 29, 2013

Member

@dangreendotnet so if yo catch the error it falls back to foreverframe and works?

Member

davidfowl commented Mar 29, 2013

@dangreendotnet so if yo catch the error it falls back to foreverframe and works?

@dangreendotnet

This comment has been minimized.

Show comment Hide comment
@dangreendotnet

dangreendotnet Mar 29, 2013

yes

@ghost ghost assigned NTaylorMullen May 22, 2013

@DamianEdwards

This comment has been minimized.

Show comment Hide comment
@DamianEdwards

DamianEdwards May 22, 2013

Member

Looks like we need to add a simple try/catch around our websocket creation logic

Member

DamianEdwards commented May 22, 2013

Looks like we need to add a simple try/catch around our websocket creation logic

NTaylorMullen added a commit that referenced this issue Jun 4, 2013

Added tests to verify catching of Security Error in IE10 with web soc…
…kets.

- Also expanded network mock library to allow disabling and enabling of the library.  Needed to be done in order to test security errors within the main JS library.

#1744

NTaylorMullen added a commit that referenced this issue Jun 4, 2013

Added tests to verify catching of Security Error in IE10 with web soc…
…kets.

- Also expanded network mock library to allow disabling and enabling of the library.  Needed to be done in order to test security errors within the main JS library.

#1744

NTaylorMullen added a commit that referenced this issue Jun 7, 2013

Added tests to verify catching of Security Error in IE10 with web soc…
…kets.

- Also expanded network mock library to allow disabling and enabling of the library.  Needed to be done in order to test security errors within the main JS library.

#1744

@ghost ghost assigned muratg Jun 7, 2013

@ghost ghost assigned Xiaohongt Jun 17, 2013

@Xiaohongt

This comment has been minimized.

Show comment Hide comment
@Xiaohongt

Xiaohongt Jun 20, 2013

Contributor

verified

Contributor

Xiaohongt commented Jun 20, 2013

verified

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment