[CWB] [cwb:feature-requests] #66 Cleanly avoid infinite loop queries

Andrew Hardie andrewhardie at users.sourceforge.net
Thu Apr 8 02:32:27 CEST 2021


- Description has changed:

Diff:

~~~~

--- old
+++ new
@@ -1,25 +1,27 @@
 In version 3, the following (meaningless) query used to get caught in an infinite loop, i.e. CQP runs forever with full CPU power.
 
-"<s> * </s>"
+    "<s> * </s>"
 
 (this was bug #4: https://sourceforge.net/p/cwb/bugs/4/ )
 
 The explanation:
 
-==================
+(begin quote)==================
+
 What happens is that in the FSA constructed from the query,
-<s> is a transition that does not "consume" a token, so <s>*
-(Kleene star over <s>) effectively generates an eps-loop at
+&lt;s> is a transition that does not "consume" a token, so &lt;s>*
+(Kleene star over &lt;s>) effectively generates an eps-loop at
 the start state of the FSA. Normally, such errors are
 caught because the start state is also a final state (the
-query "<s> *" would result in such an error message), but in
-this case, the additional constraint </s> (which can never
+query "&lt;s> \*" would result in such an error message), but in
+this case, the additional constraint &lt;/s> (which can never
 be satisfied) inserts another transition.
 
 There should probably some test for eps-loops in the FSA
 simulation, which can never do anything useful (unless I'm
 mistaken).
-==================
+
+(end quote)==================
 
 The bug was fixed long ago, with a check for infinite loops which aborts CQP:
 

~~~~

- **assigned_to**: Stefan Evert



---

** [feature-requests:#66] Cleanly avoid infinite loop queries**

**Status:** open
**Group:** TODO-4.0
**Labels:** CQP engine 
**Created:** Thu Apr 08, 2021 12:30 AM UTC by Andrew Hardie
**Last Updated:** Thu Apr 08, 2021 12:30 AM UTC
**Owner:** Stefan Evert


In version 3, the following (meaningless) query used to get caught in an infinite loop, i.e. CQP runs forever with full CPU power.

    "<s> * </s>"

(this was bug #4: https://sourceforge.net/p/cwb/bugs/4/ )

The explanation:

(begin quote)==================

What happens is that in the FSA constructed from the query,
<s> is a transition that does not "consume" a token, so <s>*
(Kleene star over <s>) effectively generates an eps-loop at
the start state of the FSA. Normally, such errors are
caught because the start state is also a final state (the
query "<s> \*" would result in such an error message), but in
this case, the additional constraint </s> (which can never
be satisfied) inserts another transition.

There should probably some test for eps-loops in the FSA
simulation, which can never do anything useful (unless I'm
mistaken).

(end quote)==================

The bug was fixed long ago, with a check for infinite loops which aborts CQP:

    CQP Error:
    Infinite loop detected: did you quantify over a zero-width element (XML tag or lookahead)?
    If you are reasonably sure that your query is valid, please contact the CWB development team and file a bug report!
    Query execution aborted.

But, as Stefan noted,

"due to the messy internals of the query implementation, it may still be possible to write CQP queries that trigger an infinite loop. A clean solution will be possible when the query evaluation mechanism is completely overhauled for CWB 4.0. We should keep the ticket pending until then so we remember to consider the case of such "empty loop" queries."

This FR records the need for a clean mechanism to avoid such infinite loops in CWB4.



---

Sent from sourceforge.net because cwb at sslmit.unibo.it is subscribed to https://sourceforge.net/p/cwb/feature-requests/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/cwb/admin/feature-requests/options.  Or, if this is a mailing list, you can unsubscribe from the mailing list.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://liste.sslmit.unibo.it/pipermail/cwb/attachments/20210408/48180a00/attachment.html>


More information about the CWB mailing list