I would like to bring up an issue that is not exactly related to a crash on SP3 but is relative to Windows new way of handling Daylight Savings Time.
 

apr_time_exp_lt is now a performance nightmare due to the changes that microsoft made with Daylight Savings Time.  The function call SystemTimeToTzSpecificLocalTime() was a free call prior to XP SP3 and the associated Daylight Savings Time changes.  Now that call is about 50 times slower since it hits the registry every time. It is causing a huge performance problem with an application that I support, adding minutes of CPU time.

 

Has anyone looked into replacing the Windows function call SystemTimeToTzSpecificLocalTime in apr_time_exp_lt?

Does anyone know of alternative calls or workarounds through some Windows settings?

 

e.g.

 

HKCU SUCCESS Desired Access: All Access

HKCU\Software\Microsoft\Windows NT\CurrentVersion\Time Zones SUCCESS Desired Access: All Access

HKCU\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\TimeZoneKeyName SUCCESS Type: REG_SZ, Length: 44, Data: Eastern Standard Time

HKLM\Software\Microsoft\Windows NT\currentVersion\Time Zones\Eastern Standard Time SUCCESS Desired Access: Read

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Std SUCCESS Type: REG_SZ, Length: 44, Data: Eastern Standard Time

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dlt SUCCESS Type: REG_SZ, Length: 44, Data: Eastern Daylight Time HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Tzi SUCCESS Type: REG_BINARY, Length: 44, Data: 2C 01 00 00 00 00 00 00 C4 FF FF FF 00 00 0B 00

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time SUCCESS

HKCU\Software\Microsoft\Windows NT\CurrentVersion\Time Zones SUCCESS

HKLM\Software\Microsoft\Windows NT\currentVersion\Time Zones\Eastern Standard Time SUCCESS Desired Access: Read

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Std SUCCESS Type: REG_SZ, Length: 44, Data: Eastern Standard Time

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dlt SUCCESS Type: REG_SZ, Length: 44, Data: Eastern Daylight Time

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Tzi SUCCESS Type: REG_BINARY, Length: 44, Data: 2C 01 00 00 00 00 00 00 C4 FF FF FF 00 00 0B 00

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time SUCCESS

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST SUCCESS Desired Access: Read, Maximum Allowed

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST\FirstEntry SUCCESS Type: REG_DWORD, Length: 4, Data: 2006

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST\LastEntry SUCCESS Type: REG_DWORD, Length: 4, Data: 2007

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST\2008 NAME NOT FOUND Length: 4,094

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST SUCCESS

HKLM\Software\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST SUCCESS Desired Access: Read, Maximum Allowed

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST\2007 SUCCESS Type: REG_BINARY, Length: 44, Data: 2C 01 00 00 00 00 00 00 C4 FF FF FF 00 00 0B 00 E7 02 00 00

HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Eastern Standard Time\Dynamic DST SUCCESS




From: Stefan Küng <tortoisesvn@gmail.com>
To: dev@apr.apache.org
Sent: Friday, May 23, 2008 12:39:35 PM
Subject: time functions on win32 don't check return values

Hi,

Due to some crash reports we've been getting lately I discovered that apr in most time related functions don't check the return values of the win API functions. That leads to crashes.

For example, most crash reports we receive are happening in SystemTimeToAprExpTime() (file time\win32\time.c) because the statement dayoffset[xt->tm_mon] accesses illegal memory, and that's because 'xt' is not initialized at all. I've discovered that this happens (just one example) if in apr_time_exp_lt(), the call to SystemTimeToTzSpecificLocalTime() fails.

The reason we only got these crash reports very recently (we didn't get those before) is that the SP3 for Windows XP updated some registry keys to handle more daylight-saving infos for different locales. Apparently, SP3 only causes these problems if users tried to adjust their settings manually before according to this KB article:
http://support.microsoft.com/kb/914387

I'm not sure if that article has a bug or if those users experiencing the crash made a mistake, but looking at the amount of crash reports we get I doubt it's a user mistake.
And considering that many people haven't installed SP3 yet I'm sure we will get a lot more of those reports in the future.

So to make it short:
I think apr should check the return values of those win API calls and return an error.

Stefan

--        ___
  oo  // \\      "De Chelonian Mobile"
(_,\/ \_/ \    TortoiseSVN
  \ \_/_\_/>    The coolest Interface to (Sub)Version Control
  /_/  \_\    http://tortoisesvn.net