Use Environment.TickCount64 to calculate how much time has passed for ReliableSessions session timeout
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 576
- Avg merge
- 6d 9h
- Merged PRs (30d)
- 2
Description
Original bug report below. This issue is going to be used to track the feature enhancement of switching to Environment.TickCount64 instead of doing math with DateTime.UtcNow as Environment.TickCount64 doesn't have time travel problems when the system clock is changed.
**Describe the bug**
I have a WCF NetTcpBinding server (.NET framework 4.8) that has a binding that uses ReliableSession. I have a WCF client running on the same Windows PC that establishes a connection to the server and keeps the connection open for a long time. Both sides have the ReliableSession InactivityTimeout set to 120 seconds.
The issue is: **If the PC's system clock is manually advanced by 3 minutes then the WCF connection drops.**
You might say _"don't change the system clock!"_, but in our corporate environment we have PCs who's time is synchronised to a time server, and on one of the PC it automatically advanced the time by a few minutes, thus causing the WCF connection to drop. I think that WCF should use it's own internal timers for the reliable session, not the PC system time.
**To Reproduce**
Steps to reproduce the behavior:
- Establish a WCF NetTcpBinding ReliableSession with InactivityTimeout set to 120 seconds
- Advance the PC system clock by 3 minutes
**Expected behavior**
The WCF connection should not drop (especially since it's all happening on the same PC).
Contributor guide
Assessment
This issue has not been assessed yet.