zookeeper-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Asad Saeed (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (ZOOKEEPER-1366) Zookeeper should be tolerant of clock adjustments
Date Thu, 05 Sep 2013 18:56:54 GMT

    [ https://issues.apache.org/jira/browse/ZOOKEEPER-1366?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13759315#comment-13759315
] 

Asad Saeed commented on ZOOKEEPER-1366:
---------------------------------------

A few issues with this patch. It is much broader than it should be.

In Login.java: 2 timesources are being utilized and incorrectly compared:
Time.currentElapsedTime is not compatible with the (KerberosTicket).getEndTime which will
return the expiry based on the system time. The 2 time values are compared in the following
block

--
                        if (nextRefresh > expiry) {
                            LOG.error("next refresh: " + nextRefreshDate + " is later than
expiry " + expiryDate
                                    + ". This may indicate a clock skew problem. Check that
this host and the KDC's "
                                    + "hosts' clocks are in sync. Exiting refresh thread.");
                            return;
--

ZookeeperServer::getTime: Utilization of Time.currentElapsedTime here will lead to unusable
timestamps for the mtime and ctime for nodes. DataTree::processTxn uses the TxnHeader.time
to populate the Stat structure. TxnHeader.time is assigned by PrepRequestProcessor::pRequest2Txn
using ZookeeperServer.getTime.
                
> Zookeeper should be tolerant of clock adjustments
> -------------------------------------------------
>
>                 Key: ZOOKEEPER-1366
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-1366
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Ted Dunning
>            Assignee: Ted Dunning
>             Fix For: 3.5.0
>
>         Attachments: ZOOKEEPER-1366-3.3.3.patch, ZOOKEEPER-1366.patch, ZOOKEEPER-1366.patch,
ZOOKEEPER-1366.patch, ZOOKEEPER-1366.patch, ZOOKEEPER-1366.patch, ZOOKEEPER-1366.patch, ZOOKEEPER-1366.patch,
zookeeper-3.4.5-ZK1366-SC01.patch
>
>
> If you want to wreak havoc on a ZK based system just do [date -s "+1hour"] and watch
the mayhem as all sessions expire at once.
> This shouldn't happen.  Zookeeper could easily know handle elapsed times as elapsed times
rather than as differences between absolute times.  The absolute times are subject to adjustment
when the clock is set while a timer is not subject to this problem.  In Java, System.currentTimeMillis()
gives you absolute time while System.nanoTime() gives you time based on a timer from an arbitrary
epoch.
> I have done this and have been running tests now for some tens of minutes with no failures.
 I will set up a test machine to redo the build again on Ubuntu and post a patch here for
discussion.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Mime
View raw message