ignite-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Pavel Tupitsyn <ptupit...@apache.org>
Subject Re: Exception being thrown when setting Active to true in Ignite 2.1 with Persitence enabled
Date Thu, 03 Aug 2017 09:48:19 GMT
Raymond,

ICacheStore is not supposed to work when PersistentStoreConfiguration is
present.
Certainly there are some startup checks missing and documentation needs to
be updated.

Thanks,
Pavel

On Thu, Aug 3, 2017 at 3:55 AM, Raymond Wilson <raymond_wilson@trimble.com>
wrote:

> Hi Pavel,
>
>
>
> I wrote a simple console app to attempt to reproduce it, but it does not
> reproduce the issue.
>
>
>
> I then went back to my failing case which mysteriously decided to stop
> failing where it was failing very consistently earlier today. Then it
> started failing again, consistently!
>
>
>
> After more investigation I worked out that the key seems to be
> inappropriate configuring of cache read/write through at the same time
> configuring persistence in Ignite. I can run the code below again and again
> without issue, but if I include the cache read/write through configuration
> then the first run executes without error, but the second run will fail at
> the Grid.SetActive(true) line.
>
>
>
> I have omitted the RaptorCacheStoreFactory implementation for brevity, it
> basically just maps a MemoryStream to a filename and reads/writes it.
>
>
>
> If cache read/write through does not play well with persistence it might
> be good to have this pointed out at the time the cache is created to
> forestall issues occurring later.
>
>
>
> using Apache.Ignite.Core;
>
> using Apache.Ignite.Core.Cache;
>
> using Apache.Ignite.Core.Cache.Configuration;
>
> using Apache.Ignite.Core.Cache.Eviction;
>
> using Apache.Ignite.Core.PersistentStore;
>
> using System;
>
> using System.Collections.Generic;
>
> using System.IO;
>
>
>
> namespace ExceptionReproducer
>
> {
>
>     class Program
>
>     {
>
>         private const string PersistentCacheStoreLocation =
> "C:\\Temp\\RaptorIgniteData\\Persistence";
>
>
>
>         public static uint getDescriptor()
>
>         {
>
>             return 0;
>
>         }
>
>
>
>         private static void setupGridConfiguration(IgniteConfiguration
> cfg)
>
>         {
>
>             cfg.GridName = "Raptor";
>
>             cfg.IgniteInstanceName = "Raptor";
>
>             cfg.JvmInitialMemoryMb = 512; // Set to minimum advised
> memory for Ignite grid JVM of 512Mb
>
>             cfg.JvmMaxMemoryMb = 4 * 1024; // Set max to 4Gb
>
>
>
>             cfg.UserAttributes = new Dictionary<String, object>();
>
>             cfg.UserAttributes.Add("Owner", "Raptor");
>
>             cfg.UserAttributes.Add("Role", "PSNode");
>
>             cfg.UserAttributes.Add("Division", getDescriptor());
>
>
>
>             cfg.PersistentStoreConfiguration = new
> PersistentStoreConfiguration()
>
>             {
>
>                 PersistentStorePath = "C:\\Temp\\RaptorIgniteData\\
> Persistence" // PersistentCacheStoreLocation
>
>             };
>
>         }
>
>
>
>         private static void setupCacheConfiguration(CacheConfiguration
> cfg)
>
>         {
>
>             cfg.Name = "Cache";
>
>             cfg.CopyOnRead = false;
>
>             cfg.KeepBinaryInStore = false;
>
>
>
> //            cfg.CacheStoreFactory = new RaptorCacheStoreFactory(false,
> true);
>
> //            cfg.ReadThrough = true;
>
> //            cfg.WriteThrough = true;
>
>
>
>             cfg.WriteBehindFlushFrequency = new TimeSpan(0, 0, 30); // 30
> seconds
>
>             cfg.EvictionPolicy = new LruEvictionPolicy()
>
>             {
>
>                 MaxMemorySize = 100000000   // 100Mb
>
>             };
>
>             cfg.CacheMode = CacheMode.Replicated;
>
>             cfg.Backups = 0;
>
>         }
>
>
>
>         public static void Reproduce()
>
>         {
>
>             IgniteConfiguration cfg = new IgniteConfiguration();
>
>
>
>             setupGridConfiguration(cfg);
>
>
>
>             IIgnite Grid = Ignition.Start(cfg);
>
>
>
>             try
>
>             {
>
>                 Grid.SetActive(true);
>
>                 Console.WriteLine("OK!");
>
>             }
>
>             catch (Exception e)
>
>             {
>
>                 Console.WriteLine("Oops!: {0}", e);
>
>             }
>
>
>
>             CacheConfiguration cacheCfg = new CacheConfiguration();
>
>             setupCacheConfiguration(cacheCfg);
>
>
>
>             ICache<String, MemoryStream> cache = null;
>
>             cache = Grid.GetOrCreateCache<String, MemoryStream>(cacheCfg);
>
>         }
>
>
>
>         static void Main(string[] args)
>
>         {
>
>             Reproduce();
>
>         }
>
>     }
>
> }
>
>
>
> Thanks,
>
> Raymond.
>
>
>
>
>
>
>
> *From:* Pavel Tupitsyn [mailto:ptupitsyn@apache.org]
> *Sent:* Wednesday, August 2, 2017 9:15 PM
> *To:* user@ignite.apache.org
> *Subject:* Re: Exception being thrown when setting Active to true in
> Ignite 2.1 with Persitence enabled
>
>
>
> Hi Raymond,
>
>
>
> I can't reproduce the issue using your code in a new Console application
> and Ignite.NET 2.1 NuGet package.
>
> Can you send a minimal reproducer (a complete project which I can run)?
>
>
>
> Thanks,
>
> Pavel
>
>
>
> On Wed, Aug 2, 2017 at 6:56 AM, Raymond Wilson <raymond_wilson@trimble.com>
> wrote:
>
> I’m testing out a first piece of code to use the Ignite persistence layer
> in the C# client.
>
>
>
> I have added a persistence layer aspect to the configuration for the grid,
> like this:
>
>
>
>             cfg.PersistentStoreConfiguration = new
> PersistentStoreConfiguration()
>
>             {
>
>                 PersistentStorePath = PersistentCacheStoreLocation
>
>
>             };
>
>
>
> I then declare, instantiate and activate the grid:
>
>
>
> IIgnite Grid = Ignition.Start(cfg);
>
> Grid.SetActive(true);
>
>
>
> However, the SetActive line throws this exception:
>
>
>
> ERROR 2017-08-02 13:54:04,994 54667ms CacheComputeServer
> GridCacheNode - Exception: Apache.Ignite.Core.Common.IgniteException:
> Failed to deserialize object with given class loader: sun.misc.Launcher$
> AppClassLoader@c387f44 ---> Apache.Ignite.Core.Common.JavaException:
> class org.apache.ignite.IgniteException: Failed to deserialize object
> with given class loader: sun.misc.Launcher$AppClassLoader@c387f44
>
>                 at org.apache.ignite.internal.util.IgniteUtils.
> convertException(IgniteUtils.java:957)
>
>                 at org.apache.ignite.internal.IgniteKernal.active(
> IgniteKernal.java:3427)
>
>                 at org.apache.ignite.internal.processors.platform.cluster.
> PlatformClusterGroup.processInLongOutLong(PlatformClusterGroup.java:401)
>
>                 at org.apache.ignite.internal.processors.platform.
> PlatformTargetProxyImpl.inLongOutLong(PlatformTargetProxyImpl.java:53)
>
> Caused by: class org.apache.ignite.IgniteCheckedException: Failed to
> deserialize object with given class loader: sun.misc.Launcher$
> AppClassLoader@c387f44
>
>                 at org.apache.ignite.marshaller.
> jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:129)
>
>                 at org.apache.ignite.marshaller.
> AbstractNodeNameAwareMarshaller.unmarshal(AbstractNodeNameAwareMarshalle
> r.java:94)
>
>                 at org.apache.ignite.internal.
> processors.cache.persistence.file.FilePageStoreManager.readCacheData(
> FilePageStoreManager.java:541)
>
>                 at org.apache.ignite.internal.
> processors.cache.persistence.file.FilePageStoreManager.
> readCacheConfigurations(FilePageStoreManager.java:501)
>
>                 at org.apache.ignite.internal.processors.cluster.
> GridClusterStateProcessor.changeGlobalState(GridClusterStateProcessor.
> java:453)
>
>                 at org.apache.ignite.internal.IgniteKernal.active(
> IgniteKernal.java:3424)
>
>                 ... 2 more
>
> Caused by: java.lang.IllegalArgumentException: Ignite instance name
> thread local must be set or this method should be accessed under
> org.apache.ignite.thread.IgniteThread
>
>                 at org.apache.ignite.internal.IgnitionEx.localIgnite(
> IgnitionEx.java:1328)
>
>                 at org.apache.ignite.internal.binary.GridBinaryMarshaller.
> threadLocalContext(GridBinaryMarshaller.java:392)
>
>                 at org.apache.ignite.internal.binary.BinaryObjectImpl.
> readExternal(BinaryObjectImpl.java:694)
>
>                 at java.io.ObjectInputStream.readExternalData(
> ObjectInputStream.java:1849)
>
>                 at java.io.ObjectInputStream.readOrdinaryObject(
> ObjectInputStream.java:1806)
>
>                 at java.io.ObjectInputStream.
> readObject0(ObjectInputStream.java:1353)
>
>                 at java.io.ObjectInputStream.defaultReadFields(
> ObjectInputStream.java:2018)
>
>                 at java.io.ObjectInputStream.readSerialData(
> ObjectInputStream.java:1942)
>
>                 at java.io.ObjectInputStream.readOrdinaryObject(
> ObjectInputStream.java:1808)
>
>                 at java.io.ObjectInputStream.
> readObject0(ObjectInputStream.java:1353)
>
>                 at java.io.ObjectInputStream.defaultReadFields(
> ObjectInputStream.java:2018)
>
>                 at java.io.ObjectInputStream.readSerialData(
> ObjectInputStream.java:1942)
>
>                 at java.io.ObjectInputStream.readOrdinaryObject(
> ObjectInputStream.java:1808)
>
>                 at java.io.ObjectInputStream.
> readObject0(ObjectInputStream.java:1353)
>
>                 at java.io.ObjectInputStream.defaultReadFields(
> ObjectInputStream.java:2018)
>
>                 at java.io.ObjectInputStream.readSerialData(
> ObjectInputStream.java:1942)
>
>                 at java.io.ObjectInputStream.readOrdinaryObject(
> ObjectInputStream.java:1808)
>
>                 at java.io.ObjectInputStream.
> readObject0(ObjectInputStream.java:1353)
>
>                 at java.io.ObjectInputStream.readObject(ObjectInputStream.
> java:373)
>
>                 at org.apache.ignite.marshaller.
> jdk.JdkMarshaller.unmarshal0(JdkMarshaller.java:121)
>
>                 ... 7 more
>
>
>
>    --- End of inner exception stack trace ---
>
>    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedCallbacks.Error(Void*
> target, Int32 errType, SByte* errClsChars, Int32 errClsCharsLen, SByte*
> errMsgChars, Int32 errMsgCharsLen, SByte* stackTraceChars, Int32
> stackTraceCharsLen, Void* errData, Int32 errDataLen)
>
>    at Apache.Ignite.Core.Impl.Unmanaged.IgniteJniNativeMethods.TargetInLongOutLong(Void*
> ctx, Void* target, Int32 opType, Int64 val)
>
>    at Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.
> TargetInLongOutLong(IUnmanagedTarget target, Int32 opType, Int64 memPtr)
>
>    at Apache.Ignite.Core.Impl.Cluster.ClusterGroupImpl.SetActive(Boolean
> isActive)
>
>    at [….].CacheComputeServer.StartGridCacheNode() in […]
>
>
>
> I was not setting the IgniteInstanceName in the configuration, but the
> exception still occurs after setting it.
>
>
>
> I googled the exception and found an Ignite issue related to Cassandra
> that was fixed in 2.1, however I am not using Cassandra.
>
>
>
> Any clues?
>
>
>
> Thanks,
>
> Raymond.
>
>
>
>
>

Mime
View raw message