You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FbConnectionPoolManager's check if a connection is alive fails if the system time travels back in time (changing time zones or daylight saving times while the application is running, for example)
Comparing the absolute difference of the values after adding the connectionLifeTime to the created time should fix the problem.
Comparing absolute value isn't a solution, because the shortening/lengthening of the lifetime might still happen in case of time shift. Probably something like Stopwatch or Environment.TickCount will be needed.
I did some sketch with using Environment.TickCount (https://github.com/cincuranet/FirebirdSql.Data.FirebirdClient/compare/dnet787). Of course this solves the problem of time shifts because of i.e. NTP synchronizations or DST. But also has potential failure when somebody would have connections in pool for longer than 49.7 days. Not sure whether it's really a problem.
Submitted by: Johannes Lochmann (jolo_tc)
Relate to DNET799
FbConnectionPoolManager's check if a connection is alive fails if the system time travels back in time (changing time zones or daylight saving times while the application is running, for example)
Comparing the absolute difference of the values after adding the connectionLifeTime to the created time should fix the problem.
static bool IsAlive(long connectionLifeTime, DateTimeOffset created, DateTimeOffset now)
{
if (connectionLifeTime == 0)
return true;
return created.AddSeconds(connectionLifeTime) > now;
}
Commits: 0e165ca
The text was updated successfully, but these errors were encountered: