Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 451012

Summary: [server] migration does not support the same user at the same time in multiple concurrent server calls
Product: [ECD] Orion Reporter: Anthony Hunter <ahunter.eclipse>
Component: ServerAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: 8.0   
Hardware: PC   
OS: Linux   
Whiteboard:

Description Anthony Hunter CLA 2014-11-11 11:39:55 EST
I have ran into a scenario where a smoke test service is running multiple concurrent tests using one user account. This causes the metadata migration to fail.

I have updated the SimpleMetaStoreConcurrencyTests as a test with old metadata and can see that multiple threads try to do the migration and they step on each other.

Only one thread can do the migration, the others should be blocked.

If one thread completes the migration the other threads should figure out that migration no longer needs to be completed.
Comment 1 Anthony Hunter CLA 2014-11-11 13:03:43 EST
I have ran some tests with a fix and it looks like the problem is solved:
2014-11-11 12:59:50.489 [SimpleMetaStoreConcurrencyTestsThread-0] INFO  org.eclipse.orion.server.config - Migration: Migration required for user qa1auto001 to the latest (version 8)
2014-11-11 12:59:51.196 [SimpleMetaStoreConcurrencyTestsThread-0] INFO  org.eclipse.orion.server.config - Migration: Migration no longer required for user qa1auto001, completed in other thread

So marking resolved with commit:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=0ad21aaf3d1ec4c5b4c14bd94b484255f4700252
Comment 2 Anthony Hunter CLA 2014-11-11 21:24:58 EST
I added a JUnit test SimpleMetaStoreLiveMigrationConcurrencyTests and was able to reproduce an additional exception that occurred on a server with the first commit:

java.lang.IllegalMonitorStateException: attempt to unlock read lock, not locked by current thread

I have debugged further and delivered a more perfect solution in the new commit:
http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?h=stable_20141110&id=91b0af9f7a36443dcc7cdf8690ceb706a7a69998