You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by mananthakris <ma...@gmail.com> on 2006/12/07 17:16:28 UTC

OutOfMemoryError with Proxy

Hi,
We are using OJB with Jboss,Mysql on linux.
We have implemented all we could as suggested by OJB performance tutorial.
We are using Proxies,default cache,PB-api,odmg transaction,but we can't use
getIteratorByQuery because the results are processed after the transaction
is closed. We are facing outofmemory error in two places always. One while
materializing subject from proxy and two using getObjectByQuery for finding
an object by primarykey. It happens only if a lot of users around 200 are
using the system. We have two tier systems with jboss running on a linux
machine with 4GB ram and we have also finetuned jvm options that has reduced
frequency of OutOfMemoryError (we use -Xms768M -Xmx768M -XX:NewSize=256M)
Any suggestions are appreciated? Should we be looking at mysql
performance,any good tools for profiling ojb?
Here is the stack trace of two errors
1)java.lang.OutOfMemoryError
rethrown as
org.apache.ojb.broker.PersistenceBrokerException
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
Source)
        at
org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
Source)
        at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown Source)
        at
com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
        at
com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
        at com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)

2)java.lang.OutOfMemoryError
rethrown as
org.apache.ojb.broker.PersistenceBrokerException
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
Source)
        at
org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
Source)
        at
org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
Source)
        at
com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)

-- 
View this message in context: http://www.nabble.com/OutOfMemoryError-with-Proxy-tf2775405.html#a7742246
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by mananthakris <ma...@gmail.com>.
Forgot to mention that we are using ojb1.0rc4

mananthakris wrote:
> 
> Hi,
> We are using OJB with Jboss,Mysql on linux.
> We have implemented all we could as suggested by OJB performance tutorial.
> We are using Proxies,default cache,PB-api,odmg transaction,but we can't
> use getIteratorByQuery because the results are processed after the
> transaction is closed. We are facing outofmemory error in two places
> always. One while materializing subject from proxy and two using
> getObjectByQuery for finding an object by primarykey. It happens only if a
> lot of users around 200 are using the system. We have two tier systems
> with jboss running on a linux machine with 4GB ram and we have also
> finetuned jvm options that has reduced frequency of OutOfMemoryError (we
> use -Xms768M -Xmx768M -XX:NewSize=256M)
> Any suggestions are appreciated? Should we be looking at mysql
> performance,any good tools for profiling ojb?
> Here is the stack trace of two errors
> 1)java.lang.OutOfMemoryError
> rethrown as
> org.apache.ojb.broker.PersistenceBrokerException
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
> Source)
>         at
> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
> Source)
>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown
> Source)
>         at
> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>         at
> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>         at com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
> 
> 2)java.lang.OutOfMemoryError
> rethrown as
> org.apache.ojb.broker.PersistenceBrokerException
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
> Source)
>         at
> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
> 
> 

-- 
View this message in context: http://www.nabble.com/OutOfMemoryError-with-Proxy-tf2775405.html#a7742877
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by Armin Waibel <ar...@apache.org>.
Hi,

mananthakris wrote:
> We are planning to upgrade to the latest ojb. Will let you know how it is
> doing after that.
> Attached is the jdbc descriptor we are using till now

The jdbc-connection-descriptor seems ok.

> 
> Also we are facing the problem of running out of connections in the pool
> sometimes. Which pool size matters here?Since we are using jboss managed
> connection pool should we look into the property defined for that and will
> ojb totally ignore the connection pool configuration mentioned in
> repository_database.xml here (since we are using ConnectionManagerImpl in
> our OJB.properties file) 

yep, if you are using datasources OJB will ignore the connection-pool 
settings.
http://db.apache.org/ojb/docu/guides/connection.html#How+does+OJB+handle+connection+pooling%3F

And ConnectionFactoryManagedImpl was deprecated in 1.0.4
http://db.apache.org/ojb/docu/guides/connection.html#ConnectionFactoryManagedImpl

regards,
Armin

