You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by "Andy Wu (JIRA)" <ji...@apache.org> on 2019/03/07 00:21:00 UTC
[jira] [Updated] (RATIS-495) Leader Election thread might crash
without coming back
[ https://issues.apache.org/jira/browse/RATIS-495?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Andy Wu updated RATIS-495:
--------------------------
Description:
In some scenario, thread running LeaderElection#waitForResults might crash.
{code:java}
try {
if (conf.hasMajority(votedPeers, server.getId())) {
}
} catch(ExecutionException e) {}
boolean hasMajority(Collection<RaftPeerId> others, RaftPeerId selfId) {
Preconditions.assertTrue(!others.contains(selfId));
return conf.hasMajority(others, selfId) && (oldConf == null || oldConf.hasMajority(others, selfId));
}
{code}
Preconditions.assertTrue(!others.contains(selfId)); statement inside RaftConfiguration#hasMajority() might throw IllegalStateException. This RunTimeException will kill thread running LeaderElection#waitForResults code.
stacktrace:
{code:java}
Exception in thread "Thread-13" java.lang.IllegalStateException
at org.apache.ratis.util.Preconditions.assertTrue(Preconditions.java:33)
at org.apache.ratis.server.impl.RaftConfiguration.hasMajority(RaftConfiguration.java:211)
at org.apache.ratis.server.impl.LeaderElection.waitForResults(LeaderElection.java:225)
at org.apache.ratis.server.impl.LeaderElection.askForVotes(LeaderElection.java:146)
at org.apache.ratis.server.impl.LeaderElection.run(LeaderElection.java:102){code}
Fix: Change ExecutionException into Exception. Also I need to figure out what is causing this RunTimeException.
was:
In some scenario, thread running LeaderElection#waitForResults might crash.
{code:java}
try {
if (conf.hasMajority(votedPeers, server.getId())) {
}
} catch(ExecutionException e) {}
boolean hasMajority(Collection<RaftPeerId> others, RaftPeerId selfId) { Preconditions.assertTrue(!others.contains(selfId)); return conf.hasMajority(others, selfId) && (oldConf == null || oldConf.hasMajority(others, selfId)); }
{code}
Preconditions.assertTrue(!others.contains(selfId)); statement inside RaftConfiguration#hasMajority() might throw IllegalStateException. This RunTimeException will kill thread running LeaderElection#waitForResults code.
stacktrace:(
{code:java}
Exception in thread "Thread-13" java.lang.IllegalStateException
at org.apache.ratis.util.Preconditions.assertTrue(Preconditions.java:33)
at org.apache.ratis.server.impl.RaftConfiguration.hasMajority(RaftConfiguration.java:211)
at org.apache.ratis.server.impl.LeaderElection.waitForResults(LeaderElection.java:225)
at org.apache.ratis.server.impl.LeaderElection.askForVotes(LeaderElection.java:146)
at org.apache.ratis.server.impl.LeaderElection.run(LeaderElection.java:102){code}
Fix: Change ExecutionException into Exception. Also I need to figure out what is causing this RunTimeException.
> Leader Election thread might crash without coming back
> ------------------------------------------------------
>
> Key: RATIS-495
> URL: https://issues.apache.org/jira/browse/RATIS-495
> Project: Ratis
> Issue Type: Bug
> Affects Versions: 0.2.0
> Reporter: Andy Wu
> Priority: Major
>
> In some scenario, thread running LeaderElection#waitForResults might crash.
>
> {code:java}
> try {
> if (conf.hasMajority(votedPeers, server.getId())) {
> }
> } catch(ExecutionException e) {}
>
> boolean hasMajority(Collection<RaftPeerId> others, RaftPeerId selfId) {
> Preconditions.assertTrue(!others.contains(selfId));
> return conf.hasMajority(others, selfId) && (oldConf == null || oldConf.hasMajority(others, selfId));
> }
> {code}
> Preconditions.assertTrue(!others.contains(selfId)); statement inside RaftConfiguration#hasMajority() might throw IllegalStateException. This RunTimeException will kill thread running LeaderElection#waitForResults code.
> stacktrace:
> {code:java}
> Exception in thread "Thread-13" java.lang.IllegalStateException
> at org.apache.ratis.util.Preconditions.assertTrue(Preconditions.java:33)
> at org.apache.ratis.server.impl.RaftConfiguration.hasMajority(RaftConfiguration.java:211)
> at org.apache.ratis.server.impl.LeaderElection.waitForResults(LeaderElection.java:225)
> at org.apache.ratis.server.impl.LeaderElection.askForVotes(LeaderElection.java:146)
> at org.apache.ratis.server.impl.LeaderElection.run(LeaderElection.java:102){code}
>
> Fix: Change ExecutionException into Exception. Also I need to figure out what is causing this RunTimeException.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)