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

Bug 407869

Summary: Failed to initialize a metadata store
Product: [ECD] Orion Reporter: Maciej Bendkowski <maciej.bendkowski>
Component: ServerAssignee: John Arthorne <john.arthorne>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P1 CC: arthorne.eclipse, mamacdon
Version: unspecified   
Target Milestone: 3.0 M2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Stack trace
none
Better logging none

Description Maciej Bendkowski CLA 2013-05-13 08:34:41 EDT
Created attachment 230853 [details]
Stack trace

1. Download the latest orion build:
I20130512-2230-win32.win32.x86_64

2. Run the server.
3. There should be an exception:
 Illegal State Exception: failed to initialize a metadata store.

Stack trace in attachment.
Comment 1 John Arthorne CLA 2013-05-13 11:42:28 EDT
Build still seems to run. I think this may be a race condition on startup.
Comment 2 Mark Macdonald CLA 2013-05-13 12:12:55 EDT
Something is badly broken in recent builds. Loading the sites page (for a new user, who I just created in a new server workspce) gives me a sever error:

>{"Severity":"Error","Message":"An error occurred while obtaining site configurations","HttpCode":500,"Code":0}

There is no Sites.prefs file in the server metadata folder, perhaps that is the cause?
Comment 3 John Arthorne CLA 2013-05-13 13:39:43 EDT
This is definitely a timing problem. Bundle activation order seems to be different in the build than it is in my workspace. From the log I can see that immediately after this exception, the metastore service is correctly initialized, just too late:

!ENTRY org.eclipse.core.jobs 4 2 2013-05-13 11:37:48.847
!MESSAGE An internal error occurred during: "Indexing".
!STACK 0
java.lang.IllegalStateException: Invalid server configuration. Failed to initialize a metadata store
        at org.eclipse.orion.internal.server.core.Activator.getMetastore(Activator.java:94)
        at org.eclipse.orion.server.core.OrionConfiguration.getMetaStore(OrionConfiguration.java:30)
        at org.eclipse.orion.internal.server.search.Indexer.run(Indexer.java:271)
        at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

2013-05-13 12:26:40.476 [qtp1992677825-40] INFO  org.eclipse.orion.server.config - Initializing server metadata store
2013-05-13 12:26:40.477 [qtp1992677825-40] INFO  org.eclipse.orion.server.config - Found metastore service: {org.eclipse.orion.server.core.metastore.IMetaStore}={service.id=55}
Comment 4 John Arthorne CLA 2013-05-13 13:41:41 EDT
Effectively the indexer needs to wait for the metadata store service to be available before running. We could use a service tracker here but the simple solution is to just abort and reschedule the indexer job when the metadata store is not available.

http://git.eclipse.org/c/orion/org.eclipse.orion.server.git/commit/?id=3dff1956ecde22792f747b7424d0766c31f41eb2
Comment 5 John Arthorne CLA 2013-06-18 11:13:22 EDT
Created attachment 232504 [details]
Better logging