> 
> We are using 50 in the connectionmanager property defined for jboss and 10
> in the repository_database.xml (Till now our guess is ,ojb's connection pool
> size will be ignored. Is that correct?) or should both be same?
> 
> arminw wrote:
>>
>> mananthakris wrote:
>>> Sorry i checked changing the method to what was suggested on the
>>> findByPrimarykey page, but the broker class does not seem to have that
>>> method in the version we use.
>> yep, this was introduced in a higher version of OJB.
>>
>>> This is the code we are currently using for findByPrimarykey
>>> String[] keyArray = {key};
>>> Identity id = new Identity(null,ojbClass,keyArray);
>>> QueryByIdentity q = QueryFactory.newQuery(id);
>>> broker = //get it from current odmg transaction
>>> data = broker.getObjectByQuery(q);
>>> return data
>>>
>>> I could change data to use broker.getObjectByIdentity(id). Will that
>>> help?
>> Maybe. With
>>
>> String[] keyArray = {key};
>> Identity id = new Identity(null,ojbClass,keyArray);
>> broker = //get it from current odmg transaction
>> data = broker.getObjectByIdentity(id);
>>
>> OJB will definitely first lookup the cache for the specified object
>> before a DB-query will be performed.
>>
>>
>>> It
>>> does not look like the page on OJB tutorial that creates an Identity with
>>> only one parameter. We use VARCHAR Ids in our system.
>> You can create Identity objects with single or compounded PK's (All
>> common data types are supported (long, Long, String, Date, ....)). It's
>> only mandatory that all PK fields of the class defined in the repository
>> mapping file are included when creating the Identity object.
>>
>> regards,
>> Armin
>>
>>>
>>> mananthakris wrote:
>>>> Thanks for the quick response.We are using OJB1.0rc4. yes we can use
>>>> getObjectByIdentity. But the stack trace of the error shows that
>>>> getObjectByQuery is internally calling getObjectByIdentity,so did not
>>>> think this would help. How can we find how many objects are materialized
>>>> at a given time? 
>>>> Here since it is byPrimarykey i am assuming at this point of time it is
>>>> trying to materialize only one object or its all related objects too.
>>>>
>>>> Also what does that the stack trace mean by saying that
>>>> getObjectByIdentity calls getReferencedObject and
>>>> persistenceBrokerImpl.retrieveCollections (does it try to get all
>>>> related
>>>> objects if an object is requested?)
>>>>
>>>> Attached is the OJB.properties file and our repository file
>>>>
>>>>
>>>> Armin Waibel wrote:
>>>>> Hi,
>>>>>
>>>>> could you post the OJB.properties and jdbc-connection-descriptor too? 
>>>>> This would help to find problematic settings.
>>>>> Which version of OJB do you use?
>>>>>
>>>>> mananthakris wrote:
>>>>>> Hi,
>>>>>> We are using OJB with Jboss,Mysql on linux.
>>>>>> We have implemented all we could as suggested by OJB performance
>>>>>> tutorial.
>>>>>> We are using Proxies,default cache,PB-api,odmg transaction,but we
>>>>>> can't
>>>>>> use
>>>>>> getIteratorByQuery because the results are processed after the
>>>>>> transaction
>>>>>> is closed. We are facing outofmemory error in two places always. One
>>>>>> while
>>>>>> materializing subject from proxy and two using getObjectByQuery for
>>>>>> finding
>>>>>> an object by primarykey. 
>>>>> Isn't it possible to lookup the object by Identity instead of using a
>>>>> query?
>>>>> http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key
>>>>>
>>>>>
>>>>>> It happens only if a lot of users around 200 are
>>>>>> using the system. 
>>>>> How many objects are materialized?
>>>>>
>>>>> regards,
>>>>> Armin
>>>>>
>>>>>> We have two tier systems with jboss running on a linux
>>>>>> machine with 4GB ram and we have also finetuned jvm options that has
>>>>>> reduced
>>>>>> frequency of OutOfMemoryError (we use -Xms768M -Xmx768M
>>>>>> -XX:NewSize=256M)
>>>>>> Any suggestions are appreciated? Should we be looking at mysql
>>>>>> performance,any good tools for profiling ojb?
>>>>>> Here is the stack trace of two errors
>>>>>> 1)java.lang.OutOfMemoryError
>>>>>> rethrown as
>>>>>> org.apache.ojb.broker.PersistenceBrokerException
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
>>>>>> Source)
>>>>>>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>>>>>>         at
>>>>>> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>>>>>>         at
>>>>>> com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
>>>>>>
>>>>>> 2)java.lang.OutOfMemoryError
>>>>>> rethrown as
>>>>>> org.apache.ojb.broker.PersistenceBrokerException
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>>>>> Source)
>>>>>>         at
>>>>>> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
>>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>>
>>>>>
>>>>>
>>>>  http://www.nabble.com/file/4504/OJB.properties OJB.properties 
>>>> http://www.nabble.com/file/4505/repository.xml repository.xml 
>>>> http://www.nabble.com/file/4506/repository_user.xml repository_user.xml 
>>>> http://www.nabble.com/file/4507/repository_internal.xml
>>>> repository_internal.xml 
>>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
> http://www.nabble.com/file/4557/repository_database.xml
> repository_database.xml 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by mananthakris <ma...@gmail.com>.
We are planning to upgrade to the latest ojb. Will let you know how it is
doing after that.
Attached is the jdbc descriptor we are using till now

