We have two JBOSS servers, each with a SOLR war file (SOLR 3.6.1). They both share the same solr_home directory and associated sub-directories including data and index directories. At any one time, either or both war files could be processing searches or uploads (using the DataImportHandler). We are intermittently getting Locking exceptions while processing uploads e.g.
org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/sharedDirectory/blah/blah/solr_home/././myCoreData/index/write.lock
We are also getting OutOfMemory errors which we are addressing. OutOfMemory errors can cause Lock errors so I'm not sure if fixing the OutOfMemory issue will resolve the Lock issue or is our approach wrong?
Is it valid to have two SOLR applications sharing the same solr_home, lock files etc?
It is not valid.
Your instances will be stepping on each other feet all the time. Have a look at the SolrCloud replication (not sharding) instead (Solr 4+). Then you will have full set of data in each core.