Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leak on failed connection attempts. #236

Closed
mawelsh opened this issue Oct 17, 2018 · 4 comments · Fixed by #278
Closed

Memory leak on failed connection attempts. #236

mawelsh opened this issue Oct 17, 2018 · 4 comments · Fixed by #278
Assignees

Comments

@mawelsh
Copy link

mawelsh commented Oct 17, 2018

In operation I would like to be able to leave applications running prior to starting the NATS server that expect to see one at some point in their life. Currently I have a loop:

while ((natsConnection == null) || (natsConnection.State != ConnState.CONNECTED))
{
    try
    {
        Log.Information("Creating nats connection with: [{0}]...", opts.Url);

        natsConnection = new ConnectionFactory().CreateConnection(opts);
    }
    catch (Exception e)
    {
        Log.Information(e.ToString());
    }
}

natsConnection remains null on failure but the memory usage steadily grows with each attempt. the memory is not returned on a successful connection.

@BenDerPan
Copy link

BenDerPan commented Oct 20, 2018

I meet a problem may due to this: when my program running for a long time, the message receive will become duplicated, for example: A send "Hello" once to B , B will receive more than one time, and I step into code, found A call MessageHandler more than one time , even though I A just send once.

but when I reboot both A and B , problem is gone , but will reproduce for a long time running.

@mawelsh
Copy link
Author

mawelsh commented Nov 19, 2018

I guess the other question would be is there a more preferred way to startup a service and wait/watch for a NATS server to come online that doesn't memory leak?

@TheVons
Copy link

TheVons commented Nov 19, 2018

We could use this fix too

@ColinSullivan1
Copy link
Member

I'm looking into this now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants