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

Aleksei Zotov commented on CASSANDRA-16862:
-------------------------------------------

[~e.dimitrova] [~brandon.williams] [~sumanth.pasupuleti]

I've taken a look to the test a bit closer and here is what I can see:
 # it sometimes (once per ~15 runs) passes in Intellij in "run" mode
 # it always passes in Intellij in "debug" mode
 # the problem is caused by "Attach Listener" which is related to [Dynamic 
Attach|http://openjdk.java.net/groups/hotspot/docs/Serviceability.html] feature 
of JVM
 # if I add {{-XX:+DisableAttachMechanism}} parameter then the test always pass 
in Intellij in "run" mode

Conclusion:
 # the test works in "debug" mode because Intellij attaches to JVM though an 
agentlib, not through "Dynamic Attach":

{code:java}
-agentlib:jdwp=transport=dt_socket,address=127.0.0.1:59053,suspend=y,server=n{code}
This is parameter is the only difference between "run" and "debug" configuration
 # the issue is caused by IDE (Intellij in my case) which tries to attach to 
the JVM. I found no details on how to disable such a behavior in Intellij for 
"run" mode.
 # {{ant}} works fine because no process tries to attach to JVM

I came up with a fix and here is the summary of changes:
 # started ignoring "Attach Listener" thread
 # started ignoring Logback-related threads by names instead of having 
assumption that two additional threads are always Logback-related
 # started filtering out multiple Logback basic threads (while debugging the 
problem I mentioned that sometimes two threads _logback-1_ and _logback-2_ are 
spawned)
 # fixed warnings

Here are the patches:
 * 
[3.11|https://github.com/alex-ninja/cassandra/commit/5bf8f1debfd547b5c8e613b294b50ea8f56a3367]
 * 
[4.0|https://github.com/alex-ninja/cassandra/commit/c7de42d70dd28bbc9049286f9db7f8b3fb2f6b7d]
 * 
[trunk|https://github.com/alex-ninja/cassandra/commit/683fea50002694bce27b3b687194f5db3ef11fd1]

Could you please review them and try out on your local machines. 

> Fix flaky test DatabaseDescriptorRefTest
> ----------------------------------------
>
>                 Key: CASSANDRA-16862
>                 URL: https://issues.apache.org/jira/browse/CASSANDRA-16862
>             Project: Cassandra
>          Issue Type: Bug
>          Components: CI
>            Reporter: Ekaterina Dimitrova
>            Priority: Normal
>             Fix For: 3.11.x, 4.0.x, 4.x
>
>
> While working on another ticket I found out that DatabaseDescriptorRefTest is 
> failing consistently locally for me and one more community member on 3.11, 
> 4.0 and trunk.
> {code:java}
>  java.lang.AssertionError: thread started in clientInitialization 
> Expected :5
> Actual   :8
> <Click to see difference>
>       at org.junit.Assert.fail(Assert.java:88)
>       at org.junit.Assert.failNotEquals(Assert.java:834)
>       at org.junit.Assert.assertEquals(Assert.java:645)
>       at 
> org.apache.cassandra.config.DatabaseDescriptorRefTest.testDatabaseDescriptorRef(DatabaseDescriptorRefTest.java:285)
>       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:498)
>       at 
> org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
>       at 
> org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
>       at 
> org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
>       at 
> org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
>       at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
>       at 
> org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
>       at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
>       at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
>       at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
>       at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
>       at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
>       at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
>       at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
>       at 
> com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
>       at 
> com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
>       at 
> com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
>       at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to