Also we are facing the problem of running out of connections in the pool
sometimes. Which pool size matters here?Since we are using jboss managed
connection pool should we look into the property defined for that and will
ojb totally ignore the connection pool configuration mentioned in
repository_database.xml here (since we are using ConnectionManagerImpl in
our OJB.properties file) 

We are using 50 in the connectionmanager property defined for jboss and 10
in the repository_database.xml (Till now our guess is ,ojb's connection pool
size will be ignored. Is that correct?) or should both be same?

arminw wrote:
> 
> 
> mananthakris wrote:
>> Sorry i checked changing the method to what was suggested on the
>> findByPrimarykey page, but the broker class does not seem to have that
>> method in the version we use.
> 
> yep, this was introduced in a higher version of OJB.
> 
>> 
>> This is the code we are currently using for findByPrimarykey
>> String[] keyArray = {key};
>> Identity id = new Identity(null,ojbClass,keyArray);
>> QueryByIdentity q = QueryFactory.newQuery(id);
>> broker = //get it from current odmg transaction
>> data = broker.getObjectByQuery(q);
>> return data
>> 
>> I could change data to use broker.getObjectByIdentity(id). Will that
>> help?
> 
> Maybe. With
> 
> String[] keyArray = {key};
> Identity id = new Identity(null,ojbClass,keyArray);
> broker = //get it from current odmg transaction
> data = broker.getObjectByIdentity(id);
> 
> OJB will definitely first lookup the cache for the specified object
> before a DB-query will be performed.
> 
> 
>> It
>> does not look like the page on OJB tutorial that creates an Identity with
>> only one parameter. We use VARCHAR Ids in our system.
> 
> You can create Identity objects with single or compounded PK's (All
> common data types are supported (long, Long, String, Date, ....)). It's
> only mandatory that all PK fields of the class defined in the repository
> mapping file are included when creating the Identity object.
> 
> regards,
> Armin
> 
>> 
>> 
>> mananthakris wrote:
>>> Thanks for the quick response.We are using OJB1.0rc4. yes we can use
>>> getObjectByIdentity. But the stack trace of the error shows that
>>> getObjectByQuery is internally calling getObjectByIdentity,so did not
>>> think this would help. How can we find how many objects are materialized
>>> at a given time? 
>>> Here since it is byPrimarykey i am assuming at this point of time it is
>>> trying to materialize only one object or its all related objects too.
>>>
>>> Also what does that the stack trace mean by saying that
>>> getObjectByIdentity calls getReferencedObject and
>>> persistenceBrokerImpl.retrieveCollections (does it try to get all
>>> related
>>> objects if an object is requested?)
>>>
>>> Attached is the OJB.properties file and our repository file
>>>
>>>
>>> Armin Waibel wrote:
>>>> Hi,
>>>>
>>>> could you post the OJB.properties and jdbc-connection-descriptor too? 
>>>> This would help to find problematic settings.
>>>> Which version of OJB do you use?
>>>>
>>>> mananthakris wrote:
>>>>> Hi,
>>>>> We are using OJB with Jboss,Mysql on linux.
>>>>> We have implemented all we could as suggested by OJB performance
>>>>> tutorial.
>>>>> We are using Proxies,default cache,PB-api,odmg transaction,but we
>>>>> can't
>>>>> use
>>>>> getIteratorByQuery because the results are processed after the
>>>>> transaction
>>>>> is closed. We are facing outofmemory error in two places always. One
>>>>> while
>>>>> materializing subject from proxy and two using getObjectByQuery for
>>>>> finding
>>>>> an object by primarykey. 
>>>> Isn't it possible to lookup the object by Identity instead of using a
>>>> query?
>>>> http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key
>>>>
>>>>
>>>>> It happens only if a lot of users around 200 are
>>>>> using the system. 
>>>> How many objects are materialized?
>>>>
>>>> regards,
>>>> Armin
>>>>
>>>>> We have two tier systems with jboss running on a linux
>>>>> machine with 4GB ram and we have also finetuned jvm options that has
>>>>> reduced
>>>>> frequency of OutOfMemoryError (we use -Xms768M -Xmx768M
>>>>> -XX:NewSize=256M)
>>>>> Any suggestions are appreciated? Should we be looking at mysql
>>>>> performance,any good tools for profiling ojb?
>>>>> Here is the stack trace of two errors
>>>>> 1)java.lang.OutOfMemoryError
>>>>> rethrown as
>>>>> org.apache.ojb.broker.PersistenceBrokerException
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
>>>>> Source)
>>>>>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown
>>>>> Source)
>>>>>         at
>>>>> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>>>>>         at
>>>>> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>>>>>         at
>>>>> com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
>>>>>
>>>>> 2)java.lang.OutOfMemoryError
>>>>> rethrown as
>>>>> org.apache.ojb.broker.PersistenceBrokerException
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>>>> Source)
>>>>>         at
>>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>>>> Source)
>>>>>         at
>>>>> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>>
>>>>
>>>>
>>>  http://www.nabble.com/file/4504/OJB.properties OJB.properties 
>>> http://www.nabble.com/file/4505/repository.xml repository.xml 
>>> http://www.nabble.com/file/4506/repository_user.xml repository_user.xml 
>>> http://www.nabble.com/file/4507/repository_internal.xml
>>> repository_internal.xml 
>>>
>> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
http://www.nabble.com/file/4557/repository_database.xml
repository_database.xml 
-- 
View this message in context: http://www.nabble.com/OutOfMemoryError-with-Proxy-tf2775405.html#a7840709
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by Armin Waibel <ar...@apache.org>.
mananthakris wrote:
> Sorry i checked changing the method to what was suggested on the
> findByPrimarykey page, but the broker class does not seem to have that
> method in the version we use.

