You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ignite.apache.org by "Pavel Tupitsyn (Jira)" <ji...@apache.org> on 2020/11/26 15:55:00 UTC
[jira] [Comment Edited] (IGNITE-13760) .NET: GetAffinity fails with
NullPointerException on client node
[ https://issues.apache.org/jira/browse/IGNITE-13760?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17239318#comment-17239318 ]
Pavel Tupitsyn edited comment on IGNITE-13760 at 11/26/20, 3:54 PM:
--------------------------------------------------------------------
Merged to master: 4d28cb5790547ca82a0bcd3d8ededc8856ccb263
Cherry-picked to ignite-2.9.1: 7821365b05a22dcea17f1885d33874a22231f8a0
was (Author: ptupitsyn):
Merged to master: 4d28cb5790547ca82a0bcd3d8ededc8856ccb263
> .NET: GetAffinity fails with NullPointerException on client node
> ----------------------------------------------------------------
>
> Key: IGNITE-13760
> URL: https://issues.apache.org/jira/browse/IGNITE-13760
> Project: Ignite
> Issue Type: Bug
> Components: platforms
> Affects Versions: 2.9
> Reporter: Alexey Kukushkin
> Assignee: Pavel Tupitsyn
> Priority: Major
> Labels: .NET
> Fix For: 2.9.1
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> * Given there are Ignite.NET server and client nodes
> * When the server node creates a cache and then the client node immediately gets affinity for the cache
> * Then getting affinity fails with NullPointerException
> {code:c#}
> IgniteConfiguration IgniteCfg(bool clientMode = false) => new IgniteConfiguration
> {
> ClientMode = clientMode,
> IgniteInstanceName = Guid.NewGuid().ToString(),
> DiscoverySpi = new TcpDiscoverySpi
> {
> IpFinder = new TcpDiscoveryStaticIpFinder
> {
> Endpoints = new[] { "127.0.0.1:47500" }
> }
> }
> };
> using var igniteSrv = Ignition.Start(IgniteCfg());
> using var igniteClient = Ignition.Start(IgniteCfg(true));
> var cache1 = igniteSrv.GetOrCreateCache<int, string>("cache1");
> igniteClient.GetAffinity("cache1");
> {code}
> The igniteClient.GetAffinity fails with this exception:
> {code}
> Apache.Ignite.Core.Common.IgniteException
> HResult=0x80131500
> Message=Java exception occurred [class=java.lang.NullPointerException, message=]
> Source=Apache.Ignite.Core
> StackTrace:
> at Apache.Ignite.Core.Impl.PlatformJniTarget.InStreamOutObject(Int32 type, Action`1 writeAction)
> at Apache.Ignite.Core.Impl.PlatformTargetAdapter.DoOutOpObject(Int32 type, Action`1 action)
> at Apache.Ignite.Core.Impl.Ignite.Apache.Ignite.Core.Impl.IIgniteInternal.GetAffinity(String cacheName)
> at Apache.Ignite.Core.Impl.Ignite.GetAffinity(String cacheName)
> at DotNet.Sandbox.Program.Main(String[] args) in C:\Dev\tmp\DotNet.Sandbox\Program.cs:line 32
> This exception was originally thrown at this call stack:
> Apache.Ignite.Core.Impl.Unmanaged.Jni.Env.ExceptionCheck()
> Apache.Ignite.Core.Impl.Unmanaged.Jni.Env.CallObjectMethod(Apache.Ignite.Core.Impl.Unmanaged.Jni.GlobalRef, System.IntPtr, long*)
> Apache.Ignite.Core.Impl.Unmanaged.UnmanagedUtils.TargetInStreamOutObject(Apache.Ignite.Core.Impl.Unmanaged.Jni.GlobalRef, int, long)
> Apache.Ignite.Core.Impl.PlatformJniTarget.InStreamOutObject(int, System.Action<Apache.Ignite.Core.Impl.Binary.IO.IBinaryStream>)
> Inner Exception 1:
> JavaException: java.lang.NullPointerException
> at org.apache.ignite.internal.processors.platform.cache.affinity.PlatformAffinity.<init>(PlatformAffinity.java:125)
> at org.apache.ignite.internal.processors.platform.PlatformProcessorImpl.processInStreamOutObject(PlatformProcessorImpl.java:640)
> at org.apache.ignite.internal.processors.platform.PlatformTargetProxyImpl.inStreamOutObject(PlatformTargetProxyImpl.java:79)
> {code}
> h1. Workaround
> Add {{GetCache}} call before {{GetAffinity}}:
> {code:c#}
> ...
> var cache1 = igniteSrv.GetOrCreateCache<int, string>("cache1");
> igniteClient.GetCache<int, string>("cache1");
> igniteClient.GetAffinity("cache1");
> {code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)