You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by "Arshad Mohammad (JIRA)" <ji...@apache.org> on 2016/08/05 19:07:20 UTC

[jira] [Commented] (ZOOKEEPER-2469) infinite loop in ZK re-login

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

Arshad Mohammad commented on ZOOKEEPER-2469:
--------------------------------------------

# immediateRetry  is not required if relogin is tried at least after MIN_TIME_BEFORE_RELOGIN, but here we are trying to relogin immediately after the first relogin failure
# bq.Shouldn't we keep retrying but making sure that it is sleeping in each iteration rather than run in a tight loop?
This would help in maintaining the cleaner code. But we will end up trying re-login forever intentionally and this JIRA would be just a code cleanup task, not a bug actually.
are you suggesting to replace code from line 236 to 260 with bellow code.
{code}
while (true) {
	try {
		reLogin();
		break;
	} catch (LoginException le) {
		try {
			Thread.sleep(MIN_TIME_BEFORE_RELOGIN + 1);
		} catch (InterruptedException e) {
			LOG.error("Interrupted during login retry after LoginException:", le);
			break;
		}
	}
}
{code}






> infinite loop in ZK re-login
> ----------------------------
>
>                 Key: ZOOKEEPER-2469
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-2469
>             Project: ZooKeeper
>          Issue Type: Bug
>            Reporter: Sergey Shelukhin
>            Assignee: Sergey Shelukhin
>         Attachments: ZOOKEEPER-2469.01.patch, ZOOKEEPER-2469.02.patch, ZOOKEEPER-2469.03.patch, ZOOKEEPER-2469.patch
>
>
> {noformat}
>                         int retry = 1;
>                         while (retry >= 0) {
>                             try {
>                                 reLogin();
>                                 break;
>                             } catch (LoginException le) {
>                                 if (retry > 0) {
>                                     --retry;
>                                     // sleep for 10 seconds.
>                                     try {
>                                         Thread.sleep(10 * 1000);
>                                     } catch (InterruptedException e) {
>                                         LOG.error("Interrupted during login retry after LoginException:", le);
>                                         throw le;
>                                     }
>                                 } else {
>                                     LOG.error("Could not refresh TGT for principal: " + principal + ".", le);
>                                 }
>                             }
>                         }
> {noformat}
> will retry forever. Should return like the one above



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)