Re: infinite loop performing a SQLTemplate query - Clues Found

From: Bryan Lewis (brya..aine.rr.com)
Date: Wed Feb 01 2006 - 17:53:46 EST

  • Next message: Andrus Adamchik: "Re: infinite loop performing a SQLTemplate query - Clues Found"

    Andrus, I did a thread-dump during the hang as you suggested.

    "http-8080-Processor23" daemon prio=10 tid=0x014b1bb0 nid=0x2d runnable
    [0xdca7c000..0xdca7fb70]
            at
    org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
            at org.apache.log4j.Category.callAppenders(Category.java:194)
            - locked <0xe98641e8> (a org.apache.log4j.spi.RootLogger)
            at org.apache.log4j.Category.forcedLog(Category.java:379)
            at org.apache.log4j.Category.log(Category.java:826)
            at
    org.objectstyle.cayenne.access.QueryLogger.logUpdateCount(QueryLogger.java:399)
            at
    org.objectstyle.cayenne.access.jdbc.SQLTemplateAction.performAction(SQLTemplateAction.java:178)
            at
    org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:95)
            at
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:321)
            at
    org.objectstyle.cayenne.access.DataDomainQueryAction.performQuery(DataDomainQueryAction.java:107)
            at
    org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:643)
            at
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1100)
            at
    org.objectstyle.cayenne.access.Transaction.performQueries(Transaction.java:207)
            at
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1068)
            at
    org.objectstyle.cayenne.access.DataContextSelectAction.performQuery(DataContextSelectAction.java:173)
            at
    org.objectstyle.cayenne.access.DataContextSelectAction.performQuery(DataContextSelectAction.java:93)
            at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1200)
            at model.YPSearchData.tryQuery(YPSearchData.java:227)

    A second time:

    "http-8080-Processor25" daemon prio=10 tid=0x015fe538 nid=0x2f runnable
    [0xdc87c000..0xdc87f9f0]
            at java.io.FileOutputStream.write(FileOutputStream.java:260)
            at
    sun.nio.cs.StreamEncoder$CharsetSE.writeBytes(StreamEncoder.java:336)
            at
    sun.nio.cs.StreamEncoder$CharsetSE.implFlushBuffer(StreamEncoder.java:404)
            at
    sun.nio.cs.StreamEncoder$CharsetSE.implFlush(StreamEncoder.java:408)
            at sun.nio.cs.StreamEncoder.flush(StreamEncoder.java:152)
            - locked <0xe88c3f48> (a java.io.OutputStreamWriter)
            at java.io.OutputStreamWriter.flush(OutputStreamWriter.java:213)
            at org.apache.log4j.helpers.QuietWriter.flush(QuietWriter.java:49)
            at
    org.apache.log4j.WriterAppender.subAppend(WriterAppender.java:306)
            at
    org.apache.log4j.DailyRollingFileAppender.subAppend(DailyRollingFileAppender.java:349)
            at org.apache.log4j.WriterAppender.append(WriterAppender.java:150)
            at
    org.apache.log4j.AppenderSkeleton.doAppend(AppenderSkeleton.java:221)
            - locked <0xe88c3ce0> (a org.apache.log4j.DailyRollingFileAppender)
            at
    org.apache.log4j.helpers.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:57)
            at org.apache.log4j.Category.callAppenders(Category.java:194)
            - locked <0xf769fd48> (a org.apache.log4j.spi.RootLogger)
            at org.apache.log4j.Category.forcedLog(Category.java:379)
            at org.apache.log4j.Category.log(Category.java:826)
            at
    org.objectstyle.cayenne.access.QueryLogger.logUpdateCount(QueryLogger.java:399)
            at
    org.objectstyle.cayenne.access.jdbc.SQLTemplateAction.performAction(SQLTemplateAction.java:178)
            at
    org.objectstyle.cayenne.access.DataNodeQueryAction.runQuery(DataNodeQueryAction.java:95)
            at
    org.objectstyle.cayenne.access.DataNode.performQueries(DataNode.java:321)
            at
    org.objectstyle.cayenne.access.DataDomainQueryAction.performQuery(DataDomainQueryAction.java:107)
            at
    org.objectstyle.cayenne.access.DataDomain.performQueries(DataDomain.java:643)
            at
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1100)
            at
    org.objectstyle.cayenne.access.Transaction.performQueries(Transaction.java:207)
            at
    org.objectstyle.cayenne.access.DataContext.performQueries(DataContext.java:1068)
            at
    org.objectstyle.cayenne.access.DataContextSelectAction.performQuery(DataContextSelectAction.java:173)
            at
    org.objectstyle.cayenne.access.DataContextSelectAction.performQuery(DataContextSelectAction.java:93)
            at
    org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1200)
            at model.YPSearchData.tryQuery(YPSearchData.java:227)
            at model.YPSearchData.getYPSearchData(YPSearchData.java:47)

    At first glance I thought it was log4j that was hanging but maybe
    not.... I tried it again with cayenne's log level to ERROR. No log
    messages appeared during the hang but the hang still happened.

    Then I noticed that the problem happened only when the sql command
    didn't return a value, a 'delete' or 'insert'. Other 'select' commands
    were fine. This particular bit of code was doing only two commands, a
    delete and an insert, so I moved them to a stored procedure and invoked
    it with a ProcedureQuery. That worked.

    I'm going on a week's vacation tomorrow and won't have time to put
    together a good test case. Hoping the above info will help for now.

    Bryan Lewis wrote:

    >I have some code that worked well in earlier versions of Cayenne (1.2M4
    >or before) but now it goes into an infinite loop.
    >
    > String sql = "delete from Search_Data where UserName = 'joe'";
    > SQLTemplate query = new SQLTemplate(Company.class, sql);
    > dc.performQuery(query);
    >
    >The query is deleting all the rows from the user's previous search. In
    >this case there are 20 rows.
    >
    >The code enters the performQuery() but never comes out. The log shows
    >an infinite list of this message:
    >
    > [QueryLogger] === updated 20 rows.
    >
    >
    >
    >



    This archive was generated by hypermail 2.0.0 : Wed Feb 01 2006 - 17:53:52 EST