yep, this was introduced in a higher version of OJB.

> 
> This is the code we are currently using for findByPrimarykey
> String[] keyArray = {key};
> Identity id = new Identity(null,ojbClass,keyArray);
> QueryByIdentity q = QueryFactory.newQuery(id);
> broker = //get it from current odmg transaction
> data = broker.getObjectByQuery(q);
> return data
> 
> I could change data to use broker.getObjectByIdentity(id). Will that help?

Maybe. With

String[] keyArray = {key};
Identity id = new Identity(null,ojbClass,keyArray);
broker = //get it from current odmg transaction
data = broker.getObjectByIdentity(id);

OJB will definitely first lookup the cache for the specified object
before a DB-query will be performed.


> It
> does not look like the page on OJB tutorial that creates an Identity with
> only one parameter. We use VARCHAR Ids in our system.

You can create Identity objects with single or compounded PK's (All
common data types are supported (long, Long, String, Date, ....)). It's
only mandatory that all PK fields of the class defined in the repository
mapping file are included when creating the Identity object.

regards,
Armin

> 
> 
> mananthakris wrote:
>> Thanks for the quick response.We are using OJB1.0rc4. yes we can use
>> getObjectByIdentity. But the stack trace of the error shows that
>> getObjectByQuery is internally calling getObjectByIdentity,so did not
>> think this would help. How can we find how many objects are materialized
>> at a given time? 
>> Here since it is byPrimarykey i am assuming at this point of time it is
>> trying to materialize only one object or its all related objects too.
>>
>> Also what does that the stack trace mean by saying that
>> getObjectByIdentity calls getReferencedObject and
>> persistenceBrokerImpl.retrieveCollections (does it try to get all related
>> objects if an object is requested?)
>>
>> Attached is the OJB.properties file and our repository file
>>
>>
>> Armin Waibel wrote:
>>> Hi,
>>>
>>> could you post the OJB.properties and jdbc-connection-descriptor too? 
>>> This would help to find problematic settings.
>>> Which version of OJB do you use?
>>>
>>> mananthakris wrote:
>>>> Hi,
>>>> We are using OJB with Jboss,Mysql on linux.
>>>> We have implemented all we could as suggested by OJB performance
>>>> tutorial.
>>>> We are using Proxies,default cache,PB-api,odmg transaction,but we can't
>>>> use
>>>> getIteratorByQuery because the results are processed after the
>>>> transaction
>>>> is closed. We are facing outofmemory error in two places always. One
>>>> while
>>>> materializing subject from proxy and two using getObjectByQuery for
>>>> finding
>>>> an object by primarykey. 
>>> Isn't it possible to lookup the object by Identity instead of using a
>>> query?
>>> http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key
>>>
>>>
>>>> It happens only if a lot of users around 200 are
>>>> using the system. 
>>> How many objects are materialized?
>>>
>>> regards,
>>> Armin
>>>
>>>> We have two tier systems with jboss running on a linux
>>>> machine with 4GB ram and we have also finetuned jvm options that has
>>>> reduced
>>>> frequency of OutOfMemoryError (we use -Xms768M -Xmx768M
>>>> -XX:NewSize=256M)
>>>> Any suggestions are appreciated? Should we be looking at mysql
>>>> performance,any good tools for profiling ojb?
>>>> Here is the stack trace of two errors
>>>> 1)java.lang.OutOfMemoryError
>>>> rethrown as
>>>> org.apache.ojb.broker.PersistenceBrokerException
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
>>>> Source)
>>>>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown
>>>> Source)
>>>>         at
>>>> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>>>>         at
>>>> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>>>>         at
>>>> com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
>>>>
>>>> 2)java.lang.OutOfMemoryError
>>>> rethrown as
>>>> org.apache.ojb.broker.PersistenceBrokerException
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>>> Source)
>>>>         at
>>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>>> Source)
>>>>         at
>>>> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>>
>>>
>>>
>>  http://www.nabble.com/file/4504/OJB.properties OJB.properties 
>> http://www.nabble.com/file/4505/repository.xml repository.xml 
>> http://www.nabble.com/file/4506/repository_user.xml repository_user.xml 
>> http://www.nabble.com/file/4507/repository_internal.xml
>> repository_internal.xml 
>>
> 



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by mananthakris <ma...@gmail.com>.
Sorry i checked changing the method to what was suggested on the
findByPrimarykey page, but the broker class does not seem to have that
method in the version we use.

