Robert May created IGNITE-14776:
-----------------------------------

             Summary: ClientFailoverSocket sets logger to late, resulting in 
null loggers downstream.
                 Key: IGNITE-14776
                 URL: https://issues.apache.org/jira/browse/IGNITE-14776
             Project: Ignite
          Issue Type: Bug
          Components: clients, platforms
    Affects Versions: 2.10
            Reporter: Robert May



Because the logger is set last inside of the 
{code:c#}ClientFailoverSocket{code} class, if there are issues with the 
{code:c#}GetIpEndpoints{code} call, an argument exception can occur when a 
debug message is logged inside of {code:c#}GetIps{code} when the ip address 
can't be parsed.  In my case, this occurred with a DNS failure.

Stack Trace:
{code:c#}
 System.ArgumentNullException: Value cannot be null. (Parameter 'logger')
 at Apache.Ignite.Core.Impl.Common.IgniteArgumentCheck.NotNull(Object arg, 
String argName)
 at Apache.Ignite.Core.Log.LoggerExtensions.Log(ILogger logger, LogLevel level, 
Exception ex, String message)
 at Apache.Ignite.Core.Log.LoggerExtensions.Debug(ILogger logger, Exception ex, 
String message)
 at Apache.Ignite.Core.Impl.Client.ClientFailoverSocket.GetIps(String host, 
Boolean suppressExceptions)
 at 
Apache.Ignite.Core.Impl.Client.ClientFailoverSocket.<GetIpEndPoints>d__11.MoveNext()
 at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
 at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
 at 
Apache.Ignite.Core.Impl.Client.ClientFailoverSocket..ctor(IgniteClientConfiguration
 config, Marshaller marsh, TransactionsClient transactions)
 at Apache.Ignite.Core.Impl.Client.IgniteClient..ctor(IgniteClientConfiguration 
clientConfiguration)
 at Apache.Ignite.Core.Ignition.StartClient(IgniteClientConfiguration 
clientConfiguration)
{code}

Here's the constructor code:
{code:c#}
            Debug.Assert(config != null);
            Debug.Assert(marsh != null);
            Debug.Assert(transactions != null);

            _config = config;
            _marsh = marsh;
            _transactions = transactions;

#pragma warning disable 618 // Type or member is obsolete
            if (config.Host == null && (config.Endpoints == null || 
config.Endpoints.Count == 0))
            {
                throw new IgniteClientException("Invalid 
IgniteClientConfiguration: Host is null, " +
                                                "Endpoints is null or empty. 
Nowhere to connect.");
            }
#pragma warning restore 618

            _endPoints = GetIpEndPoints(config).ToList();

            if (_endPoints.Count == 0)
            {
                throw new IgniteClientException("Failed to resolve all 
specified hosts.");
            }

            _logger = (_config.Logger ?? 
NoopLogger.Instance).GetLogger(GetType());

            ConnectDefaultSocket();
            OnFirstConnection();
{code}

Note how the _logger variable isn't set until the very end of the constructor.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to