Coder Social home page Coder Social logo

Comments (5)

asimarslan avatar asimarslan commented on July 17, 2024

Hi @MBoden67 ,
Can you give more detail on the issue? Are you talking about windows handles ? Can you detail how you reproduce it ?

from hazelcast-csharp-client.

MBoden67 avatar MBoden67 commented on July 17, 2024

The Code to reproduce it is in the issue above

run the code against a nonexistent hazelcast server, set up performance monitor on "handle count" and watch it rise

if you're impatient you can add

HazelConfig.GetNetworkConfig().SetConnectionAttemptLimit(0);

or

HazelConfig.GetNetworkConfig().SetConnectionAttemptLimit(1);

which seems to get it to climb faster

from hazelcast-csharp-client.

asimarslan avatar asimarslan commented on July 17, 2024

After some tests, it looks like there is no handle leak. But as socket's has a lingering option that keep sockets's handle unallocated, for a period of time these handles waits the socket-linger period.
After that period we see a sharp deallocation of handles.

User can configure .net client's Socket linger period with

clientConfig.GetNetworkConfig().GetSocketOptions().SetLingerSeconds(3)

But unfortunately, setting a zero value does not disable it altogether. I made a fix for this which will be released in next version (3.9)

Thanks @MBoden67 for your bug report, It also revealed another issue.

from hazelcast-csharp-client.

MBoden67 avatar MBoden67 commented on July 17, 2024

I just let my testcode run for 3 hour and 18 minutes

it went from using 622 handles to using 59964 handles , se attached images

handleleak20171011-3hourslater
handleleak20171011start

The running code :

` ClientConfig HazelConfig = null;
IHazelcastInstance instance = null;

		Hazelcast.Logging.Logger.SetLoggerFactory(new HazelLogger());

        HazelConfig = new ClientConfig();

        HazelConfig.GetNetworkConfig().AddAddress("10.10.15.123");
        HazelConfig.GetNetworkConfig().SetConnectionAttemptLimit(1);
        HazelConfig.GetNetworkConfig().GetSocketOptions().SetLingerSeconds(3);


        bool connected = false;
        while(!connected)
        {
            try
            {
                Program.instance = HazelcastClient.NewHazelcastClient(Program.HazelConfig);
               
                //                    ConnectToHazelcast();
                connected = true;
            }
            catch (Exception)
            {
                int ix = 1;
            }
        }            
		

class HazelLogger : ILoggerFactory, ILogger
{
    public ILogger GetLogger(string name)
    {
        return this;
    }

    public void Finest(string message)
    {
        this.Log(LogLevel.Finest, message);
    }

    public void Finest(Exception thrown)
    {
        this.Log(LogLevel.Finest, "Exception raised",thrown);
    }

    public void Finest(string message, Exception thrown)
    {
        this.Log(LogLevel.Finest, message, thrown);
    }

    public LogLevel GetLevel()
    {
        return LogLevel.All;
    }

    public void Info(string message)
    {
        this.Log(LogLevel.Info, message);
    }

    public bool IsFinestEnabled()
    {
        return true;
    }

    public bool IsLoggable(LogLevel level)
    {
        return true;
    }

    public void Log(LogLevel level, string message)
    {
        Console.WriteLine($"{DateTime.Now.ToLongTimeString()} [{level.ToString()}] : {message}");
    }

    public void Log(LogLevel level, string message, Exception thrown)
    {
        Console.WriteLine($"{DateTime.Now.ToLongTimeString()} [{level.ToString()}] : {message} , {thrown.Message}");
    }

    public void Severe(string message)
    {
        this.Log(LogLevel.Severe, message);
    }

    public void Severe(Exception thrown)
    {
        this.Log(LogLevel.Severe, "Exception raised",thrown);
    }

    public void Severe(string message, Exception thrown)
    {
        this.Log(LogLevel.Severe, message, thrown);
    }

    public void Warning(string message)
    {
        this.Log(LogLevel.Warning, message);
    }

    public void Warning(Exception thrown)
    {
        this.Log(LogLevel.Warning,"Exception raised", thrown);
    }

    public void Warning(string message, Exception thrown)
    {
        this.Log(LogLevel.Severe, message, thrown);
    }
}`

from hazelcast-csharp-client.

asimarslan avatar asimarslan commented on July 17, 2024

fixed by #125

from hazelcast-csharp-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.