JamesIry / jADT

A spoonful of ADT in your Java.
http://jamesiry.github.com/jADT/index.html
Apache License 2.0
49 stars 4 forks source link

mvn test failing 75% of the time when tests are run in parallel on my mac #12

Closed JamesIry closed 12 years ago

JamesIry commented 12 years ago

mvn test is failing approximately 75% of the time on my mac, but not all the time. It has never failed on two other Linux machines. ParserTest#testFull gives an exception from the Parser saying it was expected a "=" but found "hello.world".

The workaround is to not run tests in parallel. But that's not a fix until I understand what the root problem is.

Steps to reproduce:

  1. uncomment the section in the project's root pom.xml that makes the maven-surefire-plugin run in parallel.
  2. mvn test (repeat as necessary)
  3. watch ParserTest#testFull fail most of the time.
  4. If you can't get the test to fail, come borrow my mac and start over at step 1.
JamesIry commented 12 years ago

Turning off parallel testing fixes that right up. So naturally it looks like a race condition.

But it's not clear where said race condition could be. Or why it's 100% reliable on the two versions of Linux I've been running it on so far.

In desperation I made the two Regexen in Tokenizer non-static but that didn't solve the problem. They're documented as being non-stateful and I've never had problems with sharing them across threads in the past so I'm not surprised. Other than that I'm stumped.

JamesIry commented 12 years ago

For now I'm commenting out the config to run tests in parallel. https://github.com/JamesIry/JADT/commit/6b02311c5527048038d1224a6818f9c93dfca0e0 But I'm leaving the bug as open because I don't understand what the problem is.

JamesIry commented 12 years ago

Fixed in https://github.com/JamesIry/JADT/commit/0fcb3e6a93ecea6361775f5f10fb7864b6e7acba

JamesIry commented 12 years ago

An even better solution https://github.com/JamesIry/JADT/commit/3896027a0102ded5b92470b2fe494ddaed9fffb0