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

Stefan Egli commented on SLING-5243:
------------------------------------

Reverting the previous commit (rev 1712584) - plus the one from SLING-5195 
which actually introduced a regression. 

Done in rev 1712651

The rather subtle race-condition happening:

With SLING-5195 the establishedView is retrieved earlier in doCheckView than 
previously. Namely, it is retrieved *before* the check for any ongoing or 
pending votings is done. This has the effect that you could read an 
establishedView (a), then a separate thread/instance simultaneously finishes a 
voting it started and promotes a new establishedView (b), while then the 
original doCheckView continues and sees: ah, no ongoing votings, fine, so it 
continues to see if the establishedView (which is (a) for that thread) matches 
the live one. At that point it cannot find (a) anymore an the {{matches()}} 
method throws an Exception (used to return false, but that's the same) - and as 
a result a new voting will be started.

Now that's all not dramatic cos a new voting should result in the same outcome 
- all that would happen is an 'unnecessary' TOPOLOGY_CHANGING quickly followed 
by TOPOLOGY_CHANGED. But that's nevertheless a bug and requires fixing.

> discovery.impl.cluster.SingleInstanceTest.testBootstrap failed on jenkins
> -------------------------------------------------------------------------
>
>                 Key: SLING-5243
>                 URL: https://issues.apache.org/jira/browse/SLING-5243
>             Project: Sling
>          Issue Type: Bug
>    Affects Versions: Discovery Impl 1.1.8
>            Reporter: Stefan Egli
>            Assignee: Stefan Egli
>            Priority: Minor
>             Fix For: Discovery Impl 1.2.2
>
>         Attachments: SingleInstanceTest.testBootstrap.failure1918.full.txt, 
> SingleInstanceTest.testBootstrap.failure1918.txt
>
>
> the following test failed: 
> https://builds.apache.org/job/sling-trunk-1.8/org.apache.sling$org.apache.sling.discovery.impl/1918/testReport/junit/org.apache.sling.discovery.impl.cluster/SingleInstanceTest/testBootstrap/
> {code}
> Error Message
> expected:<1> but was:<0>
> Stacktrace
> java.lang.AssertionError: expected:<1> but was:<0>
>       at org.junit.Assert.fail(Assert.java:88)
>       at org.junit.Assert.failNotEquals(Assert.java:743)
>       at org.junit.Assert.assertEquals(Assert.java:118)
>       at org.junit.Assert.assertEquals(Assert.java:555)
>       at org.junit.Assert.assertEquals(Assert.java:542)
>       at 
> org.apache.sling.discovery.base.its.AbstractSingleInstanceTest.testBootstrap(AbstractSingleInstanceTest.java:284)
>       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>       at 
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>       at 
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>       at java.lang.reflect.Method.invoke(Method.java:483)
>       at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>       at 
> org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
>       at 
> org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
>       at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
>       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
>       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
>       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
>       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
>       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
>       at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:283)
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:173)
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:153)
>       at 
> org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:128)
>       at 
> org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:203)
>       at 
> org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:155)
>       at 
> org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:103)
> {code}



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

Reply via email to