Skip to content

Add troubleshooting page for SignalR#20125

Merged
Rick-Anderson merged 6 commits intomasterfrom
brecon/trouble
Oct 21, 2020
Merged

Add troubleshooting page for SignalR#20125
Rick-Anderson merged 6 commits intomasterfrom
brecon/trouble

Conversation

@BrennanConroy
Copy link
Copy Markdown
Member

@BrennanConroy BrennanConroy commented Oct 6, 2020

#20063

Needs some cleanup.

This is definitely missing some common scenarios. Don't need to get them all in this first pass.

@Rick-Anderson edit
Internal review URL


## Troubleshoot WebSocket handshake errors

This section provides help on the *"Error during WebSocket handshake"* exception that occurs when trying to establish connection to ASP.NET Core SignalR hub.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need quotes AND stars? One or the other seems like enough.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted that 😛

Comment thread aspnetcore/signalr/troubleshoot.md Outdated
WebSocket connection to 'wss://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 404
```

* If the connection takes too long to send a request to the server after the negotiate the server will delete the ID and return a 404 if the connection uses that ID
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Copy Markdown
Contributor

@Rick-Anderson Rick-Anderson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@FredHan001 FYI, this should hlep.

Comment thread aspnetcore/signalr/troubleshoot.md Outdated
Comment thread aspnetcore/signalr/troubleshoot.md Outdated
Comment thread aspnetcore/signalr/troubleshoot.md Outdated
Comment thread aspnetcore/signalr/troubleshoot.md Outdated
Comment thread aspnetcore/signalr/troubleshoot.md Outdated
@Rick-Anderson
Copy link
Copy Markdown
Contributor

@FredHan001 FYI

Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
@Rick-Anderson
Copy link
Copy Markdown
Contributor

@BrennanConroy let me know what's need to get this merged. Great info, thanks.

@BrennanConroy
Copy link
Copy Markdown
Member Author

I guess it needs author to be filled in to get rid of the warnings

@Rick-Anderson
Copy link
Copy Markdown
Contributor

image

Comment thread aspnetcore/signalr/javascript-client.md
Comment thread aspnetcore/signalr/troubleshoot.md Outdated
* If the connection uses the ID and takes too long to send a request to the server after the negotiate, the server:

* Deletes the ID.
* Returns a 404.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is probably the least common cause of a 404, don't you think? I would probably order the bullet points with bad path first, no sticky session second and this last.

WebSocket connection to 'ws://xxx/HubName' failed: Error during WebSocket handshake: Unexpected response code: 307
```

This error can also happen during the negotiate request.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do any of the HTTP clients and/or WebSocket clients SignalR uses not follow 307 redirects? I just searched the aspnetcore repo for "SignalR 307" (without quotes) and came up with no reports of an issue like that.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found it: https://stackoverflow.com/questions/63437471/websocket-connection-to-ws-localhost5000-notificationhub-failed-error-duri. I'm still not sure that this could "happen during the negotiate request." Do you have evidence of that?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I point out one possible cause below

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see it. Why would a 307 break the negotiate request itself?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we don't follow redirects

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. Why? Because we assume it will break WebSockets?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I'm not sure. I thought it was because auth handlers often redirect instead of returning 401, but we set a header to try and avoid that...

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@Rick-Anderson I see your screenshot with the suggested pending changes to add @bradygaster as an author to this doc. Did you mean to submit a new review with those suggestion?

No, I made a bunch of suggestions, most were accepted. We can't merge this without the author meta-data. These are my suggestions, if you agree, I'll add them.

Comment thread aspnetcore/signalr/troubleshoot.md Outdated
Comment thread aspnetcore/signalr/troubleshoot.md Outdated
@Rick-Anderson
Copy link
Copy Markdown
Contributor

The following needs to be added:

Q: Customer would like to know on the server the reason of the disconnection. However the exception parameter of the OnDisconnectedAsync seems to be always null:
public override async Task OnDisconnectedAsync(Exception exception)

A: I suspect you're right that there was some sort of network issue. If the connection closes between SignalR messages, the server may interpret that as an unexceptional client disconnect. I filed dotnet/aspnetcore#26701 to track the issue of not passing an Exception to Hub.OnDisconnectedAsync in this case.

BrennanConroy and others added 2 commits October 20, 2020 10:17
Co-authored-by: Rick Anderson <3605364+Rick-Anderson@users.noreply.github.com>
@BrennanConroy
Copy link
Copy Markdown
Member Author

The following needs to be added:

Q: Customer would like to know on the server the reason of the disconnection. However the exception parameter of the OnDisconnectedAsync seems to be always null:
public override async Task OnDisconnectedAsync(Exception exception)

A: I suspect you're right that there was some sort of network issue. If the connection closes between SignalR messages, the server may interpret that as an unexceptional client disconnect. I filed dotnet/aspnetcore#26701 to track the issue of not passing an Exception to Hub.OnDisconnectedAsync in this case.

I don't know what kind of wording we want in the doc for something like this.

@bradygaster
Copy link
Copy Markdown
Member

Whilst not very friendly, I think the statement

If the connection closes between SignalR messages, the server may interpret that as an unexceptional client disconnect.

Sums it up concisely. That said, i'd love some wordsmithery by @Rick-Anderson

@Rick-Anderson
Copy link
Copy Markdown
Contributor

If the connection closes between SignalR messages, the server may interpret that as an unexceptional client disconnect.

That's clear to me.

@BrennanConroy
Copy link
Copy Markdown
Member Author

If the connection closes between SignalR messages, the server may interpret that as an unexceptional client disconnect.

That's clear to me.

Sure it's clear, but it doesn't mean anything. If we rephrase it a little it's equivalent to: "If the client closes the connection, it could be a graceful or ungraceful disconnect."

@Rick-Anderson
Copy link
Copy Markdown
Contributor

Rick-Anderson commented Oct 20, 2020

@BrennanConroy I see your point. How about:

Transient network failures may close the connection between SignalR messages. The server may interpret the closed connection as an unexceptional client disconnect. For more information, see this GitHub issue.

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@BrennanConroy added
For more information, see this GitHub issue.

What I have is pretty incomplete, but the issue fleshes it out and we might get feedback on the issue.

@Rick-Anderson
Copy link
Copy Markdown
Contributor

@BrennanConroy let me know when I can merge this.

@BrennanConroy
Copy link
Copy Markdown
Member Author

Lets wait till middle of the day tomorrow to give folks some time to take a look

@bradygaster
Copy link
Copy Markdown
Member

LGTM

@BrennanConroy
Copy link
Copy Markdown
Member Author

Ok, think it's good to go

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

Successfully merging this pull request may close these issues.

4 participants