Hey team! Thanks for the amazing library first of all!
Recently I’ve encountered with this exception, using latest version of Hangfire.Pro.Redis:
2024-07-29 11:03:09 [08:03:09 ERR] Couldn't connect to Redis server(s) 'redis:6379', will reconnect in -24.20:31:23.6480000
2024-07-29 11:03:09 System.Net.Internals.SocketExceptionFactory+ExtendedSocketException (00000005, 0xFFFDFFFF): Name or service not known
2024-07-29 11:03:09 at System.Net.Dns.GetHostEntryOrAddressesCore(String hostName, Boolean justAddresses, AddressFamily addressFamily, ValueStopwatch stopwatch)
2024-07-29 11:03:09 at System.Net.Dns.GetHostAddresses(String hostNameOrAddress, AddressFamily family)
2024-07-29 11:03:09 at StackExchange.Redis.SocketManager.BeginConnect(EndPoint endpoint, ISocketCallback callback, ConnectionMultiplexer multiplexer, Action`1 log)
2024-07-29 11:03:09 at StackExchange.Redis.PhysicalConnection.BeginConnect(Action`1 log)
2024-07-29 11:03:09 at StackExchange.Redis.PhysicalBridge.GetConnection(Action`1 log)
2024-07-29 11:03:09 at StackExchange.Redis.ServerEndPoint.CreateBridge(ConnectionType type, Action`1 log)
2024-07-29 11:03:09 at StackExchange.Redis.ServerEndPoint..ctor(ConnectionMultiplexer multiplexer, EndPoint endpoint, Action`1 log)
2024-07-29 11:03:09 at StackExchange.Redis.ConnectionMultiplexer.Reconfigure(Boolean first, Boolean reconfigureAll, Action`1 log, EndPoint blame, String cause, Boolean publishReconfigure, CommandFlags publishReconfigureFlags)
2024-07-29 11:03:09 at StackExchange.Redis.ConnectionMultiplexer.ConnectImpl(Func`1 multiplexerFactory, Action`1 log)
2024-07-29 11:03:09 at Hangfire.Pro.Redis.RedisStorage.CreateMultiplexer(EventWaitHandle reconnectEvent)
2024-07-29 11:03:09 at Hangfire.Pro.Redis.RedisStorage.ConnectLoop()
2024-07-29 11:03:09 [08:03:09 FTL] Unexpected exception occurred in connection manager. Please contact Hangfire developers.
2024-07-29 11:03:09 System.ArgumentOutOfRangeException: Number must be either non-negative and less than or equal to Int32.MaxValue or -1. (Parameter 'timeout')
2024-07-29 11:03:09 at System.Threading.WaitHandle.ToTimeoutMilliseconds(TimeSpan timeout)
2024-07-29 11:03:09 at System.Threading.WaitHandle.WaitOne(TimeSpan timeout)
2024-07-29 11:03:09 at Hangfire.Pro.Redis.RedisStorage.ConnectLoop()
We had some outage in our servers with Redis, and it was not being available for 2 hours. Our HF job was trying to reconnect to Redis, but at the end we got exception above. After some time Redis got back to work again, but our HF job couldn’t connect to it, without restart, because of the exception.
I checked decompiled code and seems there is some problem with generation back off delay using this method GetBackOffDelay in RedisStorage. At some point of time after long reconnection tries it produces negative TimeSpan from int.MinValue.
Could you please take a look into this issue?