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

Bug while connection close gives an exception #43

Open
jayantjain93 opened this issue Dec 18, 2017 · 0 comments
Open

Bug while connection close gives an exception #43

jayantjain93 opened this issue Dec 18, 2017 · 0 comments

Comments

@jayantjain93
Copy link

jayantjain93 commented Dec 18, 2017

While doing a connection close, there is an Channel Inactive which is un-caught. Hence, the connection is not removed.
So I'm left with a stale connection, and not able to reconnect due to an existing entry to that address.

Logs:
16:14:47.245 INFO Remove connection server:4150 - NSQConsumer.connect
16:14:47.245 INFO Closing connection: com.github.brainlag.nsq.Connection@188fe003 - Connection.close
16:14:47.246 INFO Channel disconnected! com.github.brainlag.nsq.Connection@188fe003 - NSQHandler.channelInactive

Fix could be to put in try catch

        for (final ServerAddress server : Sets.difference(oldAddresses, newAddresses)) {
            LogManager.getLogger(this).info("Remove connection " + server.toString());                
           try {
                   connections.get(server).close();
          } catch (Exception e) {
                LogManager.getLogger(this).error("Close connection failed: " + e.getMessage(), e);
           } finally {
            connections.remove(server);
           }
        }

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

No branches or pull requests

1 participant