FAQ
Hi,

I'm not sure where to post it, but because I get this error by cayenne I try it first here. A few days ago I reported a NPE within the class apache.commons.map.LRUMap wich is used by the class "DataRowStore". After synchronizing all access to the corresponding field the NPE went away but now I have another exception:

2006-06-14 00:26:22,359 [ERROR] BaseDataLoggerGate.com.sunreader.sr2.gate.BaseDataLoggerGate.doPost: >
java.lang.IllegalStateException: Entry.next=null, data[removeIndex]=[values={description=inserted, status=ins}, version=-9223372036854491432, replaces=-9223372036854775808] previous=[values={tempValue=31.35, efficiencyValue=1.0761, effBlockDataId=24455598, energyValue=8.16, efficiencyBlockId=767, status=ins, irradiationValue=673.98, earnings=4.4064, importEffBlockDataId=1042169, dataDate=Mon Jun 12 11:30:00 CEST 2006, co2Saving=6.12}, version=-9223372036854494908, replaces=-9223372036854495032] key=<ObjectId:TblLoggerloggerId=923> value=org.objectstyle.cayenne.DataRow@1a87890[values={plantId=923, newSerialNumber=null, commChannelType=analog, loggerProductId=1, loggerId=923, serialNumber=DL-NE101-01331, commChannelManufacturer=Conergy}, version=-9223372036854491407, replaces=-9223372036854775808] size=10000 maxSize=10000
Please check that your keys are immutable, and that you have used synchronization properly. If so, then please report this to commons-dev@jakarta.apache.org as a bug.
at org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:300)
at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:266)
at org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:283)
at org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots(DataRowStore.java:621)
at org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges(DataRowStore.java:575)
at org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects(DataRowStore.java:314)
at org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:159)
at org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:134)
at org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:375)
at org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151)
at org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:765)
at org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:253)
at org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90)
at org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1422)
at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1411)
at com.conergy.sunreader.sr2.back.dao.ProductDAO.isLoggerAlreadyAvailable(Unknown Source)

I't would be glad to get an answer as far as possible.

Thanks, Lothar
______________________________________________________________________
XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130

