ome/apacheds-docker

ERR_250_ENTRY_ALREADY_EXISTS ou=system already exists

shashanksheela opened this issue · 18 comments

we have a docker-compose.yml will some services in which we are using this image for one service as below
version: '3.6'
services:
ldap:
image: openmicroscopy/apacheds
ports:
- "10389:10389"
- "10636:10636"
- "60088:60088"
- "60464:60464"
- "9090:8080"
- "8443:8443"
volumes:
- ./myconfig.ldif:/bootstrap/conf/config.ldif:ro
- myconfigdata:/var/lib/apacheds
//other services//
volumes:
myconfigdata:

The first time it starts perfectly but later on, it gives ERR_250_ENTRY_ALREADY_EXISTS ou=system already exists and gets terminated. Kindly help us.

full logs
{"log":"Cleaning up /var/lib/apacheds/default/run/apacheds-default.pid\n","stream":"stdout","time":"2018-06-21T07:38:21.869608788Z"}
{"log":"Starting ApacheDS - default...\n","stream":"stdout","time":"2018-06-21T07:38:24.91363281Z"}
{"log":"[07:39:43] ERROR [org.apache.directory.server.wrapper.ApacheDsTanukiWrapper] - Failed to start the service.\n","stream":"stdout","time":"2018-06-21T07:39:43.894071776Z"}
{"log":"org.apache.directory.api.ldap.model.exception.LdapEntryAlreadyExistsException: ERR_250_ENTRY_ALREADY_EXISTS ou=system already exists!\n","stream":"stdout","time":"2018-06-21T07:39:43.894094076Z"}
{"log":"\u0009at org.apache.directory.server.core.partition.impl.btree.AbstractBTreePartition.add(AbstractBTreePartition.java:698)\n","stream":"stdout","time":"2018-06-21T07:39:43.894106484Z"}
{"log":"\u0009at org.apache.directory.server.core.DefaultDirectoryService.initializeSystemPartition(DefaultDirectoryService.java:1764)\n","stream":"stdout","time":"2018-06-21T07:39:43.894110423Z"}
{"log":"\u0009at org.apache.directory.server.core.DefaultDirectoryService.initialize(DefaultDirectoryService.java:1824)\n","stream":"stdout","time":"2018-06-21T07:39:43.894113929Z"}
{"log":"\u0009at org.apache.directory.server.core.DefaultDirectoryService.startup(DefaultDirectoryService.java:1251)\n","stream":"stdout","time":"2018-06-21T07:39:43.89411724Z"}
{"log":"\u0009at org.apache.directory.server.ApacheDsService.initDirectoryService(ApacheDsService.java:364)\n","stream":"stdout","time":"2018-06-21T07:39:43.89412127Z"}
{"log":"\u0009at org.apache.directory.server.ApacheDsService.start(ApacheDsService.java:197)\n","stream":"stdout","time":"2018-06-21T07:39:43.894125062Z"}
{"log":"\u0009at org.apache.directory.server.ApacheDsService.start(ApacheDsService.java:153)\n","stream":"stdout","time":"2018-06-21T07:39:43.894128718Z"}
{"log":"\u0009at org.apache.directory.server.wrapper.ApacheDsTanukiWrapper.start(ApacheDsTanukiWrapper.java:175)\n","stream":"stdout","time":"2018-06-21T07:39:43.894146597Z"}
{"log":"\u0009at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)\n","stream":"stdout","time":"2018-06-21T07:39:43.894150444Z"}

We have tried by setting APACHEDS_INSTANCE still, the issue persists
environment:
APACHEDS_INSTANCE: "myinstance"

Hi @shashanksheela . Thanks for the compose example. I may end up adding that to the repo if you don't mind. I'm currently testing with:

version: "3.3"
services:
  ldap:
    image: "openmicroscopy/apacheds:0.6.0"
    ports:
      - "10389:10389"
      - "10636:10636"
      - "60088:60088"
      - "60464:60464"
      - "9090:8080"
      - "8443:8443"
    volumes:
      - ./myconfigdata:/var/lib/apacheds
      # ./myconfig.ldif:/bootstrap/conf/config.ldif:ro

since I don't have your config file. However, this is re-starting fine for me:

$ docker-compose up
Starting ldap_ldap_1 ...
Starting ldap_ldap_1 ... done
Attaching to ldap_ldap_1
ldap_1  | Starting ApacheDS - default...
ldap_1  | [09:31:44] WARN [org.apache.directory.server.core.DefaultDirectoryService] - You didn't change the admin password of directory service instance 'default'.  Please update the admin password as soon as possible to prevent a possible security breach.
^CGracefully stopping... (press Ctrl+C again to force)
Stopping ldap_ldap_1 ... done

Is your LDIF file something you could share with me so I could test?

Hmmm.... I'm not sure what's going on here, @shashanksheela. It's working for me:

  • with/without your LDIF file
  • with the volume set to myconfigdata as you have it or in the current directory like ./myconfigdata

Can you show me a full terminal script of starting a new volume, stopping it, and restarting it, all with the logs?

Edit: by the way:

$ docker --version
Docker version 18.03.1-ce, build 9ee9f40
$ docker-compose --version
docker-compose version 1.17.1, build 6d101fb

The only thing thing I can think of right now is that it's due to the filesystem settings somehow, i.e. that the final state of the server isn't being flushed to disk.

Would changing dockerfile accordingly helps?

If so, I don't know how. My work in #12 was focused specifically on fixing this restart issue, but for some reasons it's still happening in your environment.

So what can I try to make it run?

Do you have another system that you can try on? Do you have another file system? What's the output of df? How did you install docker? What version?

docker and docker-compose are at latest versions and using ubuntu 16.04
and df
Filesystem 1K-blocks Used Available Use% Mounted on
udev 8119620 0 8119620 0% /dev
tmpfs 1629240 9736 1619504 1% /run
/dev/sda2 944403884 84320416 812087412 10% /
tmpfs 8146188 34088 8112100 1% /dev/shm
tmpfs 5120 4 5116 1% /run/lock
tmpfs 8146188 0 8146188 0% /sys/fs/cgroup
/dev/sda1 523248 4756 518492 1% /boot/efi
tmpfs 1629240 60 1629180 1% /run/user/1000

docker and docker-compose are at latest versions and using ubuntu 16.04

Go ahead and paste the version numbers please.

One thing you might try is:

docker-compose up -d

and then

docker-compose down

i.e. don't use Ctrl-C, but I'm really grasping at straws until I can see the problem happen here.

Docker version 18.03.1-ce
compose file format 3.6
docker-compose version 1.21.2

docker-compose down will work because it creates new container

docker-compose down will work because it creates new container

What's the harm in that? Isn't it only the volume that you care about?

Actually what usually happens is our app will be running and we run docker-compose up parallely so only necessary apps will get restart

Ok. I'm not sure how you're using it, but my suggestion wasn't likely to be different than the Ctrl-C anyway.

Just to double check: you're not mounting myconfigdata in any other container, correct?

yes i am not mounting in any other container

Unless you think you can show me more of your compose file, I'm not sure I have anything else to go on. You could try taking docker-compose out of the picture and test strictly with a docker image and see if it will work for you.

docker image is working perfectly. Anyway, I will just think about alternatives. Thank you @joshmoore for your guidance.

You're very welcome, @shashanksheela. If you find a solution, please do let us know. (As a side note: if you happen to also be using kubernetes you could try https://github.com/openmicroscopy/apacheds-k8s-app)