Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Thu May 10, 2007 6:10 am 
Offline
Junior Member

Joined: Tue Mar 22, 2005 1:20 pm
Posts: 43
Website: http://darkcoding.net
Location: Vancouver, Canada
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


Top
   
 Post subject:
PostPosted: Thu May 10, 2007 6:33 am 
Offline
Junior Member

Joined: Tue Mar 22, 2005 1:20 pm
Posts: 43
Website: http://darkcoding.net
Location: Vancouver, Canada
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.


Top
   
 Post subject:
PostPosted: Sat May 12, 2007 12:09 pm 
Offline
Senior Member

Joined: Fri Feb 13, 2004 11:30 am
Posts: 140
Location: England, UK
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?


Top
   
 Post subject:
PostPosted: Mon May 14, 2007 5:50 am 
Offline
Junior Member

Joined: Tue Mar 22, 2005 1:20 pm
Posts: 43
Website: http://darkcoding.net
Location: Vancouver, Canada
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.


Top
   
 Post subject:
PostPosted: Mon May 14, 2007 5:55 am 
Offline
Senior Member
User avatar

Joined: Wed Jan 24, 2007 12:04 am
Posts: 90
Website: http://www.smiffysplace.com
Location: Rural South Australia
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?


Top
   
 Post subject: Fixed
PostPosted: Mon May 14, 2007 12:44 pm 
Offline
Junior Member

Joined: Tue Mar 22, 2005 1:20 pm
Posts: 43
Website: http://darkcoding.net
Location: Vancouver, Canada
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.


Top
   
 Post subject:
PostPosted: Wed May 16, 2007 9:19 am 
Offline
Senior Member

Joined: Fri Feb 13, 2004 11:30 am
Posts: 140
Location: England, UK
Ahhhh. Sounds like a mod_perl thing, then? *just trying to work it out*


Top
   
 Post subject:
PostPosted: Wed May 16, 2007 9:55 am 
Offline
Junior Member

Joined: Tue Mar 22, 2005 1:20 pm
Posts: 43
Website: http://darkcoding.net
Location: Vancouver, Canada
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!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group