Now the client starts, but cannot connect to a server. How do I start a server, do you use a config file or something else?
On Tue, Sep 20, 2022 at 9:15 AM Charlin S <[email protected]> wrote: > Hi, > Sorry for inconvenience, I have removed local machine path dependency. > > Regards, > Charlin > > > On Tue, 20 Sept 2022 at 11:04, Pavel Tupitsyn <[email protected]> > wrote: > >> Still can't run, sorry. It has hardcoded directories from your machine >> (IgniteSettings.IGNITE_HOME, IgniteSettings.WorkDirectory - commented them >> out), and also GlobalVariables.IgniteSettings.ConfigurationPath: >> >> > Spring XML configuration path is invalid: >> D:\NGSourceCode\IgniteConfig\Labs/common_dynamiccache_client_config.xml >> >> Please make sure the zip file has everything required to run the >> application on any machine. >> >> On Mon, Sep 19, 2022 at 5:07 PM Charlin S <[email protected]> wrote: >> >>> Hi, >>> I have attached here. >>> Regards, >>> Charlin >>> >>> >>> On Mon, 19 Sept 2022 at 19:00, Pavel Tupitsyn <[email protected]> >>> wrote: >>> >>>> I get an exception when trying to run the code: >>>> >>>> Unhandled exception. System.NullReferenceException: Object reference >>>> not set to an instance of an object. >>>> at ConsoleApp4.IgniteInstance..ctor() in >>>> /home/pavel/Downloads/ConsoleApp4/ConsoleApp4/ConsoleApp4/IgniteInstance.cs:line >>>> 47 >>>> at ConsoleApp4.IgniteInstance.get_Instance() in >>>> /home/pavel/Downloads/ConsoleApp4/ConsoleApp4/ConsoleApp4/IgniteInstance.cs:line >>>> 33 >>>> at ConsoleApp4.UnitOfWork..ctor() in >>>> /home/pavel/Downloads/ConsoleApp4/ConsoleApp4/ConsoleApp4/UnitOfWork.cs:line >>>> 15 >>>> at ConsoleApp4.Program.Main(String[] args) in >>>> /home/pavel/Downloads/ConsoleApp4/ConsoleApp4/ConsoleApp4/Program.cs:line >>>> 12 >>>> >>>> On Mon, Sep 19, 2022 at 3:04 PM Charlin S <[email protected]> >>>> wrote: >>>> >>>>> Hi, >>>>> Cache EexpiryPolicy is 60 minutes. but cache key failing in between >>>>> and return data after some time so its not due to expiry policy. >>>>> I have prepared a separate solution and attached it here. I am sharing >>>>> a cache data reading time screenshot for your reference . >>>>> [image: image.png] >>>>> Regards, >>>>> Charlin >>>>> >>>>> >>>>> >>>>> >>>>> >>>>> On Mon, 19 Sept 2022 at 11:00, Pavel Tupitsyn <[email protected]> >>>>> wrote: >>>>> >>>>>> The code you provided above uses ExpiryPolicy. It might be the reason >>>>>> for TryGet to return false - cache entry expires. >>>>>> To provide a definitive answer we need a project that runs and >>>>>> demonstrates the problem. >>>>>> >>>>>> On Fri, Sep 16, 2022 at 5:12 PM Charlin S <[email protected]> >>>>>> wrote: >>>>>> >>>>>>> Hi, >>>>>>> sorry for inconvenience. It's 90% actual code only. I have changed >>>>>>> cache name and grid name as per policy. I have to prepare a separate >>>>>>> solution and provide you if required. >>>>>>> >>>>>>> Regards, >>>>>>> Charlin >>>>>>> >>>>>>> >>>>>>> >>>>>>> On Fri, 16 Sept 2022 at 19:11, Pavel Tupitsyn <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> It does not have to be your actual code, just something that >>>>>>>> demonstrates the problem >>>>>>>> >>>>>>>> On Fri, Sep 16, 2022 at 4:40 PM Pavel Tupitsyn < >>>>>>>> [email protected]> wrote: >>>>>>>> >>>>>>>>> Can you please share a complete project that I can run and see >>>>>>>>> the issue? >>>>>>>>> >>>>>>>>> On Fri, Sep 16, 2022 at 4:30 PM Charlin S <[email protected]> >>>>>>>>> wrote: >>>>>>>>> >>>>>>>>>> Hi, >>>>>>>>>> Sorry I am not able to share a complete solution. bean xml >>>>>>>>>> attached and code snippet in below >>>>>>>>>> IgniteConfiguration igniteGridIg = new IgniteConfiguration(); >>>>>>>>>> igniteGridIg.AutoGenerateIgniteInstanceName = true; >>>>>>>>>> if >>>>>>>>>> (!string.IsNullOrEmpty(GlobalVariables.IgniteSettings.IGNITE_HOME)) >>>>>>>>>> { >>>>>>>>>> igniteGridIg.IgniteHome = >>>>>>>>>> GlobalVariables.IgniteSettings.IGNITE_HOME; >>>>>>>>>> } >>>>>>>>>> var gridDetails = >>>>>>>>>> GlobalVariables.IgniteSettings.GridDetails.Where(gd => >>>>>>>>>> gd.GridType.Equals("DynamicGrid", >>>>>>>>>> StringComparison.OrdinalIgnoreCase)).FirstOrDefault(); >>>>>>>>>> //setting ignite working directory if not ignite will >>>>>>>>>> run with default work directory >>>>>>>>>> if >>>>>>>>>> (!string.IsNullOrEmpty(GlobalVariables.IgniteSettings.WorkDirectory)) >>>>>>>>>> { >>>>>>>>>> igniteGridIg.WorkDirectory = >>>>>>>>>> Path.Combine(GlobalVariables.IgniteSettings.WorkDirectory, >>>>>>>>>> gridDetails.CacheType); >>>>>>>>>> } >>>>>>>>>> if (null != gridDetails) >>>>>>>>>> { >>>>>>>>>> GridName = gridDetails.GridName; >>>>>>>>>> igniteGridIg.SpringConfigUrl = >>>>>>>>>> Path.Combine(GlobalVariables.IgniteSettings.ConfigurationPath, >>>>>>>>>> gridDetails.SpringXMLFileName); >>>>>>>>>> igniteGridIg.ConsistentId = >>>>>>>>>> Guid.NewGuid().ToString().ToUpper(); >>>>>>>>>> ICollection<string> lstJvmOptions = null; >>>>>>>>>> >>>>>>>>>> //"IgniteJVMOption": >>>>>>>>>> "-XX:+DisableExplicitGC,-XX:+UseG1GC,-Xms1g,-Xmx2g" >>>>>>>>>> if >>>>>>>>>> (string.IsNullOrEmpty(gridDetails.IgniteJVMOption)) >>>>>>>>>> { >>>>>>>>>> lstJvmOptions = >>>>>>>>>> GlobalVariables.IgniteSettings.IgniteJVMOptionDefault.Split(',').Where(x >>>>>>>>>> => >>>>>>>>>> !string.IsNullOrWhiteSpace(x)).ToList(); >>>>>>>>>> } >>>>>>>>>> else >>>>>>>>>> lstJvmOptions = >>>>>>>>>> gridDetails.IgniteJVMOption.Split(',').Where(x => >>>>>>>>>> !string.IsNullOrWhiteSpace(x)).ToList(); >>>>>>>>>> >>>>>>>>>> if (lstJvmOptions.Any()) >>>>>>>>>> igniteGridIg.JvmOptions = lstJvmOptions; >>>>>>>>>> int RetryCount = 0; >>>>>>>>>> while (InstanceObject == null) >>>>>>>>>> { >>>>>>>>>> try >>>>>>>>>> { >>>>>>>>>> RetryCount++; >>>>>>>>>> //Try to start Ignite >>>>>>>>>> if >>>>>>>>>> (!String.IsNullOrEmpty(ApplicationSettingKeys.Get<string>("IgniteInstanceRetryLimit")) >>>>>>>>>> && RetryCount > >>>>>>>>>> (ApplicationSettingKeys.Get<int>("IgniteInstanceRetryLimit"))) >>>>>>>>>> { >>>>>>>>>> break; >>>>>>>>>> } >>>>>>>>>> //Try to start Ignite >>>>>>>>>> if >>>>>>>>>> (String.IsNullOrEmpty(ApplicationSettingKeys.Get<string>("IgniteDynamicCacheGrid"))) >>>>>>>>>> InstanceObject = >>>>>>>>>> Ignition.Start(igniteGridIg); >>>>>>>>>> else >>>>>>>>>> InstanceObject = >>>>>>>>>> Ignition.TryGetIgnite(ApplicationSettingKeys.Get<string>("IgniteDynamicCacheGrid")) >>>>>>>>>> ?? Ignition.Start(igniteGridIg); >>>>>>>>>> } >>>>>>>>>> catch (Exception ex) //If failing to start >>>>>>>>>> Ignite, wait a bit for the previous AppDomain to stop the Ignite >>>>>>>>>> running >>>>>>>>>> instance... >>>>>>>>>> { >>>>>>>>>> logContextInfo.ErrorLogger(ex); >>>>>>>>>> >>>>>>>>>> } >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> public ICache<string, testModel> testModelICache { get; set; } >>>>>>>>>> >>>>>>>>>> using (new Log4NetTimeLogHelper(logContextInfo, "testModelModel", >>>>>>>>>> "testModelModel")) >>>>>>>>>> { >>>>>>>>>> >>>>>>>>>> testModelICache = testModelICache ?? >>>>>>>>>> InstanceObject.GetCache<string, testModelModel>("testModelModel") >>>>>>>>>> .WithExpiryPolicy(new ExpiryPolicy( >>>>>>>>>> TimeSpan.FromMinutes(GlobalVariables.testModelExpiryTime), >>>>>>>>>> TimeSpan.FromMinutes(GlobalVariables.testModelExpiryTime), >>>>>>>>>> TimeSpan.FromMinutes(GlobalVariables.testModelExpiryTime) >>>>>>>>>> )); >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> public CacheServiceResponse GetCacheById(string Key) >>>>>>>>>> { >>>>>>>>>> CacheServiceResponse response = new CacheServiceResponse(); >>>>>>>>>> var model = (T)Activator.CreateInstance(typeof(T)); >>>>>>>>>> try >>>>>>>>>> { >>>>>>>>>> >>>>>>>>>> IgniteCache.TryGet(Key, out var value); >>>>>>>>>> var k = IgniteCache.TryGetAsync(Key); >>>>>>>>>> if (null != value) >>>>>>>>>> { >>>>>>>>>> model = (T)value; >>>>>>>>>> response.SingleObject = model; >>>>>>>>>> response.Status = true; >>>>>>>>>> response.StatusCode = >>>>>>>>>> System.Net.HttpStatusCode.OK; >>>>>>>>>> } >>>>>>>>>> else >>>>>>>>>> { >>>>>>>>>> response.Status = false; >>>>>>>>>> response.Message = "Given key " + Key + " >>>>>>>>>> not present in the cache."; >>>>>>>>>> response.StatusCode = >>>>>>>>>> System.Net.HttpStatusCode.NoContent; >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> }cache(exception ex) >>>>>>>>>> { >>>>>>>>>> } >>>>>>>>>> } >>>>>>>>>> >>>>>>>>>> Regards, >>>>>>>>>> Charlin >>>>>>>>>> >>>>>>>>>> >>>>>>>>>> On Fri, 16 Sept 2022 at 18:22, Pavel Tupitsyn < >>>>>>>>>> [email protected]> wrote: >>>>>>>>>> >>>>>>>>>>> Can you share a reproducer? >>>>>>>>>>> >>>>>>>>>>> On Fri, Sep 16, 2022 at 3:13 PM Charlin S < >>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>> >>>>>>>>>>>> Hi, >>>>>>>>>>>> Data loss is not possible, because some other time I am able to >>>>>>>>>>>> read data with the same key. >>>>>>>>>>>> >>>>>>>>>>>> FYI: data update not in our workflow(Please ignore my previous >>>>>>>>>>>> mail statement it is possible to update the cache by another >>>>>>>>>>>> process/workflow). Always data read only once cache inserted >>>>>>>>>>>> by key. >>>>>>>>>>>> >>>>>>>>>>>> Regards, >>>>>>>>>>>> Charlin >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On Fri, 16 Sept 2022 at 17:21, Pavel Tupitsyn < >>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>> >>>>>>>>>>>>> Ok, so the issue is that the key is not present in the cache, >>>>>>>>>>>>> and this is not expected. >>>>>>>>>>>>> Data loss is possible if one of Ignite nodes goes down, and >>>>>>>>>>>>> backups [1] are not configured. >>>>>>>>>>>>> Please check server logs for errors. >>>>>>>>>>>>> >>>>>>>>>>>>> [1] >>>>>>>>>>>>> https://ignite.apache.org/docs/latest/configuring-caches/configuring-backups >>>>>>>>>>>>> >>>>>>>>>>>>> On Fri, Sep 16, 2022 at 2:38 PM Charlin S < >>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>> >>>>>>>>>>>>>> Hi, >>>>>>>>>>>>>> There is no exception and executing the else part. it is >>>>>>>>>>>>>> possible to update the cache by another process/workflow. >>>>>>>>>>>>>> //response is custom class object >>>>>>>>>>>>>> var model = (T)Activator.CreateInstance(typeof(T)); >>>>>>>>>>>>>> IgniteCache.TryGet(Key, out var value); >>>>>>>>>>>>>> if (null != value) >>>>>>>>>>>>>> { >>>>>>>>>>>>>> model = (T)value; >>>>>>>>>>>>>> response.SingleObject = model; >>>>>>>>>>>>>> response.Status = true; >>>>>>>>>>>>>> response.StatusCode = >>>>>>>>>>>>>> System.Net.HttpStatusCode.OK; >>>>>>>>>>>>>> } >>>>>>>>>>>>>> else >>>>>>>>>>>>>> { >>>>>>>>>>>>>> response.Status = false; >>>>>>>>>>>>>> response.Message = "Given key " + Key >>>>>>>>>>>>>> + " not present in the cache."; >>>>>>>>>>>>>> response.StatusCode = >>>>>>>>>>>>>> System.Net.HttpStatusCode.NoContent; >>>>>>>>>>>>>> } >>>>>>>>>>>>>> >>>>>>>>>>>>>> Regards, >>>>>>>>>>>>>> Charlin >>>>>>>>>>>>>> >>>>>>>>>>>>>> On Fri, 16 Sept 2022 at 16:53, Pavel Tupitsyn < >>>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>>> >>>>>>>>>>>>>>> Hi Charlin, >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> Please provide full exception details. >>>>>>>>>>>>>>> >>>>>>>>>>>>>>> On Fri, Sep 16, 2022 at 2:04 PM Charlin S < >>>>>>>>>>>>>>> [email protected]> wrote: >>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Hi All, >>>>>>>>>>>>>>>> Cache.TryGet failed to read intermittently and was unable >>>>>>>>>>>>>>>> to read some time later. >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> having 3 server nodes and 11 client nodes. cache mode is >>>>>>>>>>>>>>>> partition and atomicitymode not been set. >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>> Regards, >>>>>>>>>>>>>>>> Charlin >>>>>>>>>>>>>>>> >>>>>>>>>>>>>>>>
