mssql-docker icon indicating copy to clipboard operation
mssql-docker copied to clipboard

Time freezes upon suspend (ubuntu) - GETDATE(), GETUTCDATE()

Open erikbozic opened this issue 4 years ago • 6 comments

I'm running mssql on my laptop with:

  • Ubuntu 20.04.1
  • Kernel: 5.4.0-52-generic
  • Docker: 19.03.13, build 4484c46d9d
  • Image: mcr.microsoft.com/mssql/server:2019-CU8-ubuntu-16.04

Normally a query like: SELECT GETDATE() as 'GETDATE()', SYSDATETIME() as 'SYSDATETIME()', GETUTCDATE() as 'GETUTCDATE()' shows the correct time for all three functions.

However if I put my laptop to sleep (suspend) and then wake it up they return different values.
GETDATE() and GETUTCDATE() get stuck at the time the computer was suspended. SYSDATETIME() still works correctly. Running date inside the container also works correctly. image

If I restart the container everything works fine again. Seems like the way ubuntu goes to sleep doesn't play nice with how mssql gets it's time? :man_shrugging:

erikbozic avatar Oct 29 '20 16:10 erikbozic

Hy, I've come across the same issue: Ubuntu: 20.04.1 Docker: 19.03.13 Image: mcr.microsoft.com/mssql/server:2019-CU3-ubuntu-18.04

ghost avatar Nov 30 '20 14:11 ghost

Having the same problem on fedora. Fedora: 33 Docker: 20.10.6, build 370c289 Image: mcr.microsoft.com/mssql/server Version: Microsoft SQL Server 2019 (RTM-CU8) (KB4577194) - 15.0.4073.23 (X64)

namesweretaken avatar May 05 '21 09:05 namesweretaken

Just wanted to mention that this isn't limited to Docker or Linux. We're having the same issue running without containers on Win10 systems as well. We never had a call about this with our SQL-backed app with SQL 2014->2017. Since updating to 2019, we've had many customers call with "frozen" report dates in the system. We've traced it down to the same details as above... following system suspend/resume, GetUTCDate returns the same timestamp forever until the SQL service is restarted.

fishage avatar Jul 26 '21 13:07 fishage

I have exactly the same issue.

Ubuntu 20.04 | Manjaro latest docker 20.10.12, build e91ed5707e Image: mcr.microsoft.com/mssql/server Version: Microsoft SQL Server 2019 (RTM-CU13) (KB5005679) - 15.0.4178.1 (X64)

Is there any reasonable workaround? I may develop a script that restarts the container on each resume from suspend, but it is totally unneeded if a proper fix appers.

kostadinnm avatar Feb 12 '22 11:02 kostadinnm

[mcr.microsoft.com/mssql/server:2019-GDR1-ubuntu-16.04]

Same issue.

risb0 avatar Aug 05 '22 20:08 risb0

The same situation. Better to use SYSDATETIME() instead GETDATE() or GETUTCDATE()

image

marcinkoci avatar Mar 15 '23 07:03 marcinkoci