hadoop-common-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vinayakumar B (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (HADOOP-15901) IPC Client and Server should use Time.monotonicNow() for elapsed times.
Date Tue, 06 Nov 2018 06:26:00 GMT

    [ https://issues.apache.org/jira/browse/HADOOP-15901?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16676223#comment-16676223

Vinayakumar B commented on HADOOP-15901:

Thanks [~stevel@apache.org] for the pointers.

Yes! its depressing to see this. Previously I me only changed usage of {{Time.now()}} to {{Time.monotonicNow()}} 
in many places. Should I go back now?

JDK guys says in this [JDKBug|https://bugs.java.com/bugdatabase/view_bug.do?bug_id=6458294]
that monotocity of {{System.nanoTime()}} implementation depends on underlying platform. If
the underlying platform supports MONOTONIC_CLOCK then {{System.nanoTime()}} should be monotonic,
otherwise results will be same as {{System.currentTimeMillis()}}.

Many blogs pointed out problem in {{Windows XP with SP2}} due to TSC counter (core wise counter).
SP3 onwards, power management timer (pmtimer) was enabled, which solved this problem.

Even though with problematic {{System.nanoTime()}}, one of the answers it was mentioned that
difference can be ~ +/- 3ms.

But with {{System.currentTimeMillis()}} this could be even minutes when NTP is running. This
could lead to serious miscalculations.

This [blog|http://btorpey.github.io/blog/2014/02/18/clock-sources-in-linux/] was really informative.

So what we should do? Remove all usages of {{System.nanoTime()}} in Hadoop?

> IPC Client and Server should use Time.monotonicNow() for elapsed times.
> -----------------------------------------------------------------------
>                 Key: HADOOP-15901
>                 URL: https://issues.apache.org/jira/browse/HADOOP-15901
>             Project: Hadoop Common
>          Issue Type: Bug
>          Components: ipc, metrics
>            Reporter: Vinayakumar B
>            Assignee: Vinayakumar B
>            Priority: Major
>         Attachments: HADOOP-15901-01.patch
> Client.java and Server.java  uses {{Time.now()}} to calculate the elapsed times/timeouts.
This could result in undesired results when system clock's time changes.
> {{Time.monotonicNow()}} should be used for elapsed time calculations within same JVM.

This message was sent by Atlassian JIRA

To unsubscribe, e-mail: common-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org

View raw message