signalR client server stops working after DNS-ip record for server changed
-
I am using signalR client and service applications - both hosted as console apps. I'm interested in making the following scenario work: 1. One Service starts up at "someaddress.org" 2. Second service starts up at "172.123.2.5" 3. Client starts and creates a hub proxy to an address "someaddress.org" which points to "172.123.2.3" by the DNS server 4. Client starts to receive updates from the server 5. At some point, the server crashes and is not available anymore 6. A Health checker service detects that the service is down, and updates the DNS server to make "someaddress.org" point to "172.123.2.5" where the second (identical) service is already up At this point, the client is not able to establish connection with the new server and I'm trying to understand why and make it work. If the first service is going down and up again all is working fine, but when the DNS record changes to another server it does not work anymore. Any ideas?
-
I am using signalR client and service applications - both hosted as console apps. I'm interested in making the following scenario work: 1. One Service starts up at "someaddress.org" 2. Second service starts up at "172.123.2.5" 3. Client starts and creates a hub proxy to an address "someaddress.org" which points to "172.123.2.3" by the DNS server 4. Client starts to receive updates from the server 5. At some point, the server crashes and is not available anymore 6. A Health checker service detects that the service is down, and updates the DNS server to make "someaddress.org" point to "172.123.2.5" where the second (identical) service is already up At this point, the client is not able to establish connection with the new server and I'm trying to understand why and make it work. If the first service is going down and up again all is working fine, but when the DNS record changes to another server it does not work anymore. Any ideas?
-
I am using signalR client and service applications - both hosted as console apps. I'm interested in making the following scenario work: 1. One Service starts up at "someaddress.org" 2. Second service starts up at "172.123.2.5" 3. Client starts and creates a hub proxy to an address "someaddress.org" which points to "172.123.2.3" by the DNS server 4. Client starts to receive updates from the server 5. At some point, the server crashes and is not available anymore 6. A Health checker service detects that the service is down, and updates the DNS server to make "someaddress.org" point to "172.123.2.5" where the second (identical) service is already up At this point, the client is not able to establish connection with the new server and I'm trying to understand why and make it work. If the first service is going down and up again all is working fine, but when the DNS record changes to another server it does not work anymore. Any ideas?
Clients don't do a DNS lookup on every request. They do it one and cache the result. If the server goes down and someone changes the IP the DNS name points to, the clients are going to have to clear their DNS cache and do another lookup of the name to get the new IP. As already has been said, DNS changes take time to propagate, so if the server goes down and the clients detect it, they MAY still get the old IP address for the DNS name they have. Changing the IP address in DNS is NOT the normal way to do failover. If reliability is that important, Google for "IIS Failover Cluster" and start reading. This is far more complicated that just changing an IP address in DNS.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Clients don't do a DNS lookup on every request. They do it one and cache the result. If the server goes down and someone changes the IP the DNS name points to, the clients are going to have to clear their DNS cache and do another lookup of the name to get the new IP. As already has been said, DNS changes take time to propagate, so if the server goes down and the clients detect it, they MAY still get the old IP address for the DNS name they have. Changing the IP address in DNS is NOT the normal way to do failover. If reliability is that important, Google for "IIS Failover Cluster" and start reading. This is far more complicated that just changing an IP address in DNS.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiaki wonder if the signalR client works this way. i made a test locally - created an entry in the host file: 127.0.0.1 testaddress both the client and the server are configured to use "testaddress" as host name. when it runs, all is working well, then i change the entry to another ip address: 127.0.0.3 testaddress as expected - all is working well as the connection is still intact. now if i stop the server,wait a few seconds, then change the entry back to: 127.0.0.1 testaddress and restart the server - the connection never re-establishes - client generates errors and finally closes. these are the events raised in this scenario: hubConnection.Error - happens about 10 times hubConnection.Closed if i do the same scenario without changing the host name record (stopping the server, waiting a few seconds and restarting it), it returns to working well even if i wait a longer time - these are the events raised from the client in this case: hubConnection.Error - happens a few times until i start the server again and then hubConnection.Reconnecting hubConnection.Reconnected
-
Does the client recognise that the server has gone down and do a new DNS lookup? Also updates to DNS servers can take some time to proliferate through the system.
-
i wonder if the signalR client works this way. i made a test locally - created an entry in the host file: 127.0.0.1 testaddress both the client and the server are configured to use "testaddress" as host name. when it runs, all is working well, then i change the entry to another ip address: 127.0.0.3 testaddress as expected - all is working well as the connection is still intact. now if i stop the server,wait a few seconds, then change the entry back to: 127.0.0.1 testaddress and restart the server - the connection never re-establishes - client generates errors and finally closes. these are the events raised in this scenario: hubConnection.Error - happens about 10 times hubConnection.Closed if i do the same scenario without changing the host name record (stopping the server, waiting a few seconds and restarting it), it returns to working well even if i wait a longer time - these are the events raised from the client in this case: hubConnection.Error - happens a few times until i start the server again and then hubConnection.Reconnecting hubConnection.Reconnected
Yeah, that doesn't replicate what happens with an actual DNS entry. It's not the SignalR client that handles the resolution and caching of the IP address from the host name. It's the TCP/IP stack that does it.
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak