Details

    • Type: Bug
    • Status: Reopened
    • Priority: Critical
    • Resolution: Unresolved
    • Affects Version/s: 4.4.2, 5.0.1, 5.1.0
    • Fix Version/s: 5.1.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      All

      Description

      Lucene is holding on all requests in which some indexing in lucene needs to take place...
      It boils down to LuceneUtil.getWriter(companyId) never ever comming back and waiting forever.
      The issues is caused by a stale write.lock index in the ~/liferay/lucene/COMPANYID/ folder

      Here is what i'm doing:
      1 - I am simulating the lock by just adding it manually. This works just as if the lock was left there by a leaking process.
      2 - I restart the app server and attempt to save something that needs a lucene writer.
      3 - The very first time, there is a lock timeout exception in IndexWriterFactory, around line 180 in 4.3.1, 188 on trunk:

      IndexWriter writer = new IndexWriter
      LuceneUtil.getLuceneDir(companyId)
      LuceneUtil.getAnalyzer(), create);

      Which makes sense...
      4 - The main problen now is that, around line 204, in the finally clause, the releaseLock method is never called, hasError == true, but newWriter == false... So there is a proces which now has a lock on the writer, that didn't get the writer and will never get the writer... It is just a roadblock for anywone requesting the writer in the future...

      finally {
      if (hasError && newWriter) {
      try

      { releaseLock(companyId); }

      catch (Exception e) {
      }
      }
      }

      5 - So... we are left with what seems to be a deadlock... Removing the stale lock doesn't do anything, cuz now it is the Semaphore holding the queue, not the lock itself...

      I kind of wish there was a max time for a process to be in the semaphore queue, but it doesn't look like the semaphore being used has that capability...
      Another issue would be do identify a stale lock and actually erase it, but seems pointless w/o making sure that the locks liferay is creating get released propperly...
      It seems simple enough to modify the code to release the lock on any error, regardless of being a newWriter or not, but, i just don't know, liferay must have put that there for some reason!

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:

                Subcomponents