Search Discussions

  • Andrus Adamchik at Jun 14, 2006 at 4:35 pm
    While I don't have the answers, it would be helpful if you could
    provide more details:

    1. What version of commons-collections do you have (I checked 3.1 and
    the line numbers do not match with the stack below)
    2. Does it happen as a result of a certain sequence of events, or
    does it happen randomly under heavy load?

    Andrus

    On Jun 14, 2006, at 8:21 PM, Lothar Krenzien wrote:

    Hi,

    I'm not sure where to post it, but because I get this error by
    cayenne I try it first here. A few days ago I reported a NPE within
    the class apache.commons.map.LRUMap wich is used by the class
    "DataRowStore". After synchronizing all access to the corresponding
    field the NPE went away but now I have another exception:

    2006-06-14 00:26:22,359 [ERROR]
    BaseDataLoggerGate.com.sunreader.sr2.gate.BaseDataLoggerGate.doPost: >
    java.lang.IllegalStateException: Entry.next=null, data[removeIndex]
    =<ObjectId:TblStatusstatus=ins>=org.objectstyle.cayenne.DataRow@1f1d2c
    e[values={description=inserted, status=ins},
    version=-9223372036854491432, replaces=-9223372036854775808]
    previous=<ObjectId:TblEffBlockDataeffBlockDataId=24455598>=org.objects
    tyle.cayenne.DataRow@4bac35[values={tempValue=31.35,
    efficiencyValue=1.0761, effBlockDataId=24455598, energyValue=8.16,
    efficiencyBlockId=767, status=ins, irradiationValue=673.98,
    earnings=4.4064, importEffBlockDataId=1042169, dataDate=Mon Jun 12
    11:30:00 CEST 2006, co2Saving=6.12}, version=-9223372036854494908,
    replaces=-9223372036854495032] key=<ObjectId:TblLoggerloggerId=923>
    value=org.objectstyle.cayenne.DataRow@1a87890[values={plantId=923,
    newSerialNumber=null, commChannelType=analog, loggerProductId=1,
    loggerId=923, serialNumber=DL-NE101-01331,
    commChannelManufacturer=Conergy}, version=-9223372036854491407,
    replaces=-9223372036854775808] size=10000 maxSize=10000
    Please check that your keys are immutable, and that you have used
    synchronization properly. If so, then please report this to commons-
    dev@jakarta.apache.org as a bug.
    at org.apache.commons.collections.map.LRUMap.reuseMapping
    (LRUMap.java:300)
    at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:
    266)
    at org.apache.commons.collections.map.AbstractHashedMap.put
    (AbstractHashedMap.java:283)
    at
    org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots
    (DataRowStore.java:621)
    at
    org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges
    (DataRowStore.java:575)
    at
    org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects
    (DataRowStore.java:314)
    at org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows
    (ObjectResolver.java:159)
    at
    org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromD
    ataRows(ObjectResolver.java:134)
    at
    org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectCo
    nversion(DataDomainQueryAction.java:375)
    at org.objectstyle.cayenne.access.DataDomainQueryAction.execute
    (DataDomainQueryAction.java:151)
    at org.objectstyle.cayenne.access.DataDomain.onQuery
    (DataDomain.java:765)
    at org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery
    (ObjectContextQueryAction.java:253)
    at org.objectstyle.cayenne.access.DataContextQueryAction.execute
    (DataContextQueryAction.java:90)
    at org.objectstyle.cayenne.access.DataContext.onQuery
    (DataContext.java:1422)
    at org.objectstyle.cayenne.access.DataContext.performQuery
    (DataContext.java:1411)
    at
    com.conergy.sunreader.sr2.back.dao.ProductDAO.isLoggerAlreadyAvailable
    (Unknown Source)

    I't would be glad to get an answer as far as possible.

    Thanks, Lothar
    ______________________________________________________________________
    XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
    Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130
  • Lothar Krenzien at Jun 15, 2006 at 9:43 am
    I'm using the recent 3.2 version of commons collection and the recent 1.2 RC1 cayenne version. The exception occurs mostly on high high activitity on the server. But then very often. Basicly my clients call a servlet and make a post. The servlet should import the posted data into a database (MSSQL 2000) using DAO classes. The relevant methods in the DAO classes are all synchronized (even it should not be necessary).

    Hope that helps
    Lothar
    While I don't have the answers, it would be helpful if you could
    provide more details:

    1. What version of commons-collections do you have (I checked 3.1 and
    the line numbers do not match with the stack below)
    2. Does it happen as a result of a certain sequence of events, or
    does it happen randomly under heavy load?

    Andrus

    On Jun 14, 2006, at 8:21 PM, Lothar Krenzien wrote:

    Hi,

    I'm not sure where to post it, but because I get this error by
    cayenne I try it first here. A few days ago I reported a NPE within
    the class apache.commons.map.LRUMap wich is used by the class
    "DataRowStore". After synchronizing all access to the corresponding
    field the NPE went away but now I have another exception:

    2006-06-14 00:26:22,359 [ERROR]
    BaseDataLoggerGate.com.sunreader.sr2.gate.BaseDataLoggerGate.doPost: >
    java.lang.IllegalStateException: Entry.next=null, data[removeIndex]
    =<ObjectId:TblStatusstatus=ins>=org.objectstyle.cayenne.DataRow@1f1d2c
    e[values={description=inserted, status=ins},
    version=-9223372036854491432, replaces=-9223372036854775808]
    previous=<ObjectId:TblEffBlockDataeffBlockDataId=24455598>=org.objects
    tyle.cayenne.DataRow@4bac35[values={tempValue=31.35,
    efficiencyValue=1.0761, effBlockDataId=24455598, energyValue=8.16,
    efficiencyBlockId=767, status=ins, irradiationValue=673.98,
    earnings=4.4064, importEffBlockDataId=1042169, dataDate=Mon Jun 12
    11:30:00 CEST 2006, co2Saving=6.12}, version=-9223372036854494908,
    replaces=-9223372036854495032] key=<ObjectId:TblLoggerloggerId=923>
    value=org.objectstyle.cayenne.DataRow@1a87890[values={plantId=923,
    newSerialNumber=null, commChannelType=analog, loggerProductId=1,
    loggerId=923, serialNumber=DL-NE101-01331,
    commChannelManufacturer=Conergy}, version=-9223372036854491407,
    replaces=-9223372036854775808] size=10000 maxSize=10000
    Please check that your keys are immutable, and that you have used
    synchronization properly. If so, then please report this to commons-
    dev@jakarta.apache.org as a bug.
    at org.apache.commons.collections.map.LRUMap.reuseMapping
    (LRUMap.java:300)
    at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:
    266)
    at org.apache.commons.collections.map.AbstractHashedMap.put
    (AbstractHashedMap.java:283)
    at
    org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots
    (DataRowStore.java:621)
    at
    org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges
    (DataRowStore.java:575)
    at
    org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects
    (DataRowStore.java:314)
    at org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows
    (ObjectResolver.java:159)
    at
    org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromD
    ataRows(ObjectResolver.java:134)
    at
    org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectCo
    nversion(DataDomainQueryAction.java:375)
    at org.objectstyle.cayenne.access.DataDomainQueryAction.execute
    (DataDomainQueryAction.java:151)
    at org.objectstyle.cayenne.access.DataDomain.onQuery
    (DataDomain.java:765)
    at org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery
    (ObjectContextQueryAction.java:253)
    at org.objectstyle.cayenne.access.DataContextQueryAction.execute
    (DataContextQueryAction.java:90)
    at org.objectstyle.cayenne.access.DataContext.onQuery
    (DataContext.java:1422)
    at org.objectstyle.cayenne.access.DataContext.performQuery
    (DataContext.java:1411)
    at
    com.conergy.sunreader.sr2.back.dao.ProductDAO.isLoggerAlreadyAvailable
    (Unknown Source)

    I't would be glad to get an answer as far as possible.

    Thanks, Lothar
    ______________________________________________________________________
    XXL-Speicher, PC-Virenschutz, Spartarife & mehr: Nur im WEB.DE Club!
    Jetzt gratis testen! http://freemail.web.de/home/landingpad/?mc=021130
  • Andrus Adamchik at Jun 15, 2006 at 9:52 am

    On Jun 15, 2006, at 1:43 PM, Lothar Krenzien wrote:

    I'm using the recent 3.2 version of commons collection and the
    recent 1.2 RC1 cayenne version. The exception occurs mostly on
    high high activitity on the server. But then very often. Basicly
    my clients call a servlet and make a post. The servlet should
    import the posted data into a database (MSSQL 2000) using DAO
    classes. The relevant methods in the DAO classes are all
    synchronized (even it should not be necessary).

    Hope that helps
    Lothar
    Thanks for the info. Can you downgrade to commons-collections 3.1?
    This is the version we are currently using in Cayenne, so this is the
    version I will be using as a part of CAY-565 investigation.

    Andrus
  • Lothar Krenzien at Jun 16, 2006 at 9:13 am
    I did it yesterday and now I'm getting the already known NPE again. And I'm sure that I didn't changed the cayenne version. But what I saw is that in the case of NPE always the same method of me is called. As a starting point I can synchronize the method, but it shouldn't be neccessary. Here's the method that causes the NPE:

    public boolean isLoggerAlreadyAvailable(DaoContextIfc ctx, String loggerSerialNumber) {
    DataContext context = getDaoContext(ctx);
    Expression expr = ExpressionFactory.matchExp("serialNumber", loggerSerialNumber).orExp(ExpressionFactory.matchExp("newSerialNumber", loggerSerialNumber));
    SelectQuery query = new SelectQuery(TblLogger.class, expr);
    List<TblLogger> loggerList = (List<TblLogger>) context.performQuery(query);
    if (loggerList.size() == 0) {
    return false;
    }
    return true;
    }

    No instance variables are used.

    I've seen also that the class 'SQLTemplateResourceManager' uses a LRUMap. And there wereall access to LRUMap already synchronized. Maybe you can take a look at that class.

    Another question :
    I have a class which is extended from 'WebApplicationListener'. In the method 'sessionDestroyed' the following code is executed :

    ObjectStore objectStore = dctx.getObjectStore();
    objectStore.objectsInvalidated(objectStore.getObjects());

    It that really neccessary ? The code was written by some programmers, which has leaved the company.

    Thank, Lothar
    -----Ursprüngliche Nachricht-----
    Von: cayenne-user@incubator.apache.org
    Gesendet: 15.06.06 11:51:59
    An: cayenne-user@incubator.apache.org
    Betreff: Re: IllegalStateException in DataRowStore (thrown by LRUMap)
    On Jun 15, 2006, at 1:43 PM, Lothar Krenzien wrote:

    I'm using the recent 3.2 version of commons collection and the
    recent 1.2 RC1 cayenne version. The exception occurs mostly on
    high high activitity on the server. But then very often. Basicly
    my clients call a servlet and make a post. The servlet should
    import the posted data into a database (MSSQL 2000) using DAO
    classes. The relevant methods in the DAO classes are all
    synchronized (even it should not be necessary).

    Hope that helps
    Lothar
    Thanks for the info. Can you downgrade to commons-collections 3.1?
    This is the version we are currently using in Cayenne, so this is the
    version I will be using as a part of CAY-565 investigation.

    Andrus

    _____________________________________________________________________
    Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
    http://smartsurfer.web.de/?mc=100071&distributionid=000000000071
  • Andrus Adamchik at Jun 16, 2006 at 9:27 am

    On Jun 16, 2006, at 1:12 PM, Lothar Krenzien wrote:

    I did it yesterday and now I'm getting the already known NPE again.
    And I'm sure that I didn't changed the cayenne version. But what I
    saw is that in the case of NPE always the same method of me is called.
    Very very strange... so this would confirm a suspicion that there is
    a bug in the LRUMap not related to synchronization.

    Another question :
    I have a class which is extended from 'WebApplicationListener'. In
    the method 'sessionDestroyed' the following code is executed :

    ObjectStore objectStore = dctx.getObjectStore();
    objectStore.objectsInvalidated(objectStore.getObjects());

    It that really neccessary ?
    It may or may not be useful. On the one hand, the ObjectStore is
    about to go out of scope at this point, so it (and all its objects)
    will be garbage collected without any extra help.

    One other thing that invalidate does is throwing away cached
    snapshots from the cache shared by other sessions. On the positive
    side it frees up some memory, on the negative - it removes items from
    cache that could've otherwise speed up object resolution in other
    sessions.

    I'd say keep it if your sessions share just a few objects between
    each other or share no objects at all; throw it away if the object
    sets significantly overlap between individual sessions.

    Andrus
  • Andrus Adamchik at Jun 19, 2006 at 9:03 am
    I did some research of CAY-565 over the weekend. Unfortunately I
    can't reproduce the issue.

    I wrote a test case that randomly performs one of the operations -
    select; insert of an object with relationship; object update; object
    delete with relationship. Running up to 30 parallel request threads
    with JMeter, I don't see any exceptions except for occasional fault
    failures (that are expected under these test conditions as I don't
    lock the objects). I even found and fixed an unrelated deadlock that
    I am sure nobody has ever seen in the wild (CAY-573)... still can't
    reproduce the LRUMap problem.

    I'll try to change the test conditions, but if Bryan or Lothar (two
    people who have experienced the issue) have any more insights on the
    ways to reproduce it, please share.

    Andrus

    On Jun 16, 2006, at 1:27 PM, Andrus Adamchik wrote:
    On Jun 16, 2006, at 1:12 PM, Lothar Krenzien wrote:

    I did it yesterday and now I'm getting the already known NPE
    again. And I'm sure that I didn't changed the cayenne version. But
    what I saw is that in the case of NPE always the same method of me
    is called.
    Very very strange... so this would confirm a suspicion that there
    is a bug in the LRUMap not related to synchronization.

    Another question :
    I have a class which is extended from 'WebApplicationListener'. In
    the method 'sessionDestroyed' the following code is executed :

    ObjectStore objectStore = dctx.getObjectStore();
    objectStore.objectsInvalidated(objectStore.getObjects());

    It that really neccessary ?
    It may or may not be useful. On the one hand, the ObjectStore is
    about to go out of scope at this point, so it (and all its objects)
    will be garbage collected without any extra help.

    One other thing that invalidate does is throwing away cached
    snapshots from the cache shared by other sessions. On the positive
    side it frees up some memory, on the negative - it removes items
    from cache that could've otherwise speed up object resolution in
    other sessions.

    I'd say keep it if your sessions share just a few objects between
    each other or share no objects at all; throw it away if the object
    sets significantly overlap between individual sessions.

    Andrus
  • Bryan Lewis at Jun 19, 2006 at 3:02 pm
    Sorry I can't be of more help. The exception happened to us only once.
    I rechecked the log but I don't see anything unusual... the number of
    users was high but not abnormal (56 users is high-ish for us). It
    happened on a normal SelectQuery with a single matchExp, an ordering and
    a fetchLimit, fetching from a simple flat entity -- eight attributes
    with no relationships. I suspect it's some intermittent timing/race
    thing. Maybe let your JMeter test run for a week?


    Andrus Adamchik wrote:
    I did some research of CAY-565 over the weekend. Unfortunately I
    can't reproduce the issue.

    I wrote a test case that randomly performs one of the operations -
    select; insert of an object with relationship; object update; object
    delete with relationship. Running up to 30 parallel request threads
    with JMeter, I don't see any exceptions except for occasional fault
    failures (that are expected under these test conditions as I don't
    lock the objects). I even found and fixed an unrelated deadlock that
    I am sure nobody has ever seen in the wild (CAY-573)... still can't
    reproduce the LRUMap problem.

    I'll try to change the test conditions, but if Bryan or Lothar (two
    people who have experienced the issue) have any more insights on the
    ways to reproduce it, please share.

    Andrus

    On Jun 16, 2006, at 1:27 PM, Andrus Adamchik wrote:
    On Jun 16, 2006, at 1:12 PM, Lothar Krenzien wrote:

    I did it yesterday and now I'm getting the already known NPE again.
    And I'm sure that I didn't changed the cayenne version. But what I
    saw is that in the case of NPE always the same method of me is called.

    Very very strange... so this would confirm a suspicion that there is
    a bug in the LRUMap not related to synchronization.

    Another question :
    I have a class which is extended from 'WebApplicationListener'. In
    the method 'sessionDestroyed' the following code is executed :

    ObjectStore objectStore = dctx.getObjectStore();
    objectStore.objectsInvalidated(objectStore.getObjects());

    It that really neccessary ?

    It may or may not be useful. On the one hand, the ObjectStore is
    about to go out of scope at this point, so it (and all its objects)
    will be garbage collected without any extra help.

    One other thing that invalidate does is throwing away cached
    snapshots from the cache shared by other sessions. On the positive
    side it frees up some memory, on the negative - it removes items
    from cache that could've otherwise speed up object resolution in
    other sessions.

    I'd say keep it if your sessions share just a few objects between
    each other or share no objects at all; throw it away if the object
    sets significantly overlap between individual sessions.

    Andrus
  • Lothar Krenzien at Jun 19, 2006 at 11:00 am
    Hi Andrus,

    thanks for your effort. The IllegalStateException occured (for me) only after synchronzied all methods that uses the LRUMap and with Apache Commons 3.2. After changed back to 3.1 I can't reproduce it. But as I mentioned earlier I get lots (!) of NPE in LRU map. The problem is, that we get this error only after a while when the server is under heavy load. Our application is a struts based application with a JSP / HTML frontend and Tomcat 5.5.15. Additionally there are two servlets for importing data in the database (MSSQL 2000).


    I posted the exception also in the apache commons group. So here's there answer. As I understood it could be synchronizing problem or a problem with immutable keys. Maybe it helps you.

    --------------------------------------------------------------------------------------------------------------------------------------------------------
    Can you also check all loops of the map are synchronized correctly:

    synchronied (map) {
    Iterator it = mpap.keySet().iterator();
    while (it.hasNext()) {
    ..
    }
    }

    and so on. The synchronized MUST be around the whole looping.

    Stephen


    Hi there,

    we used Version 3.2 and synchronized all access to LRUMap. WE get this IllegalStateException. Can you reproduce this behauviour?





    2006-06-14 00:26:22,359 [ERROR] BaseDataLoggerGate.com.sunreader.sr2.gate.BaseDataLoggerGate.doPost: >
    java.lang.IllegalStateException: Entry.next=null, data[removeIndex]=<ObjectId:TblStatusstatus=ins>=org.objectstyle.cayenne.DataRo..f1d2ce[values={description=inserted, status=ins}, version=-9223372036854491432, replaces=-9223372036854775808] previous=[values={tempValue=31.35, efficiencyValue=1.0761, effBlockDataId=24455598, energyValue=8.16, efficiencyBlockId=767, status=ins, irradiationValue=673.98, earnings=4.4064, importEffBlockDataId=1042169, dataDate=Mon Jun 12 11:30:00 CEST 2006, co2Saving=6.12}, version=-9223372036854494908, replaces=-9223372036854495032] key=<ObjectId:TblLoggerloggerId=923> value=org.objectstyle.cayenne.DataRow@1a87890[values={plantId=923, newSerialNumber=null, commChannelType=analog, loggerProductId=1, loggerId=923, serialNumber=DL-NE101-01331, commChannelManufacturer=Conergy}, version=-9223372036854491407, replaces=-9223372036854775808] size=10000 maxSize=1000
    Please check that your keys are immutable, and that you have used synchronization properly. If so, then please report this to commons-de..akarta.apache.org as a bug.
    at org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:300)
    at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:266)
    at org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:283)
    at org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots(DataRowStore.java:621)
    at org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges(DataRowStore.java:575)
    at org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects(DataRowStore.java:314)
    at org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:159)
    at org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:134)
    at org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:375)
    at org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151)
    at org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:765)
    at org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:253)
    at org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90)
    at org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1422)
    at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1411)
    at com.sunreader.sr2.back.dao.ProductDAO.isLoggerAlreadyAvailable(Unknown Source)


    Thanks a lot,




    After extensive testing, we can only reproduce this when the map has not
    been correctly synchronized, or a mutable key has been used (as opposed
    to an immutable one).

    If you upgrade to collections v3.2 you will get extra logging which may
    help diagnose the problem.

    Stephen

    Hi all,

    I am working with Cayenne and I ´ve get the following Exception:

    Caused by: java.lang.NullPointerException
    at org.apache.commons.collections.map.LRUMap.reuseMapping(LRUMap.java:272)
    at org.apache.commons.collections.map.LRUMap.addMapping(LRUMap.java:243)
    at org.apache.commons.collections.map.AbstractHashedMap.put(AbstractHashedMap.java:282)
    at org.objectstyle.cayenne.access.DataRowStore.processUpdatedSnapshots(DataRowStore.java:621)
    at org.objectstyle.cayenne.access.DataRowStore.processSnapshotChanges(DataRowStore.java:575)
    at org.objectstyle.cayenne.access.DataRowStore.snapshotsUpdatedForObjects(DataRowStore.java:314)
    at org.objectstyle.cayenne.access.ObjectResolver.objectsFromDataRows(ObjectResolver.java:159)
    at org.objectstyle.cayenne.access.ObjectResolver.synchronizedObjectsFromDataRows(ObjectResolver.java:134)
    at org.objectstyle.cayenne.access.DataDomainQueryAction.interceptObjectConversion(DataDomainQueryAction.java:375)
    at org.objectstyle.cayenne.access.DataDomainQueryAction.execute(DataDomainQueryAction.java:151)
    at org.objectstyle.cayenne.access.DataDomain.onQuery(DataDomain.java:765)
    at org.objectstyle.cayenne.util.ObjectContextQueryAction.runQuery(ObjectContextQueryAction.java:253)
    at org.objectstyle.cayenne.access.DataContextQueryAction.execute(DataContextQueryAction.java:90)
    at org.objectstyle.cayenne.access.DataContext.onQuery(DataContext.java:1422)
    at org.objectstyle.cayenne.access.DataContext.performQuery(DataContext.java:1411)
    at org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.doResolveFault(DataContextFaults.java:144)
    at org.objectstyle.cayenne.access.DataContextFaults$ToOneFault.resolveFault(DataContextFaults.java:117)
    at org.objectstyle.cayenne.CayenneDataObject.readProperty(CayenneDataObject.java:245)
    at com.sunreader.sr2.back.auto._TblAccount.getTblPerson(Unknown Source)
    at com.sunreader.sr2.back.dao.UserDAO.setAccountPersonData(Unknown Source)


    We have posted this exception in cayenne newsgroup before and we found out, that the
    caller of LRUMap is responsible for the thread safety. We´ve changed some methods calls in
    caeynne temporarily, but we still get this exception. Could anyone help us and tell, waht
    was going wrong here?
    We using commons-collection v.3.1

    This behauvior occurs when the machine is under heavy load and a lot threads access are created.
    Thanks in advance,
    -----Ursprüngliche Nachricht-----
    Von: cayenne-user@incubator.apache.org
    Gesendet: 19.06.06 11:03:45
    An: cayenne-user@incubator.apache.org
    Betreff: Re: IllegalStateException in DataRowStore (thrown by LRUMap)
    I did some research of CAY-565 over the weekend. Unfortunately I
    can't reproduce the issue.

    I wrote a test case that randomly performs one of the operations -
    select; insert of an object with relationship; object update; object
    delete with relationship. Running up to 30 parallel request threads
    with JMeter, I don't see any exceptions except for occasional fault
    failures (that are expected under these test conditions as I don't
    lock the objects). I even found and fixed an unrelated deadlock that
    I am sure nobody has ever seen in the wild (CAY-573)... still can't
    reproduce the LRUMap problem.

    I'll try to change the test conditions, but if Bryan or Lothar (two
    people who have experienced the issue) have any more insights on the
    ways to reproduce it, please share.

    Andrus

    On Jun 16, 2006, at 1:27 PM, Andrus Adamchik wrote:
    On Jun 16, 2006, at 1:12 PM, Lothar Krenzien wrote:

    I did it yesterday and now I'm getting the already known NPE
    again. And I'm sure that I didn't changed the cayenne version. But
    what I saw is that in the case of NPE always the same method of me
    is called.
    Very very strange... so this would confirm a suspicion that there
    is a bug in the LRUMap not related to synchronization.

    Another question :
    I have a class which is extended from 'WebApplicationListener'. In
    the method 'sessionDestroyed' the following code is executed :

    ObjectStore objectStore = dctx.getObjectStore();
    objectStore.objectsInvalidated(objectStore.getObjects());

    It that really neccessary ?
    It may or may not be useful. On the one hand, the ObjectStore is
    about to go out of scope at this point, so it (and all its objects)
    will be garbage collected without any extra help.

    One other thing that invalidate does is throwing away cached
    snapshots from the cache shared by other sessions. On the positive
    side it frees up some memory, on the negative - it removes items
    from cache that could've otherwise speed up object resolution in
    other sessions.

    I'd say keep it if your sessions share just a few objects between
    each other or share no objects at all; throw it away if the object
    sets significantly overlap between individual sessions.

    Andrus

    _____________________________________________________________________
    Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
    http://smartsurfer.web.de/?mc=100071&distributionid=000000000071
  • Andrus Adamchik at Jun 19, 2006 at 11:30 am

    On Jun 19, 2006, at 2:17 PM, Lothar Krenzien wrote:

    The IllegalStateException occured (for me) only after synchronzied
    all methods that uses the LRUMap and with Apache Commons 3.2.
    After changed back to 3.1 I can't reproduce it. But as I mentioned
    earlier I get lots (!) of NPE in LRU map.
    Yes, I am debugging the LRUMap NPE. I am not concerned with
    collections 3.2 at this point.

    http://issues.apache.org/cayenne/browse/CAY-565
    I posted the exception also in the apache commons group. So here's
    there answer. As I understood it could be synchronizing problem or
    a problem with immutable keys.
    But you are doing the synchronization already (you patched Cayenne,
    right?) and it still happens. And I am NOT using any extra
    synchronization and I can't reproduce it. Ideally I do not want to
    check in any "fixes" until I can consistently recreate the problem.

    Still shooting in the dark, but how about we do this - can you send
    me your DataMap (if you can without compromising the confidentiality
    of your work; in any event do not post it to Jira), indicating which
    entities change the most during the application normal execution
    (maybe a few typical commit SQL logs for commits that happen right
    before the errors start to show up). I want to see if there is
    anything "unusual" in the mapping that I should try in my own setup.

    What I've just realized is that the DataContext is obtained like
    this :

    import org.objectstyle.cayenne.conf.ServletUtil.
    ...
    ServletUtil.getSessionContext(request.getSession());


    In the user guide the following two methods are descriped:

    BasicServletConfiguration.getDefaultContext(session);
    DataContext.getThreadDataContext();

    Could that cause any problems ?
    No, in fact user guide needs an update.

    Andrus
  • Lothar Krenzien at Jun 19, 2006 at 11:09 am
    What I've just realized is that the DataContext is obtained like this :

    import org.objectstyle.cayenne.conf.ServletUtil.
    ...
    ServletUtil.getSessionContext(request.getSession());


    In the user guide the following two methods are descriped:

    BasicServletConfiguration.getDefaultContext(session);
    DataContext.getThreadDataContext();

    Could that cause any problems ?

    Lothar

    -----Ursprüngliche Nachricht-----
    Von: cayenne-user@incubator.apache.org
    Gesendet: 19.06.06 11:03:45
    An: cayenne-user@incubator.apache.org
    Betreff: Re: IllegalStateException in DataRowStore (thrown by LRUMap)
    I did some research of CAY-565 over the weekend. Unfortunately I
    can't reproduce the issue.

    I wrote a test case that randomly performs one of the operations -
    select; insert of an object with relationship; object update; object
    delete with relationship. Running up to 30 parallel request threads
    with JMeter, I don't see any exceptions except for occasional fault
    failures (that are expected under these test conditions as I don't
    lock the objects). I even found and fixed an unrelated deadlock that
    I am sure nobody has ever seen in the wild (CAY-573)... still can't
    reproduce the LRUMap problem.

    I'll try to change the test conditions, but if Bryan or Lothar (two
    people who have experienced the issue) have any more insights on the
    ways to reproduce it, please share.

    Andrus

    On Jun 16, 2006, at 1:27 PM, Andrus Adamchik wrote:
    On Jun 16, 2006, at 1:12 PM, Lothar Krenzien wrote:

    I did it yesterday and now I'm getting the already known NPE
    again. And I'm sure that I didn't changed the cayenne version. But
    what I saw is that in the case of NPE always the same method of me
    is called.
    Very very strange... so this would confirm a suspicion that there
    is a bug in the LRUMap not related to synchronization.

    Another question :
    I have a class which is extended from 'WebApplicationListener'. In
    the method 'sessionDestroyed' the following code is executed :

    ObjectStore objectStore = dctx.getObjectStore();
    objectStore.objectsInvalidated(objectStore.getObjects());

    It that really neccessary ?
    It may or may not be useful. On the one hand, the ObjectStore is
    about to go out of scope at this point, so it (and all its objects)
    will be garbage collected without any extra help.

    One other thing that invalidate does is throwing away cached
    snapshots from the cache shared by other sessions. On the positive
    side it frees up some memory, on the negative - it removes items
    from cache that could've otherwise speed up object resolution in
    other sessions.

    I'd say keep it if your sessions share just a few objects between
    each other or share no objects at all; throw it away if the object
    sets significantly overlap between individual sessions.

    Andrus

    _____________________________________________________________________
    Der WEB.DE SmartSurfer hilft bis zu 70% Ihrer Onlinekosten zu sparen!
    http://smartsurfer.web.de/?mc=100071&distributionid=000000000071

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupuser @
categoriescayenne
postedJun 14, '06 at 4:21p
activeJun 19, '06 at 3:02p
posts11
users3
websitecayenne.apache.org

People

Translate

site design / logo © 2022 Grokbase