Skip to content

Conversation

@BrennanConroy
Copy link
Member

@BrennanConroy BrennanConroy commented Apr 11, 2022

If the Redis connection hasn't been established yet the _bus variable wont be initialized. Normally this is fine, but if a connection comes in and the redis connection throws then you can get a null-ref when OnDisconnectedAsync is called.

Additionally, adding logging for if the connection attempt throws.

Likely fixes #41104

@BrennanConroy BrennanConroy added the area-signalr Includes: SignalR clients and servers label Apr 11, 2022
@BrennanConroy BrennanConroy added this to the 7.0-preview4 milestone Apr 11, 2022
@BrennanConroy BrennanConroy requested a review from halter73 as a code owner April 11, 2022 22:52
@BrennanConroy BrennanConroy requested review from halter73 and removed request for halter73 May 31, 2022 23:40
@BrennanConroy
Copy link
Member Author

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 3 pipeline(s).

Assert.Equal("Error connecting to Redis.", logs[0].Message);
Assert.Equal("throw from connect", logs[0].Exception.Message);
Assert.Equal("Error connecting to Redis.", logs[1].Message);
Assert.Equal("throw from connect", logs[1].Exception.Message);
Copy link
Member

@halter73 halter73 Jun 1, 2022

Choose a reason for hiding this comment

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

Do we really want to repeat this log every time a client connects or any time the app tries to publish a message? Would it be better to use a flag to see if we've already logged ErrorConnecting and not log again? I think the first error should be sufficient in most cases. And we're rethrowing in a way that the app and/or server can observe it except in the constructor which would throw the first exception which we'd still log anyway.

Copy link
Member Author

@BrennanConroy BrennanConroy Jun 1, 2022

Choose a reason for hiding this comment

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

Hmm good point. Although should we then unset the flag if the connection goes down again so it relogs?

Edit: Nvm, we have events for those

@BrennanConroy BrennanConroy merged commit 11ac90e into main Jun 1, 2022
@BrennanConroy BrennanConroy deleted the brecon/rediserror branch June 1, 2022 23:09
@ghost ghost modified the milestones: 7.0-preview4, 7.0-preview6 Jun 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-signalr Includes: SignalR clients and servers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RedisHubLifetimeManager OnDisconnectedAsync Exception

3 participants