Lucene - Core
  1. Lucene - Core
  2. LUCENE-2620

Queries with too many asterisks causing 100% CPU usage

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.1
    • Fix Version/s: 2.9.4, 3.0.3, 3.1
    • Component/s: core/search
    • Labels:
      None
    • Environment:

      Debian Lenny with Tomcat 5.5 and Mac OS X 10.6 with Tomcat 6, probably others

    • Lucene Fields:
      New, Patch Available

      Description

      If a search query has many adjacent asterisks (e.g. fo**************obar), I can get my webapp caught in a loop that does not seem to end in a reasonable amount of time and may in fact be infinite. For just a few asterisks the query eventually does return some results, but as I add more it takes a longer and longer amount of time. After about six or seven asterisks the query never seems to finish. Even if I abort the search, the thread handling the troublesome query continues running in the background and pinning a CPU.

      I found the problem in src/java/org/apache/lucene/search/WildcardTermEnum.java on Lucene 3.0.1 and it looks like 3.0.2 ought to be affected as well. I'm not sure about trunk, though. I have a patch that fixes the problem for me in 3.0.1.

      1. lucene-asterisks.diff
        0.6 kB
        Nick Barkas
      2. LUCENE-2620_3x.patch
        2 kB
        Robert Muir

        Activity

        Nick Barkas created issue -
        Nick Barkas made changes -
        Field Original Value New Value
        Attachment lucene-asterisks.diff [ 12452946 ]
        Robert Muir made changes -
        Assignee Robert Muir [ rcmuir ]
        Robert Muir made changes -
        Attachment LUCENE-2620_3x.patch [ 12452947 ]
        Robert Muir made changes -
        Fix Version/s 2.9.4 [ 12315148 ]
        Fix Version/s 3.0.3 [ 12315147 ]
        Fix Version/s 3.1 [ 12314822 ]
        Robert Muir made changes -
        Resolution Fixed [ 1 ]
        Status Open [ 1 ] Resolved [ 5 ]
        Uwe Schindler made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Mark Thomas made changes -
        Workflow jira [ 12518795 ] Default workflow, editable Closed status [ 12564306 ]
        Mark Thomas made changes -
        Workflow Default workflow, editable Closed status [ 12564306 ] jira [ 12584840 ]

          People

          • Assignee:
            Robert Muir
            Reporter:
            Nick Barkas
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development