]> git.evergreen-ils.org Git - working/Evergreen.git/commit
LP#1509479: fix infinite loop bug in QueryParser
authorGalen Charlton <gmc@esilibrary.com>
Fri, 23 Oct 2015 19:23:05 +0000 (19:23 +0000)
committerDan Scott <dscott@laurentian.ca>
Sat, 24 Oct 2015 03:18:52 +0000 (23:18 -0400)
commitb517367f16163026aa12459e9c3913003f94eab4
treeded11017712998f5b4c64c8a9f48626141fabd78
parent01b02553359a0c8b2cbd2d8fabc06c6d626b2f08
LP#1509479: fix infinite loop bug in QueryParser

An unclosed phrase search that has a modifier can cause QueryParser to
enter an infinite loop, tying up open-ils.storage backends.

Examples of such searches include:

  -"cats and dogs
  subject:+"physical chemistry

This patch fixes the bug by allowing the end of the query string
to terminate a phrase (in addition to a quotation mark).

To test:

[1] Verify that the t/21-QueryParser.t unit test passes
[2] To test in a *development* database, before applying the patch
    run one of the example queries.  Observe that no
    results are returned, and that one of the open-ils.storage
    drones is running at 100% CPU.
[3] Apply the patch and restart the open-ils.storage service.
[4] Try the query again; this time, it should return results
    immediately without causing an open-ils.storage drone to
    peg a CPU.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Dan Scott <dscott@laurentian.ca>
Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/QueryParser.pm
Open-ILS/src/perlmods/t/21-QueryParser.t