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

Unexpected server process output when trying to delete an entry #22

Open
padde opened this issue Dec 2, 2014 · 5 comments
Open

Unexpected server process output when trying to delete an entry #22

padde opened this issue Dec 2, 2014 · 5 comments

Comments

@padde
Copy link

padde commented Dec 2, 2014

Code to reproduce:

require 'ladle'
require 'net/ldap'

ldap_server = Ladle::Server.new(
  domain: 'dc=example,dc=org',
  port: 12345
).start

ldap_client = Net::LDAP.new(
  host: 'localhost',
  port: 12345,
  search_domains: 'dc=example,dc=org'
)

# DN taken from lib/ladle/default.ldif
dn = 'uid=aa729,ou=people,dc=example,dc=org'

ldap_client.delete(dn: dn)
# (Output from Ladle::Server::ApacheDSController)
# ApacheDS process failed: Unexpected server process output: "IndexEntry[ ParentIdAndRdn<00000000-0000-0000-0000-000000000000, 'dc=example,dc=org'>[nbC:1, nbD:26], aa88f7e3-fd64-4c7f-b1bf-d3b1ca3b904b ]"

I could bypass the error message by changing Ladle::Server::ApacheDSController#watch to only report an error when the line starts with an all uppercase word. Then, the deletion is actually performed successfully. However, this seems like an ugly hack. I am not an LDAP expert, maybe I am doing something else wrong. Any help on this would be much appreciated!

def watch
  while ( !@ds_out.eof? && line = @ds_out.readline.chomp ) && !error?
    case line
    when /^STARTED/
      @started = true
    when /^FATAL/
      report_error(line)
    when /^STOPPED/
      @started = false
    when /^[A-Z]+\b/ 
      report_error("Unexpected server process output: #{line.inspect}")
    end
  end
end
@padde
Copy link
Author

padde commented Dec 2, 2014

I found out that the error disappears when I remove the search_domains: 'dc=example,dc=org' parameter from Net::LDAP.new(...). This works for me now, however the error handling in Ladle seems to be broken anyway.

@padde padde changed the title Unexpected server process output when trying to delete a user Unexpected server process output when trying to delete an entry Dec 2, 2014
@rsutphin
Copy link
Contributor

rsutphin commented Dec 2, 2014

Sorry to hear you're having trouble. Thanks for the minimal reproduction script!

Unfortunately, this looks like a problem somewhere in ApacheDS. Ladle uses standard out as a control channel with its ApacheDS runner and expects only messages from the runner to appear there. It looks like in this situation, ApacheDS itself is printing something to standard out directly (rather than using the normal logging mechanisms, which ladle's runner captures). I tried updating to the latest ApacheDS, but the problem remains.

Your monkey patch looks fine if it works for you, but I don't want to do a similar thing in Ladle because it might mask other bugs. The permanent fix would be to track down where this spurious log message is coming from in ApacheDS and block it.

@padde
Copy link
Author

padde commented Dec 2, 2014

Thanks for your quick reply. My monkey patch should not be considered production ready, otherwise I would have made it into a PR 😉. If I understand this correctly, someone forgot to remove a debug statement from the ApacheDS source. I agree this should be fixed in ApacheDS, not in Ladle.

@rsutphin
Copy link
Contributor

rsutphin commented Dec 2, 2014

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

2 participants