This is the code we are currently using for findByPrimarykey
String[] keyArray = {key};
Identity id = new Identity(null,ojbClass,keyArray);
QueryByIdentity q = QueryFactory.newQuery(id);
broker = //get it from current odmg transaction
data = broker.getObjectByQuery(q);
return data

I could change data to use broker.getObjectByIdentity(id). Will that help?It
does not look like the page on OJB tutorial that creates an Identity with
only one parameter. We use VARCHAR Ids in our system.


mananthakris wrote:
> 
> Thanks for the quick response.We are using OJB1.0rc4. yes we can use
> getObjectByIdentity. But the stack trace of the error shows that
> getObjectByQuery is internally calling getObjectByIdentity,so did not
> think this would help. How can we find how many objects are materialized
> at a given time? 
> Here since it is byPrimarykey i am assuming at this point of time it is
> trying to materialize only one object or its all related objects too.
> 
> Also what does that the stack trace mean by saying that
> getObjectByIdentity calls getReferencedObject and
> persistenceBrokerImpl.retrieveCollections (does it try to get all related
> objects if an object is requested?)
> 
> Attached is the OJB.properties file and our repository file
> 
> 
> Armin Waibel wrote:
>> 
>> Hi,
>> 
>> could you post the OJB.properties and jdbc-connection-descriptor too? 
>> This would help to find problematic settings.
>> Which version of OJB do you use?
>> 
>> mananthakris wrote:
>>> Hi,
>>> We are using OJB with Jboss,Mysql on linux.
>>> We have implemented all we could as suggested by OJB performance
>>> tutorial.
>>> We are using Proxies,default cache,PB-api,odmg transaction,but we can't
>>> use
>>> getIteratorByQuery because the results are processed after the
>>> transaction
>>> is closed. We are facing outofmemory error in two places always. One
>>> while
>>> materializing subject from proxy and two using getObjectByQuery for
>>> finding
>>> an object by primarykey. 
>> 
>> Isn't it possible to lookup the object by Identity instead of using a
>> query?
>> http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key
>> 
>> 
>>> It happens only if a lot of users around 200 are
>>> using the system. 
>> 
>> How many objects are materialized?
>> 
>> regards,
>> Armin
>> 
>>> We have two tier systems with jboss running on a linux
>>> machine with 4GB ram and we have also finetuned jvm options that has
>>> reduced
>>> frequency of OutOfMemoryError (we use -Xms768M -Xmx768M
>>> -XX:NewSize=256M)
>>> Any suggestions are appreciated? Should we be looking at mysql
>>> performance,any good tools for profiling ojb?
>>> Here is the stack trace of two errors
>>> 1)java.lang.OutOfMemoryError
>>> rethrown as
>>> org.apache.ojb.broker.PersistenceBrokerException
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
>>> Source)
>>>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown
>>> Source)
>>>         at
>>> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>>>         at
>>> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>>>         at
>>> com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
>>> 
>>> 2)java.lang.OutOfMemoryError
>>> rethrown as
>>> org.apache.ojb.broker.PersistenceBrokerException
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>> Source)
>>>         at
>>> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
>>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>> 
>> 
>> 
>  http://www.nabble.com/file/4504/OJB.properties OJB.properties 
> http://www.nabble.com/file/4505/repository.xml repository.xml 
> http://www.nabble.com/file/4506/repository_user.xml repository_user.xml 
> http://www.nabble.com/file/4507/repository_internal.xml
> repository_internal.xml 
> 

