Just a bug report since there doesn't seem to be a reporting facility on the torque 
page:

If you do a LargeSelect where the criteria contains a "LIKE" comparator on a numeric 
field, the background torque thread will throw a ClassCastException and then never 
signal the waiting LargeSelect thread, effectively hanging it.

For example, consider the following code where Reader.gender is a numeric field:

    Criteria crit = new Criteria();
    ...
    crit.add(ReaderPeer.GENDER, 1, Criteria.LIKE);
    ....
    LargeSelect results = LargeSelect(crit, 25, ReaderPeer.class.getName());

When you try to get data from results, the thread that gets the data will throw an 
exception and leave the LargeSelect thread hanging:

2004-04-26 10:24:02,527 [http8080-Processor25] DEBUG 
org.apache.torque.util.LargeSelect  - getResults(start: 0, size: 25) invoked.
2004-04-26 10:24:02,527 [http8080-Processor25] DEBUG 
org.apache.torque.util.LargeSelect  - getResults(): Sleeping until start+size-1 (24) > 
currentlyFilledTo (-1) && !queryComple
ted (!false)
java.lang.ClassCastException
        at org.apache.torque.util.SqlExpression.build(SqlExpression.java:299)
        at org.apache.torque.util.Criteria$Criterion.appendTo(Criteria.java:3309)
        at org.apache.torque.util.Criteria$Criterion.toString(Criteria.java:3449)
        at org.apache.torque.util.BasePeer.createQuery(BasePeer.java:1146)
        at org.apache.torque.util.BasePeer.createQueryString(BasePeer.java:984)
        at org.apache.torque.util.LargeSelect.run(LargeSelect.java:707)
        at java.lang.Thread.run(Thread.java:536)

# kill -QUIT 2524
Full thread dump Java HotSpot(TM) Client VM (1.4.1_01-b01 mixed mode):
...
"http8080-Processor25" daemon prio=1 tid=0x0x8117e38 nid=0x83f waiting on condition 
[4e050000..4e051830]
        at java.lang.Thread.sleep(Native Method)
        at org.apache.torque.util.LargeSelect.getResults(LargeSelect.java:595)
        - locked <0x44375cd8> (a org.apache.torque.util.LargeSelect)
        at org.apache.torque.util.LargeSelect.getResults(LargeSelect.java:547)
        at org.apache.torque.util.LargeSelect.getPage(LargeSelect.java:475)
        at com.somewhere.event.Paginator.getPage(Paginator.java:22)
        ...

Of course you shouldn't be calling a LIKE comparator on a numeric field, but I can't 
help but wonder what other exceptions will cause LargeSelect to hang.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to