You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Krystian Szczesny <Kr...@intecbilling.com> on 2009/08/19 12:06:40 UTC
Application Time out of sync from server time
Hi,
I know this is not a very Axis2 specific question, but since the app is
based on Axis2 I thought I would start in here.
We have an application, which for every call received by Axis2, calls
our system.
In the call it includes the current date, which is then treated by our
system as effective date of the call.
Although both: Axis2 app and our system are on the same server, the java
app reports a different time than server time.
Depending on the environment, we have from 4 seconds "behind" server
time to 10 seconds "ahead" of server time.
Problem is, that we truncate the time to the nearest minute, and for few
seconds during a minute, we will have a different time in our system and
in the call from the java app.
Could you please tell me where I should start looking for the cause of
this problem?
Code in the java app is extremely simple:
Request comes in->convert xml to map->get connection to our system->get
current time->call our system->convert returned map to xml->send
response
This is how we get current date:
Date invokeDate = DateUtils.truncate(new Date(), Calendar.MINUTE);
Where DateUtils is:
org.apache.commons.lang.time.DateUtils;
and Date is:
java.util.Date
It's not like this date is only reported wrong when we make the call
out. For logging we use SLF4J with Logback, and the timestamp of the log
entries is same as the new Date() in the java app code and different
from the server time.
Could you please point me in some direction, where I should start
digging for answers?
App is deployed on HP-UX, we are using:
$ java -version
java version "1.5.0.07"
Java(TM) 2 Runtime Environment, Standard Edition (build
1.5.0.07-_20_mar_2007_05_31)
Java HotSpot(TM) Server VM (build 1.5.0.07 jinteg:03.20.07-11:05 IA64,
mixed mode)
Axis2 1.4.1
All help will be appreciated,
Thanks,
Krystian
This e-mail and any attachments are confidential and may also be legally
privileged and/or copyright material of Intec Telecom Systems PLC (or its
affiliated companies). If you are not an intended or authorised recipient
of this e-mail or have received it in error, please delete it immediately
and notify the sender by e-mail. In such a case, reading, reproducing,
printing or further dissemination of this e-mail or its contents is strictly
prohibited and may be unlawful.
Intec Telecom Systems PLC does not represent or warrant that an attachment
hereto is free from computer viruses or other defects. The opinions
expressed in this e-mail and any attachments may be those of the author and
are not necessarily those of Intec Telecom Systems PLC.
RE: Application Time out of sync from server time
Posted by Krystian Szczesny <Kr...@intecbilling.com>.
> -----Original Message-----
> From: Andreas Veithen [mailto:andreas.veithen@gmail.com]
> Sent: 19 August 2009 19:04
> To: axis-user@ws.apache.org
> Subject: Re: Application Time out of sync from server time
>
> Are you using virtualization?
>
> Andreas
>
> On Wed, Aug 19, 2009 at 13:20, Krystian
> Szczesny<Kr...@intecbilling.com> wrote:
> >> -----Original Message-----
> >> From: Krystian Szczesny [mailto:Krystian.Szczesny@intecbilling.com]
> >> Sent: 19 August 2009 11:07
> >> To: axis-user@ws.apache.org
> >> Subject: Application Time out of sync from server time
> >>
> >> Hi,
> >>
> >> I know this is not a very Axis2 specific question, but since the app
> > is
> >> based on Axis2 I thought I would start in here.
> >> We have an application, which for every call received by Axis2,
> calls
> >> our system.
> >> In the call it includes the current date, which is then treated by
> our
> >> system as effective date of the call.
> >> Although both: Axis2 app and our system are on the same server, the
> >> java
> >> app reports a different time than server time.
> >> Depending on the environment, we have from 4 seconds "behind" server
> >> time to 10 seconds "ahead" of server time.
> >> Problem is, that we truncate the time to the nearest minute, and for
> >> few
> >> seconds during a minute, we will have a different time in our system
> >> and
> >> in the call from the java app.
> >>
> >> Could you please tell me where I should start looking for the cause
> of
> >> this problem?
> >> Code in the java app is extremely simple:
> >> Request comes in->convert xml to map->get connection to our
> > system->get
> >> current time->call our system->convert returned map to xml->send
> >> response
> >>
> >> This is how we get current date:
> >> Date invokeDate = DateUtils.truncate(new Date(), Calendar.MINUTE);
> >> Where DateUtils is:
> >> org.apache.commons.lang.time.DateUtils;
> >> and Date is:
> >> java.util.Date
> >>
> >>
> >> It's not like this date is only reported wrong when we make the call
> >> out. For logging we use SLF4J with Logback, and the timestamp of the
> >> log
> >> entries is same as the new Date() in the java app code and different
> >> from the server time.
> >>
> >> Could you please point me in some direction, where I should start
> >> digging for answers?
> >> App is deployed on HP-UX, we are using:
> >>
> >> $ java -version
> >> java version "1.5.0.07"
> >> Java(TM) 2 Runtime Environment, Standard Edition (build
> >> 1.5.0.07-_20_mar_2007_05_31)
> >> Java HotSpot(TM) Server VM (build 1.5.0.07 jinteg:03.20.07-11:05
> IA64,
> >> mixed mode)
> >>
> >> Axis2 1.4.1
> >>
> >> All help will be appreciated,
> >> Thanks,
> >> Krystian
> >
> > Hi again,
> >
> > Just to follow up:
> > We have conducted an experiment: changed the server time by 10
> seconds
> > into the future and the date in the java app was not affected.
> > This is something, as the changes might have been caused by NTP
> process.
> > Is there any way I could sync the date in the java app with the
> server?
> > I would have always though this is done automatically...
> >
> > Thanks,
> > Krystian
> > This e-mail and any attachments are confidential and may also be
> legally
> > privileged and/or copyright material of Intec Telecom Systems PLC (or
> its
> > affiliated companies). If you are not an intended or authorised
> recipient
> > of this e-mail or have received it in error, please delete it
> immediately
> > and notify the sender by e-mail. In such a case, reading,
> reproducing,
> > printing or further dissemination of this e-mail or its contents is
> strictly
> > prohibited and may be unlawful.
> > Intec Telecom Systems PLC does not represent or warrant that an
> attachment
> > hereto is free from computer viruses or other defects. The opinions
> > expressed in this e-mail and any attachments may be those of the
> author and
> > are not necessarily those of Intec Telecom Systems PLC.
> >
Hi,
We are not using virtualisation.
Today morning I have found what caused the problem and solution to it.
It seems it was caused by Hp-UX Java implementation.
For performance reasons, by default it will take the start time of the process and then count time using cpu ticks from the start time.
To force it to use system time, I had to add this command line option:
-XX:+UseGetTimeOfDay
And it works fine now.
I am not sure about the performance impact, but it will be much lower than the impact we were having by using incorrect time.
Thanks,
Krystian
Re: Application Time out of sync from server time
Posted by Andreas Veithen <an...@gmail.com>.
Are you using virtualization?
Andreas
On Wed, Aug 19, 2009 at 13:20, Krystian
Szczesny<Kr...@intecbilling.com> wrote:
>> -----Original Message-----
>> From: Krystian Szczesny [mailto:Krystian.Szczesny@intecbilling.com]
>> Sent: 19 August 2009 11:07
>> To: axis-user@ws.apache.org
>> Subject: Application Time out of sync from server time
>>
>> Hi,
>>
>> I know this is not a very Axis2 specific question, but since the app
> is
>> based on Axis2 I thought I would start in here.
>> We have an application, which for every call received by Axis2, calls
>> our system.
>> In the call it includes the current date, which is then treated by our
>> system as effective date of the call.
>> Although both: Axis2 app and our system are on the same server, the
>> java
>> app reports a different time than server time.
>> Depending on the environment, we have from 4 seconds "behind" server
>> time to 10 seconds "ahead" of server time.
>> Problem is, that we truncate the time to the nearest minute, and for
>> few
>> seconds during a minute, we will have a different time in our system
>> and
>> in the call from the java app.
>>
>> Could you please tell me where I should start looking for the cause of
>> this problem?
>> Code in the java app is extremely simple:
>> Request comes in->convert xml to map->get connection to our
> system->get
>> current time->call our system->convert returned map to xml->send
>> response
>>
>> This is how we get current date:
>> Date invokeDate = DateUtils.truncate(new Date(), Calendar.MINUTE);
>> Where DateUtils is:
>> org.apache.commons.lang.time.DateUtils;
>> and Date is:
>> java.util.Date
>>
>>
>> It's not like this date is only reported wrong when we make the call
>> out. For logging we use SLF4J with Logback, and the timestamp of the
>> log
>> entries is same as the new Date() in the java app code and different
>> from the server time.
>>
>> Could you please point me in some direction, where I should start
>> digging for answers?
>> App is deployed on HP-UX, we are using:
>>
>> $ java -version
>> java version "1.5.0.07"
>> Java(TM) 2 Runtime Environment, Standard Edition (build
>> 1.5.0.07-_20_mar_2007_05_31)
>> Java HotSpot(TM) Server VM (build 1.5.0.07 jinteg:03.20.07-11:05 IA64,
>> mixed mode)
>>
>> Axis2 1.4.1
>>
>> All help will be appreciated,
>> Thanks,
>> Krystian
>
> Hi again,
>
> Just to follow up:
> We have conducted an experiment: changed the server time by 10 seconds
> into the future and the date in the java app was not affected.
> This is something, as the changes might have been caused by NTP process.
> Is there any way I could sync the date in the java app with the server?
> I would have always though this is done automatically...
>
> Thanks,
> Krystian
> This e-mail and any attachments are confidential and may also be legally
> privileged and/or copyright material of Intec Telecom Systems PLC (or its
> affiliated companies). If you are not an intended or authorised recipient
> of this e-mail or have received it in error, please delete it immediately
> and notify the sender by e-mail. In such a case, reading, reproducing,
> printing or further dissemination of this e-mail or its contents is strictly
> prohibited and may be unlawful.
> Intec Telecom Systems PLC does not represent or warrant that an attachment
> hereto is free from computer viruses or other defects. The opinions
> expressed in this e-mail and any attachments may be those of the author and
> are not necessarily those of Intec Telecom Systems PLC.
>
RE: Application Time out of sync from server time
Posted by Krystian Szczesny <Kr...@intecbilling.com>.
> -----Original Message-----
> From: Krystian Szczesny [mailto:Krystian.Szczesny@intecbilling.com]
> Sent: 19 August 2009 11:07
> To: axis-user@ws.apache.org
> Subject: Application Time out of sync from server time
>
> Hi,
>
> I know this is not a very Axis2 specific question, but since the app
is
> based on Axis2 I thought I would start in here.
> We have an application, which for every call received by Axis2, calls
> our system.
> In the call it includes the current date, which is then treated by our
> system as effective date of the call.
> Although both: Axis2 app and our system are on the same server, the
> java
> app reports a different time than server time.
> Depending on the environment, we have from 4 seconds "behind" server
> time to 10 seconds "ahead" of server time.
> Problem is, that we truncate the time to the nearest minute, and for
> few
> seconds during a minute, we will have a different time in our system
> and
> in the call from the java app.
>
> Could you please tell me where I should start looking for the cause of
> this problem?
> Code in the java app is extremely simple:
> Request comes in->convert xml to map->get connection to our
system->get
> current time->call our system->convert returned map to xml->send
> response
>
> This is how we get current date:
> Date invokeDate = DateUtils.truncate(new Date(), Calendar.MINUTE);
> Where DateUtils is:
> org.apache.commons.lang.time.DateUtils;
> and Date is:
> java.util.Date
>
>
> It's not like this date is only reported wrong when we make the call
> out. For logging we use SLF4J with Logback, and the timestamp of the
> log
> entries is same as the new Date() in the java app code and different
> from the server time.
>
> Could you please point me in some direction, where I should start
> digging for answers?
> App is deployed on HP-UX, we are using:
>
> $ java -version
> java version "1.5.0.07"
> Java(TM) 2 Runtime Environment, Standard Edition (build
> 1.5.0.07-_20_mar_2007_05_31)
> Java HotSpot(TM) Server VM (build 1.5.0.07 jinteg:03.20.07-11:05 IA64,
> mixed mode)
>
> Axis2 1.4.1
>
> All help will be appreciated,
> Thanks,
> Krystian
Hi again,
Just to follow up:
We have conducted an experiment: changed the server time by 10 seconds
into the future and the date in the java app was not affected.
This is something, as the changes might have been caused by NTP process.
Is there any way I could sync the date in the java app with the server?
I would have always though this is done automatically...
Thanks,
Krystian
This e-mail and any attachments are confidential and may also be legally
privileged and/or copyright material of Intec Telecom Systems PLC (or its
affiliated companies). If you are not an intended or authorised recipient
of this e-mail or have received it in error, please delete it immediately
and notify the sender by e-mail. In such a case, reading, reproducing,
printing or further dissemination of this e-mail or its contents is strictly
prohibited and may be unlawful.
Intec Telecom Systems PLC does not represent or warrant that an attachment
hereto is free from computer viruses or other defects. The opinions
expressed in this e-mail and any attachments may be those of the author and
are not necessarily those of Intec Telecom Systems PLC.