-- 
View this message in context: http://www.nabble.com/OutOfMemoryError-with-Proxy-tf2775405.html#a7743806
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by Armin Waibel <ar...@apache.org>.
mananthakris wrote:
> Thanks for the quick response.We are using OJB1.0rc4. 

ops! This is really outdated.

> yes we can use
> getObjectByIdentity. But the stack trace of the error shows that
> getObjectByQuery is internally calling getObjectByIdentity,so did not think
> this would help. 

yep, agree with you. If PB.getObjectByIdentity is used it's possible 
that OJB find the object in the cache without executing a DB query.


> How can we find how many objects are materialized at a
> given time? 

That's not easy. OJB hasn't methods to trace count of materialized 
objects. You could try to log sql statements.
I think if OJB would materialize millions of objects you would get 
memory errors with less user too (but as you said the problem only 
occurs under heavy load).


> Here since it is byPrimarykey i am assuming at this point of time it is
> trying to materialize only one object or its all related objects too.
> 
> Also what does that the stack trace mean by saying that getObjectByIdentity
> calls getReferencedObject and persistenceBrokerImpl.retrieveCollections
> (does it try to get all related objects if an object is requested?)

On materialization of an object OJB always loops over all 
ReferenceDescriptor of an object and checks if the reference have to be 
materialized too or if a proxy object have be used or if nothing have to 
be done. Thats why you see persistenceBrokerImpl.retrieveCollections... 
methods calls in the stack trace.


> 
> Attached is the OJB.properties file and our repository file
> 

In the attachment repository_database.xml is missing.

regards,
Armin


> 
> Armin Waibel wrote:
>> Hi,
>>
>> could you post the OJB.properties and jdbc-connection-descriptor too? 
>> This would help to find problematic settings.
>> Which version of OJB do you use?
>>
>> mananthakris wrote:
>>> Hi,
>>> We are using OJB with Jboss,Mysql on linux.
>>> We have implemented all we could as suggested by OJB performance
>>> tutorial.
>>> We are using Proxies,default cache,PB-api,odmg transaction,but we can't
>>> use
>>> getIteratorByQuery because the results are processed after the
>>> transaction
>>> is closed. We are facing outofmemory error in two places always. One
>>> while
>>> materializing subject from proxy and two using getObjectByQuery for
>>> finding
>>> an object by primarykey. 
>> Isn't it possible to lookup the object by Identity instead of using a
>> query?
>> http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key
>>
>>
>>> It happens only if a lot of users around 200 are
>>> using the system. 
>> How many objects are materialized?
>>
>> regards,
>> Armin
>>
>>> We have two tier systems with jboss running on a linux
>>> machine with 4GB ram and we have also finetuned jvm options that has
>>> reduced
>>> frequency of OutOfMemoryError (we use -Xms768M -Xmx768M -XX:NewSize=256M)
>>> Any suggestions are appreciated? Should we be looking at mysql
>>> performance,any good tools for profiling ojb?
>>> Here is the stack trace of two errors
>>> 1)java.lang.OutOfMemoryError
>>> rethrown as
>>> org.apache.ojb.broker.PersistenceBrokerException
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
>>> Source)
>>>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown
>>> Source)
>>>         at
>>> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>>>         at
>>> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>>>         at
>>> com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
>>>
>>> 2)java.lang.OutOfMemoryError
>>> rethrown as
>>> org.apache.ojb.broker.PersistenceBrokerException
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>> Source)
>>>         at
>>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>>> Source)
>>>         at
>>> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
>>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
>> For additional commands, e-mail: ojb-user-help@db.apache.org
>>
>>
>>
> http://www.nabble.com/file/4504/OJB.properties OJB.properties 
> http://www.nabble.com/file/4505/repository.xml repository.xml 
> http://www.nabble.com/file/4506/repository_user.xml repository_user.xml 
> http://www.nabble.com/file/4507/repository_internal.xml
> repository_internal.xml 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by mananthakris <ma...@gmail.com>.
Thanks for the quick response.We are using OJB1.0rc4. yes we can use
getObjectByIdentity. But the stack trace of the error shows that
getObjectByQuery is internally calling getObjectByIdentity,so did not think
this would help. How can we find how many objects are materialized at a
given time? 
Here since it is byPrimarykey i am assuming at this point of time it is
trying to materialize only one object or its all related objects too.

Also what does that the stack trace mean by saying that getObjectByIdentity
calls getReferencedObject and persistenceBrokerImpl.retrieveCollections
(does it try to get all related objects if an object is requested?)

Attached is the OJB.properties file and our repository file


Armin Waibel wrote:
> 
> Hi,
> 
> could you post the OJB.properties and jdbc-connection-descriptor too? 
> This would help to find problematic settings.
> Which version of OJB do you use?
> 
> mananthakris wrote:
>> Hi,
>> We are using OJB with Jboss,Mysql on linux.
>> We have implemented all we could as suggested by OJB performance
>> tutorial.
>> We are using Proxies,default cache,PB-api,odmg transaction,but we can't
>> use
>> getIteratorByQuery because the results are processed after the
>> transaction
>> is closed. We are facing outofmemory error in two places always. One
>> while
>> materializing subject from proxy and two using getObjectByQuery for
>> finding
>> an object by primarykey. 
> 
> Isn't it possible to lookup the object by Identity instead of using a
> query?
> http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key
> 
> 
>> It happens only if a lot of users around 200 are
>> using the system. 
> 
> How many objects are materialized?
> 
> regards,
> Armin
> 
>> We have two tier systems with jboss running on a linux
>> machine with 4GB ram and we have also finetuned jvm options that has
>> reduced
>> frequency of OutOfMemoryError (we use -Xms768M -Xmx768M -XX:NewSize=256M)
>> Any suggestions are appreciated? Should we be looking at mysql
>> performance,any good tools for profiling ojb?
>> Here is the stack trace of two errors
>> 1)java.lang.OutOfMemoryError
>> rethrown as
>> org.apache.ojb.broker.PersistenceBrokerException
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
>> Source)
>>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown
>> Source)
>>         at
>> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>>         at
>> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>>         at
>> com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
>> 
>> 2)java.lang.OutOfMemoryError
>> rethrown as
>> org.apache.ojb.broker.PersistenceBrokerException
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>> Source)
>>         at
>> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
>> Source)
>>         at
>> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
>> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 
> 
http://www.nabble.com/file/4504/OJB.properties OJB.properties 
http://www.nabble.com/file/4505/repository.xml repository.xml 
http://www.nabble.com/file/4506/repository_user.xml repository_user.xml 
http://www.nabble.com/file/4507/repository_internal.xml
repository_internal.xml 
-- 
View this message in context: http://www.nabble.com/OutOfMemoryError-with-Proxy-tf2775405.html#a7743488
Sent from the Apache DB - ObjectRelationalBridge Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: OutOfMemoryError with Proxy

Posted by Armin Waibel <ar...@apache.org>.
Hi,

could you post the OJB.properties and jdbc-connection-descriptor too? 
This would help to find problematic settings.
Which version of OJB do you use?

mananthakris wrote:
> Hi,
> We are using OJB with Jboss,Mysql on linux.
> We have implemented all we could as suggested by OJB performance tutorial.
> We are using Proxies,default cache,PB-api,odmg transaction,but we can't use
> getIteratorByQuery because the results are processed after the transaction
> is closed. We are facing outofmemory error in two places always. One while
> materializing subject from proxy and two using getObjectByQuery for finding
> an object by primarykey. 

Isn't it possible to lookup the object by Identity instead of using a query?
http://db.apache.org/ojb/docu/tutorials/pb-tutorial.html#Find+object+by+primary+key


> It happens only if a lot of users around 200 are
> using the system. 

How many objects are materialized?

regards,
Armin

> We have two tier systems with jboss running on a linux
> machine with 4GB ram and we have also finetuned jvm options that has reduced
> frequency of OutOfMemoryError (we use -Xms768M -Xmx768M -XX:NewSize=256M)
> Any suggestions are appreciated? Should we be looking at mysql
> performance,any good tools for profiling ojb?
> Here is the stack trace of two errors
> 1)java.lang.OutOfMemoryError
> rethrown as
> org.apache.ojb.broker.PersistenceBrokerException
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.accesslayer.IndirectionHandler.materializeSubject(Unknown
> Source)
>         at
> org.apache.ojb.broker.accesslayer.IndirectionHandler.getRealSubject(Unknown
> Source)
>         at org.apache.ojb.broker.VirtualProxy.getRealSubject(Unknown Source)
>         at
> com.tk20.bo.BaseServerObjectProxy.realSubject(BaseServerObjectProxy.java:46)
>         at
> com.tk20.bo.BaseServerObjectProxy.getRelatedObjects(BaseServerObjectProxy.java:334)
>         at com.tk20.ejb.api.query.QueryMgrEJB.getList(QueryMgrEJB.java:83)
> 
> 2)java.lang.OutOfMemoryError
> rethrown as
> org.apache.ojb.broker.PersistenceBrokerException
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getCollectionByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollection(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveCollections(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getExtentDBObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getReferencedObject(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReference(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.retrieveReferences(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getDBObject(Unknown Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByIdentity(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.PersistenceBrokerImpl.getObjectByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
> Source)
>         at
> org.apache.ojb.broker.core.DelegatingPersistenceBroker.getObjectByQuery(Unknown
> Source)
>         at
> com.tk20.ejb.api.BaseServiceEJB.findByPrimaryKey(BaseServiceEJB.java:189)
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org