Welcome to the new Gigaspaces XAP forum. To recover your account, please follow these instructions.

Ask Your Question
0

Memory leak with XAP.NET 10.2

I have a windows console application that uses gigaspaces XAP.NET 10.2 to make some scheduled stuff with data stored in space. I've got a problem after a long period of time - about 1-2 days - nonstop running of that app it crashes with strange error.

My code is something like this:

var newProxy = GigaSpacesFactory.FindSpace(_url);    
var query = proxy.Query<T>().Where(x => x.SomeLongValue < DateTime.UtcNow.AddSeconds(-60).Ticks)); 
ret = proxy.Read<T>(query.ToSpaceQuery(), SpaceTransactionContext.CurrentTransaction, timeout);

Exception is here:

GigaSpaces.Core Java heap space at GigaSpaces.Core.Internal.Pbs.PbsExceptionFormatter.CheckException(PbsInputStream input, DispatcherObjectProxy proxy) at GigaSpaces.Core.Internal.Pbs.Commands.PbsDispatcher.Execute(PbsOutputStream output, DispatcherObjectProxy proxy) at GigaSpaces.Core.Internal.Pbs.Commands.ISpaceProxy.PbsISpaceProxyRead.ExecuteT at GigaSpaces.Core.Internal.SpaceProxy.AbstractSpaceProxyInternal.ReadT at GigaSpaces.Core.Internal.SpaceProxy.ReadOnlySpaceProxy.ReadT Offer.cs:line 42 InnerException: Java heap space java.lang.Class.getDeclaredMethods0(Native Method) java.lang.Class.privateGetDeclaredMethods(Class.java:2451) java.lang.Class.getDeclaredMethod(Class.java:1954) java.io.ObjectStreamClass.getInheritableMethod(ObjectStreamClass.java:1378) java.io.ObjectStreamClass.access$2200(ObjectStreamClass.java:69) java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:491) java.io.ObjectStreamClass$2.run(ObjectStreamClass.java:455) java.security.AccessController.doPrivileged(Native Method) java.io.ObjectStreamClass.<init>(ObjectStreamClass.java:455) java.io.ObjectStreamClass.lookup(ObjectStreamClass.java:352) java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:589) java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620) java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515) java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1620) java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1515) java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1769) java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1348) java.io.ObjectInputStream.readUnshared(ObjectInputStream.java:460) com.gigaspaces.lrmi.nio.ReplyPacket.readExternal(ReplyPacket.java:81) com.gigaspaces.lrmi.nio.Reader.unmarshall(Reader.java:601) com.gigaspaces.lrmi.nio.Reader.bytesToPacket(Reader.java:591) com.gigaspaces.lrmi.nio.Reader.readReply(Reader.java:159) com.gigaspaces.lrmi.nio.CPeer.invoke(CPeer.java:769) com.gigaspaces.lrmi.ConnPoolInvocationHandler.invoke(ConnPoolInvocationHandler.java:75) com.gigaspaces.lrmi.MethodCachedInvocationHandler.invoke(MethodCachedInvocationHandler.java:71) com.gigaspaces.lrmi.DynamicSmartStub.invokeRemote(DynamicSmartStub.java:424) com.gigaspaces.lrmi.DynamicSmartStub.invoke(DynamicSmartStub.java:405) com.gigaspaces.reflect.$GSProxy2.executeOperation(Unknown Source) com.gigaspaces.internal.lrmi.stubs.LRMISpaceImpl.executeOperation(LRMISpaceImpl.java:850) com.gigaspaces.internal.remoting.routing.clustered.RemoteOperationsExecutorProxy.execute(RemoteOperationsExecutorProxy.java:52) com.gigaspaces.internal.remoting.routing.clustered.ClusterRemoteOperationRouter.executeImpl(ClusterRemoteOperationRouter.java:87) com.gigaspaces.internal.remoting.routing.clustered.ClusterRemoteOperationRouter.execute(ClusterRemoteOperationRouter.java:49) ..

I've checked everything several times with different -Xmx JVM settings, but it still the question of time when it crashes.

asked 2016-11-09 17:43:42 -0500

Ivan Y gravatar image
edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

Ivan

This seems a client side crash. The space is running. Right?

Are u calling the: GigaSpacesFactory.FindSpace

More than once?

You should call it once aa d cache the proxy.

Shay

answered 2016-11-09 18:38:55 -0500

shay hassidim gravatar image
edit flag offensive delete link more

Comments

I tried to run that code as a processing unit, too. (Processing Unit without embedded space to make sure it connects to the same space as in the console app). I got the same results - GSC that runs the processing unit is crashed after some time. Yse the proxy is cached in a static dictionary - the above code is just a simplification. It's stored as dictionary key with double-locking get\set logic.

Ivan Y gravatar imageIvan Y ( 2016-11-10 00:40:22 -0500 )edit

Ok. So u het the proxy only once. That's good.

Ok. So u het the proxy only once. That's good.

Do you start a transaction ? Do u commit it?

Why the read using a transaction?

-------- Original message --------

From: forum@ask.gigaspaces.org

Date: 11/10/16 1:40 AM (GMT-05:00)

shay hassidim gravatar imageshay hassidim ( 2016-11-10 06:13:07 -0500 )edit

in that case transaction is null. I'm only setting a static SpaceTransactionContext.CurrentTransaction for some new transaction object for read + update operations when I need in exclussive lock. When I use transactions it looks like this:

using(var trn = TransactionManager.Create(CacheConfig.Instance.Transactions.LeaseTime))
{
    try{
        //some read\write operations
        trn.Commit(CacheConfig.Instance.Transactions.Timeout);
    }
    catch(Exception ex)
    { trn.Abort(CacheConfig.Instance.Transactions.Timeout); }
}

TransactionManager - is also singleton field that is created once per application:

TransactionManager = GigaSpacesFactory.CreateDistributedTransactionManager();
Ivan Y gravatar imageIvan Y ( 2016-11-14 02:22:05 -0500 )edit

in that case transaction is null. I'm only setting a static SpaceTransactionContext.CurrentTransaction for some new transaction object for read + update operations when I need in exclussive lock. When I use transactions it looks like this:

using(var trn = TransactionManager.Create(CacheConfig.Instance.Transactions.LeaseTime))
{
    try{
        //some read\write operations
        trn.Commit(CacheConfig.Instance.Transactions.Timeout);
    }
    catch(Exception ex)
    { trn.Abort(CacheConfig.Instance.Transactions.Timeout); }
}

TransactionManager - is also singleton field that is created once per application:

TransactionManager = GigaSpacesFactory.CreateDistributedTransactionManager();
Ivan Y gravatar imageIvan Y ( 2016-11-14 02:22:43 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2016-11-09 17:43:42 -0500

Seen: 175 times

Last updated: Nov 09 '16