Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Reconnect closed connection? #65

Closed
ghost opened this issue Apr 20, 2017 · 7 comments
Closed

Reconnect closed connection? #65

ghost opened this issue Apr 20, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Apr 20, 2017

Using this configuration

  {rabbitmq_auth_backend_ldap,
   [{servers,                   ["dc.example.com"]},
    {dn_lookup_bind,            {"[email protected]", "xxxx"}},
    {dn_lookup_attribute,       "sAMAccountName"},
    {dn_lookup_base,            "OU=users,DC=example,DC=com"},
    {use_ssl,                   false},
    {port,                      389},
    {log,                       true},

works fine. But after some time of inactivity(?), the connection to the LDAP server is closed, the next authentication attempt produces this error:

=WARNING REPORT==== 20-Apr-2017::10:05:07 ===
TCP connection to a LDAP server is already closed.

=ERROR REPORT==== 20-Apr-2017::10:05:07 ===
** Generic server <0.214.0> terminating
** Last message in was {submit,#Fun<rabbit_auth_backend_ldap.14.122028335>,
                               <0.19832.0>,reuse}
** When Server state == {from,<0.19832.0>,#Ref<0.0.9.166114>}
** Reason for termination == 
** {{badmatch,{ok,<0.1345.0>}},
    [{rabbit_auth_backend_ldap,purge_conn,3,
                               [{file,"src/rabbit_auth_backend_ldap.erl"},
                                {line,521}]},
     {rabbit_auth_backend_ldap,'-with_ldap/3-fun-2-',4,
                               [{file,"src/rabbit_auth_backend_ldap.erl"},
                                {line,416}]},
     {worker_pool_worker,handle_call,3,
                         [{file,"src/worker_pool_worker.erl"},{line,105}]},
     {gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1024}]},
     {proc_lib,wake_up,3,[{file,"proc_lib.erl"},{line,249}]}]}

How can I configure the rabbit_auth_backend_ldap to keep the connection open or reconnect automatically?

@michaelklishin
Copy link
Member

Thank you for your time.

Team RabbitMQ uses GitHub issues for specific actionable items engineers can work on. This assumes we have a certain amount of information to work with.

We get at least a dozen of questions through various venues every single day, often quite light on details.
At that rate GitHub issues can very quickly turn into a something impossible to navigate and make sense of even for our team. Because of that questions, investigations, root cause analysis, discussions for potential features are all considered to be mailing list material by our team. Please post this to rabbitmq-users.

Getting all the details necessary to make a conclusion or even form a hypothesis about what's happening can take a fair amount of time. Please help others help you by providing as much relevant information as possible on the list:

  • Server and client versions used
  • Server logs
  • A code example or terminal transcript that can be used to reproduce
  • Full exception stack traces (not a single line message)
  • rabbitmqctl status (and, if possible, rabbitmqctl environment output)
  • Other relevant things about the environment and workload, e.g. a traffic capture

Feel free to edit out hostnames and other potentially sensitive information.

When/if we have enough details and evidence we'd be happy to file a new issue.

Thanks you.

@michaelklishin
Copy link
Member

The plugin uses a pool of connections and opens new ones as necessary. It also purges inactive connections because having a pool of constantly open ones is not always desired. Please provide more details on the mailing list, at the very minimum the server version used and log files.

@michaelklishin
Copy link
Member

OK, I think I understand what the issue really is.

@ghost
Copy link
Author

ghost commented Apr 20, 2017

The server version is RabbitMQ 3.6.9 installed from the Ubuntu APT repository.

@michaelklishin
Copy link
Member

See #66. What happened in your case is:

  • An LDAP server or intermediary/proxy closed a TCP connection from this plugin
  • The plugin tried to purge it but failed due to an incorrect assumption in the code

It should not affect the entire pool of connections, however, but if it does, re-enabling the LDAP plugin or worst case restarting the node should help. We will rectify connection purging for 3.6.10.

@ghost
Copy link
Author

ghost commented Apr 20, 2017

Yes, restarting the node helps. I will wait for 3.6.10, thanks!

@michaelklishin
Copy link
Member

@lutzhorn thank you for providing enough information for us to investigate!

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

No branches or pull requests

1 participant