Skip to content

Hit by Timezone problem on Linux/JVM combination.

June 13, 2014

We have been setting timezone to IST as: 

cd /etc
 sudo ln -sf /usr/share/zoneinfo/Asia/Calcutta localtime

Which was clearly not sufficient, but had been working for a long time properly. Until recently when we hit a bug, in which Java (JVM) laucnhed via crontab were not getting the timezone. 

At first we noticed this on check availability script. Which we patched as following: 

# I think we were hit by JVM’s timezone bug hence setting the TZ explicitly

#http://bugs.java.com/view_bug.do?bug_id=6456628
export TZ=Asia/Calcutta
echo TZ is $TZ
echo date is `date`

But this lazy patch rather than a proper fix cost us with a nasty bug, reported by a long time user. The flight fares cache was getting all timings 5:30 hours before to actual time, as timezone read was UTC!

So now added the other important part of the step on to linux machines: 

vi /etc/sysconfig/clock
  edit the ZONE as: 
  ZONE="Asia/Calcutta"

 

After that its working fine. Woof! Spent half a day on this. Should have fixed it properly the first time itself, rather than patching that script. 

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: