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

ASF GitHub Bot commented on KAFKA-8025:
---------------------------------------

mjsax commented on pull request #8126: KAFKA-8025: Fix flaky RocksDB test
URL: https://github.com/apache/kafka/pull/8126
 
 
   Reading the stack trace on the Jira, I think the issue might be related to 
the shared mock object we use.
   
   The test testup is a little bit upside down to allow the usage of 
reflection. The test verifies that a method is called, by _not_ registering an 
expected call, and catching the corresponding exception from `verify()` 
(because we use reflections, we cannot easily register an expected call and let 
`verify()` throw if the call was not made).
   
   Thus, the expected message from `verify()` is something like:
   ```
   Unexpected method call DBOptions.setEnableThreadTracking(true):
   ```
   
   When the test fails the stack trace says:
   ```
   Unexpected method call DBOptions.setEnableThreadTracking(true):\n    
DBOptions.close(): expected: 1, actual: 0
   ```
   
   It indicates that an expected call was registered, however, the test 
actually never does this. Thus, I suspect that the mocked object is not 
isolated and as the tests are executed in parallel some race-condition applies 
(eg, one thread calls a method in the actual test to eventually trigger the 
exception in verify, while the other thread is just calling `replay()` 
accidentally register the call of the other thread as expected method call). 
   
   This fix tries to address the issue, by moving the mocked objects as local 
variables into the test methods.
   
   Call for review @vvcephei @bbejeck @cadonna 
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


> Flaky Test 
> RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest#shouldForwardAllDbOptionsCalls
> --------------------------------------------------------------------------------------------------------
>
>                 Key: KAFKA-8025
>                 URL: https://issues.apache.org/jira/browse/KAFKA-8025
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams, unit tests
>    Affects Versions: 2.3.0
>            Reporter: Konstantine Karantasis
>            Assignee: Bill Bejeck
>            Priority: Critical
>              Labels: flaky-test
>             Fix For: 2.5.0
>
>
> At least one occurence where the following unit test case failed on a jenkins 
> job that didn't involve any related changes. 
> [https://builds.apache.org/job/kafka-pr-jdk11-scala2.12/2783/consoleFull]
> I have not been able to reproduce it locally on Linux. (For instance 20 
> consecutive runs of this class pass all test cases)
> {code:java}
> 14:06:13 
> org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest
>  > shouldForwardAllDbOptionsCalls STARTED 14:06:14 
> org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.shouldForwardAllDbOptionsCalls
>  failed, log available in 
> /home/jenkins/jenkins-slave/workspace/kafka-pr-jdk11-scala2.12/streams/build/reports/testOutput/org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.shouldForwardAllDbOptionsCalls.test.stdout
>  14:06:14 14:06:14 
> org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest
>  > shouldForwardAllDbOptionsCalls FAILED 14:06:14     
> java.lang.AssertionError: 14:06:14     Expected: a string matching the 
> pattern 'Unexpected method call DBOptions\.baseBackgroundCompactions((.* 
> 14:06:14     *)*):' 14:06:14          but: was "Unexpected method call 
> DBOptions.baseBackgroundCompactions():\n    DBOptions.close(): expected: 3, 
> actual: 0" 14:06:14         at 
> org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:18) 14:06:14         
> at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:6) 14:06:14       
>   at 
> org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.verifyDBOptionsMethodCall(RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.java:121)
>  14:06:14         at 
> org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.shouldForwardAllDbOptionsCalls(RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest.java:101)
>  14:06:14 14:06:14 
> org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest
>  > shouldForwardAllColumnFamilyCalls STARTED 14:06:14 14:06:14 
> org.apache.kafka.streams.state.internals.RocksDBGenericOptionsToDbOptionsColumnFamilyOptionsAdapterTest
>  > shouldForwardAllColumnFamilyCalls PASSED
> {code}
>  



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

Reply via email to