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.

Can't connect to LDAP Server on Linux

See original GitHub issue

Describe the bug I am able to connect to LDAP Server in the wndows but through docker container when I am using Linux Platform I am getting this error stating that Can’t connect to LDAP Server.

LdapForNet.LdapException: Can't contact LDAP server. Result: -1.

To Reproduce It can be reproduced when we write a Dockerfile in linux environment.

Expected behavior Make it cross-platform compatible Desktop (please complete the following information):

  • OS: Linux
  • Library version: 2.7.11
  • .NET\core\mono version- 3.1
  • LDAP server: Active Directory

Additional context I have tried to install the necessary libraries for LDAP as well for linux.

apt-get update && apt-get install -y ldap-utils krb5-kdc-ldap libsasl2-2 libsasl2-modules sasl2-bin libsasl2-modules-ldap openssl

Let me know if I am missing on anything. Thanks a lot in advance.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
BalassaMartoncommented, Mar 4, 2022

I’m having a very similar problem on Linux (RHEL7) when trying to reuse connections. Everything is fine if I’m disposing every LdapConnection after using it. However, when pooling the connection, after a few requests I get the same exception when sending a SearchRequest: Can’t contact LDAP server. Result: -1. Method: SearchRequest. Is it possible that it is a memory leak in LdapForNet or OpenLDAP after all? To verify this, I tried using the same connection for every request, using a semaphore to make sure they are not run in parallel. I also did a full GC and logged the total process memory (Process.GetCurrentProcess().WorkingSet64) before and after each usage of the connection. Memory usage grows dramatically during the first few requests, and after that all requests fail with above error.

1reaction
AbhilashKopallicommented, Dec 5, 2021

Hi @flamencist,

I have retried if it fails for the pagination and now I am encountering OutofMemory Exception. Is there any memory leak going on anywhere, the total records is 11000 and my pod memory size is 256MB. Any idea why this is happening?

System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown. at System.Collections.Generic.Dictionary2.Resize(Int32 newSize, Boolean forceNewHashCodes) at System.Collections.Generic.Dictionary2.TryInsert(TKey key, TValue value, InsertionBehavior behavior) at System.Collections.ObjectModel.KeyedCollection2.AddKey(TKey key, TItem item) at LdapForNet.RequestHandlers.SearchRequestHandler.GetLdapAttributes(SafeHandle ld, IntPtr entry, IntPtr& ber) at LdapForNet.RequestHandlers.SearchRequestHandler.GetLdapEntries(SafeHandle ld, IntPtr msg, IntPtr ber)+MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at LdapForNet.RequestHandlers.SearchRequestHandler.Handle(SafeHandle handle, LdapResultType resType, IntPtr msg, DirectoryResponse& response) at LdapForNet.LdapConnection.ProcessResponse(DirectoryRequest directoryRequest, RequestHandler requestHandler, Int32 messageId, CancellationToken token) at LdapForNet.LdapConnection.<>c__DisplayClass24_0.<SendRequestAsync>b__0() at System.Threading.Tasks.Task1.InnerInvoke() at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state) `

Read more comments on GitHub >

github_iconTop Results From Across the Web

Can't connect to LDAP server
The usual causes of connection refusal: wrong IP, wrong port, server not running, firewall in the way. – user207421. Oct 13, 2015 at...
Read more >
Server cant access LDAP-Server anymore (ping possible)
1. Try tcpdump port 389 to see traffic. To exclude problems with the ldap client, also use netcat (also known as ncat or...
Read more >
Troubleshooting LDAP server connections
Unable to contact the LDAP server ... Ensure that the server is available at the configured address and, if the server address is...
Read more >
LDAP configuration error, can't connect to LDAP server (-1)
Hi I'm trying to set up a Linux server and I am new to this. I have gone through most of the configuration...
Read more >
Troubleshooting LDAP Connections | Support
A server or application that communicates with an LDAP server is not functioning correctly; e.g.. Slow; Dropped communications; Exceptions ...
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