Avoid random failures in TestRunnerStandalone.runPerformanceTest

Description

The failures happen randomly and are caused by concurrency issues:

Source: http://ci.hibernate.org/job/hibernate-search-master/org.hibernate$hibernate-search-performance-orm/1115/testReport/junit/org.hibernate.search.test.performance/TestRunnerStandalone/runPerformanceTest/

The exact cause is the update tasks in that test, such as UpdateBookRatingTask or UpdateBookTotalSoldTask. Those tasks execute concurrently, and they pick an entity ID randomly to perform the update on. In smoke tests, there are very few entities (10, I think) and thus a conflict is very likely.

Environment

None

Activity

Show:
Yoann Rodière
October 9, 2017, 12:43 PM

I see three potential solutions:

1. Add a synchronization of some sort to avoid ending up in a situation where two tasks work on the same ID
2. Disable concurrency in smoke tests, so that the main build won't be affected by the issue
3. Mitigate the issue by ensuring that N consecutive requests for a random entity ID will always return N unique IDs (but requests separated by more than N calls may still result in the same ID).

#3 is not an absolute solution, but if it should work if N is much higher than the number of threads, and if all tasks requesting a random ID have a similar execution time.

: unless you have an objection, I'll go with solution #3, which I think balances benefits and runtime costs best.

Assignee

Yoann Rodière

Reporter

Yoann Rodière

Labels

None

Suitable for new contributors

None

Feedback Requested

None

Components

Priority

Major
Configure