question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to reconnect? (Deadlock when reconnecting)

See original GitHub issue

If i turn off one node i get timeout exception and crush my app. What i do wrong?

 var cf = new StanConnectionFactory();
            var opts = StanOptions.GetDefaultOptions();
            opts.NatsURL = "nats://127.0.0.1:4222,nats://127.0.0.1:4223,nats://127.0.0.1:4224";
            using (var c = cf.CreateConnection("test-cluster", "appname", opts))
            {
                using (c.Subscribe("foo", (sender, handlerArgs) => Console.WriteLine(
                    System.Text.Encoding.UTF8.GetString(handlerArgs.Message.Data))))
                {
                    while (true)
                    {
                        c.Publish("foo", System.Text.Encoding.UTF8.GetBytes("hello"));
                        await Task.Delay(300);
                    }
                   
                }
            }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
DeployChefcommented, Sep 2, 2019

I set try{}catch and i want on second try get reconnected producer, but reconnect not happen… It is only working when I set nats options.


                Options nopts = ConnectionFactory.GetDefaultOptions();

                nopts.MaxReconnect = -1;

                nopts.MaxPingsOut = 2;

                nopts.PingInterval = 500;

                nopts.Servers = new[] { "nats://127.0.0.1:4223", "nats://127.0.0.1:4224" };

Why reconnect don’t working with Stan pattern.

How do i can have reconnect with Stan classes only?

0reactions
DeployChefcommented, Sep 4, 2019

Thanks! 😉

Read more comments on GitHub >

github_iconTop Results From Across the Web

Warning: The connection was closed. Trying to reconnect ...
Trying to reconnect There was a deadlock when executing this statement. ... 2017-04-11 04:08:39 +02:00 - Warning: The connection was closed.
Read more >
sql - Deadlock, Connection to the database is dropped
The only way to stop it is to figure out why the deadlocks are occurring in the first place. You can run a...
Read more >
Reconnecting with Persistent Locks
Once the connector is reassigned its persistent locks, the locks are no longer persistent. They are ordinary locks subject to normal serialized list...
Read more >
How can I narrow down the cause of a deadlock after ...
We're using a .Net 4.5 web application with SQL Server 2012 on the same machine. We will sporadically see a cluster of "Wait...
Read more >
Nest × Yale Lock disconnected or offline
On the Nest app home screen, tap Settings Nest settings icon and then Nest Connects. · Select your Nest Connect and then Check...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found