| Author |
Message |
graham
Joined: 22 Mar 2005
Posts: 38
Location: London, England
|
| Posted: Thu May 10, 2007 5:10 am Post subject: Time several hours out on host119 about 1 request in 3 |
|
|
Since I moved to host119.dallas.linode.com , the date Apache reports is wrong about 1 in 3 times.
For example here is an extract from my Apache access log:
(11:04:21 is correct)
212.85.13.68 - - [10/May/2007:11:04:21 +0100] "GET ...
212.85.13.68 - - [10/May/2007:05:04:21 -0500] "GET ...
212.85.13.68 - - [10/May/2007:11:04:21 +0100] "GET ...
212.85.13.68 - - [10/May/2007:05:04:21 -0500] "GET ...
Sometimes it is out by one hour, sometimes a lot more like here. This affects all parts of Apache (the time in the HTTP response for example), and Python's datetime.datetime.now().
On the command line 'date' always seems to give the correct time, and 'touch'ing files have the correct time.
Does anyone know where this could be coming from ? I haven't got this on any previous Linode machines (over the years I've been on about 5).
Many thanks in advance,
Graham |
|
| Back to top |
|
graham
Joined: 22 Mar 2005
Posts: 38
Location: London, England
|
| Posted: Thu May 10, 2007 5:33 am Post subject: |
|
|
It seems that Apache is getting the timezone wrong when it starts a new process. The time is either 1 hour or 6 hours out.
The server should be on BST, so the 1 hour out is GMT, and the 6 hours out is CDT, which is Dallas time where the server is located.
/etc/localtime is a symbolic link to /usr/share/zoneinfo/Europe/London
I don't run anything else with as many processes or logs as Apache, so I can't see if the problem happens elsewhere. auth.log and such like are fine. |
|
| Back to top |
|
Ciaran
Joined: 13 Feb 2004
Posts: 140
Location: England, UK
|
| Posted: Sat May 12, 2007 11:09 am Post subject: |
|
|
| I'd try restarting Apache - maybe it's possible somehow that timezone information got changed in the middle of it starting up and some threads have the old one and some the new one? |
|
| Back to top |
|
graham
Joined: 22 Mar 2005
Posts: 38
Location: London, England
|
| Posted: Mon May 14, 2007 4:50 am Post subject: |
|
|
I have tried restarting Apache. The first few requests are fine but within one minute there's some that are one hour out.
I'm going to restart the machine just in case.
I've raised a Support Request, and I'm really hoping Linode can help me fix this. |
|
| Back to top |
|
smiffy
Joined: 23 Jan 2007
Posts: 66
Location: 80 miles from Adelaide, Australia
|
| Posted: Mon May 14, 2007 4:55 am Post subject: |
|
|
Sorry if this sounds like an obvious one but:
When did you last update your zoneinfo? From updates on my Gentoo-based Linodes, there have been something like five updates so far this year. Are your zoneinfo files *really* current? |
|
| Back to top |
|
graham
Joined: 22 Mar 2005
Posts: 38
Location: London, England
|
| Posted: Mon May 14, 2007 11:44 am Post subject: Fixed |
|
|
I upgraded my timezone-data, apr-util, Apache, Gentoo profile, and even finally upgraded my kernel to Latest 2.6. None of that was the problem.
The server has many Django sites, and their TIME_ZONE settings were all over the place. Apache processes started in the correct time zone, but as soon as a Django request got processed it set TZ to whatever it had, which persisted for the life of that process.
I changed all my Django sites to have 'Europe/London' as their time zone and the problem is fixed.
Thanks Ciaran and smiffy for the help. |
|
| Back to top |
|
Ciaran
Joined: 13 Feb 2004
Posts: 140
Location: England, UK
|
| Posted: Wed May 16, 2007 8:19 am Post subject: |
|
|
| Ahhhh. Sounds like a mod_perl thing, then? *just trying to work it out* |
|
| Back to top |
|
graham
Joined: 22 Mar 2005
Posts: 38
Location: London, England
|
| Posted: Wed May 16, 2007 8:55 am Post subject: |
|
|
In this case it's a user script, running via mod_python. It could also easily happen with mod_perl.
If a script sets an environment variable (TZ in this case), that persists for the life of the process. A request on a different virtual host, later in time, ran by the same process, will have the changed environment.
In this case the user was me (*blush*), so it was easy to fix! |
|
| Back to top |
|
| |