title: How to solve the 'Lock obtain timed out' when using Solr plainly?
body: <p>I have two cores for our Solr system (Solr version 3.6.1). When I invoke the following command line on our dedicated Solr server to add and then index a file:</p>
  
  <pre><code>java -Durl=http://solrprod:8080/solr/original/update -jar /home/solr/solr3/biomina/solr/post.jar /home/solr/tmp/2008/c2m-dump-01.noDEID_clean.xml
  </code></pre>
  
  <p>I get an exception in <code>/usr/share/tomcat7/logs/solr.2013-12-11.log</code> file (after about 6 minutes of waiting):</p>
  
  <pre><code>SEVERE: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/solr/solr3/biomina/solr/original/data/index/write.lock
  </code></pre>
  
  <p>(You can see the detailed output of it at the end of this message).</p>
  
  <p>I tried to modify the time-out for locks (by setting <code>writeLockTimeout</code> to <code>300000</code>) , but this did not solve the problem. I'm not using any custom script, just the <code>post.jar</code> that comes with Solr 3.1.6, to add and index.</p>
  
  <p>Any ideas about what needs to be changed to get rid of this error and successfully add the XML file about to Solr and index it?</p>
  
  <p><strong>Contents of <code>/home/solr/solr3/biomina/solr/solr.xml</code>:</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" ?&gt;
  &lt;!--
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at
  
       http://www.apache.org/licenses/LICENSE-2.0
  
   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
  --&gt;
  
  &lt;!--
   All (relative) paths are relative to the installation path
  
    persistent: Save changes made via the API to this file
    sharedLib: path to a lib directory that will be shared across all cores
  --&gt;
  &lt;solr persistent="true"&gt;
  
    &lt;!--
    adminPath: RequestHandler path to manage cores.  
      If 'null' (or absent), cores will not be manageable via request handler
    --&gt;
    &lt;cores adminPath="/admin/cores"&gt;
      &lt;core name="original" instanceDir="original" /&gt;
      &lt;core name="deidentified" instanceDir="deidentified" /&gt;
    &lt;/cores&gt;
  &lt;/solr&gt;
  </code></pre>
  
  <p><strong>Relevat part of solrconfig.xml (for the core named <code>original</code>):</strong></p>
  
  <pre><code>&lt;indexConfig&gt;
      &lt;!-- maxFieldLength specifies max number of *tokens* indexed per 
  field. Default: 10000 --&gt;
      &lt;!-- &lt;maxFieldLength&gt;10000&lt;/maxFieldLength&gt;  --&gt;
      &lt;!-- Maximum time to wait for a write lock (ms) for an IndexWriter. 
  Default: 1000 --&gt;
      &lt;writeLockTimeout&gt;300000&lt;/writeLockTimeout&gt;
  </code></pre>
  
  <p><strong>Relevat part of solrconfig.xml (for the core named <code>deidentified</code>):</strong></p>
  
  <pre><code>&lt;indexConfig&gt;
      &lt;!-- maxFieldLength specifies max number of *tokens* indexed per 
  field. Default: 10000 --&gt;
      &lt;!-- &lt;maxFieldLength&gt;10000&lt;/maxFieldLength&gt;  --&gt;
      &lt;!-- Maximum time to wait for a write lock (ms) for an IndexWriter. 
  Default: 1000 --&gt;
      &lt;writeLockTimeout&gt;300000&lt;/writeLockTimeout&gt;
  </code></pre>
  
  <p><strong>Detailed Output of Exception</strong></p>
  
  <pre><code>Dec 11, 2013 11:27:25 AM org.apache.solr.core.SolrCore execute
  INFO: [original] webapp=/solr path=/update params={} status=500 QTime=300070 
  Dec 11, 2013 11:32:25 AM org.apache.solr.common.SolrException log
  SEVERE: org.apache.lucene.store.LockObtainFailedException: Lock obtain timed out: NativeFSLock@/home/solr/solr3/biomina/solr/original/data/index/write.lock
      at org.apache.lucene.store.Lock.obtain(Lock.java:84)
      at org.apache.lucene.index.IndexWriter.&lt;init&gt;(IndexWriter.java:1098)
      at org.apache.solr.update.SolrIndexWriter.&lt;init&gt;(SolrIndexWriter.java:84)
      at org.apache.solr.update.UpdateHandler.createMainIndexWriter(UpdateHandler.java:101)
      at org.apache.solr.update.DirectUpdateHandler2.openWriter(DirectUpdateHandler2.java:171)
      at org.apache.solr.update.DirectUpdateHandler2.addDoc(DirectUpdateHandler2.java:219)
      at org.apache.solr.update.processor.RunUpdateProcessor.processAdd(RunUpdateProcessorFactory.java:61)
      at org.apache.solr.update.processor.LogUpdateProcessor.processAdd(LogUpdateProcessorFactory.java:115)
      at org.apache.solr.handler.XMLLoader.processUpdate(XMLLoader.java:157)
      at org.apache.solr.handler.XMLLoader.load(XMLLoader.java:79)
      at org.apache.solr.handler.ContentStreamHandlerBase.handleRequestBody(ContentStreamHandlerBase.java:58)
      at org.apache.solr.handler.RequestHandlerBase.handleRequest(RequestHandlerBase.java:129)
      at org.apache.solr.core.SolrCore.execute(SolrCore.java:1376)
      at org.apache.solr.servlet.SolrDispatchFilter.execute(SolrDispatchFilter.java:365)
      at org.apache.solr.servlet.SolrDispatchFilter.doFilter(SolrDispatchFilter.java:260)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
      at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
      at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
      at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
      at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1156)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:626)
      at java.lang.Thread.run(Thread.java:804)
  
  Dec 11, 2013 11:32:25 AM org.apache.solr.core.SolrCore execute
  INFO: [original] webapp=/solr path=/update params={} status=500 QTime=556916
  </code></pre>
  
  <p><strong>System details:</strong></p>
  
  <pre><code>uname -a
  
  Linux solrprod 3.0.93-0.8-default #1 SMP Tue Aug 27 08:44:18 UTC 2013 (70ed288) x86_64 x86_64 x86_64 GNU/Linux
  
  java -version
  
  java version "1.7.0"
  Java(TM) SE Runtime Environment (build pxa6470sr6-20131015_01(SR6))
  IBM J9 VM (build 2.6, JRE 1.7.0 Linux amd64-64 Compressed References 20131013_170512 (JIT enabled, AOT enabled)
  J9VM - R26_Java726_SR6_20131013_1510_B170512
  JIT  - r11.b05_20131003_47443
  GC   - R26_Java726_SR6_20131013_1510_B170512_CMPRSS
  J9CL - 20131013_170512)
  JCL - 20131011_01 based on Oracle 7u45-b18
  </code></pre>