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

Connection Pool fails to handle system time changes correctlry [DNET787] #725

Closed
firebird-automations opened this issue Oct 3, 2017 · 6 comments

Comments

@firebird-automations
Copy link

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

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Fix Version: 5.12.0.0 [ 10854 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: Open [ 1 ] => In Progress [ 3 ]

@firebird-automations
Copy link
Author

Commented by: @cincuranet

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.

@firebird-automations
Copy link
Author

Commented by: @cincuranet

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.

@firebird-automations
Copy link
Author

Modified by: @cincuranet

status: In Progress [ 3 ] => Resolved [ 5 ]

resolution: Fixed [ 1 ]

@firebird-automations
Copy link
Author

Modified by: @cincuranet

Link: This issue relate to DNET799 [ DNET799 ]

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

No branches or pull requests

2 participants