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

Listener does not reconnect after a network outage #12

Open
mark-vw opened this issue Jun 18, 2019 · 7 comments
Open

Listener does not reconnect after a network outage #12

mark-vw opened this issue Jun 18, 2019 · 7 comments
Labels

Comments

@mark-vw
Copy link

mark-vw commented Jun 18, 2019

After a network outage on prem, the registration with the azure relay service is broken and does not reconnect. The listener should be able to know when the connection is broken so it can attempt to reconnect and create events related the service interruption.

@coolhome
Copy link

I have experienced this a few times before using the azure relay SDK (not the asp.net core integration).

I have been having a hard time reproducing it or pin pointing where in the code this happens.

@mark-vw
Copy link
Author

mark-vw commented Jun 18, 2019

The asp.net package includes an internal AzureRelayListener class which uses a HybridConnectionListener to connect. Since the HybridConnectionListener exposes connectivity events (Online, Connected, & Offline), these events should be exposed so that action can be taken when a listener goes offline. Otherwise, listeners will not know they have been disconnected and are unable to respond.

@coolhome
Copy link

coolhome commented Jun 18, 2019

In my instance we are using the HybridConnectionListener directly and subscribed to those events. During a network event our listener tried to reconnect several times but eventually stopped trying to reconnect all together until we forced a service restart.

We started to log the LastException that is exposed. If it happens again hopefully I will have sufficient enough information to report back on.

edit: I have not tried upgrading to 2.0.1 that was released recently

@dlstucki
Copy link
Contributor

dlstucki commented Jun 19, 2019

There have been some issues similar to this which were fixed in 2.0.0+. I'd absolutely recommend getting onto 2.0.1 before spending any more time on this issue to get all known bug fixes and the best tracing.

If you're dealing with HybridConnectionListener directly make sure you subscribe to the Connecting, Online, and Offline events, these are raised when connection status changes occur and that's when LastError actually means something.

        /// <summary>
        /// Raised when the Listener is attempting to reconnect with ServiceBus after a connection loss. 
        /// Check LastError for more details.
        /// </summary>
        public event EventHandler Connecting;

        /// <summary>
        /// Raised when the Listener has successfully connected or reconnected with ServiceBus.
        /// LastError will be null at this point.
        /// </summary>
        public event EventHandler Online;
        
        /// <summary>
        /// Raised when the Listener will no longer be attempting to recconnect with ServiceBus.
        /// Reasons include user-initiated listener close or the HybridConnection management object
        /// was deleted (e.g. via portal or ARM).
        /// Check LastError for more details when this event is raised unexpectedly.
        /// </summary>
        public event EventHandler Offline;

@mark-vw
Copy link
Author

mark-vw commented Jun 19, 2019

Microsoft.Azure.Relay.AspNetCore package is still in preview (1.1.0-preview-20180522-1) and uses Microsoft.Azure.Relay (1.1.0-preview). Are there plans to update the Microsoft.Azure.Relay.AspNetCore package to use Microsoft.Azure.Relay (2.01) and bring it out of preview?

@dlstucki
Copy link
Contributor

Microsoft.Azure.Relay.AspNetCore package is still in preview (1.1.0-preview-20180522-1) and uses Microsoft.Azure.Relay (1.1.0-preview). Are there plans to update the Microsoft.Azure.Relay.AspNetCore package to use Microsoft.Azure.Relay (2.01) and bring it out of preview?

This is now done.
https://www.nuget.org/packages/Microsoft.Azure.Relay.AspNetCore/1.2.10592

Can this issue be closed? If not, please describe where things are at.

@dlstucki dlstucki added the Relay label Nov 25, 2019
@adrosa
Copy link
Contributor

adrosa commented Feb 24, 2021

Is this issue still active?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants