docker icon indicating copy to clipboard operation
docker copied to clipboard

Container startup takes hours before being ready to handle requests

Open norweeg opened this issue 3 years ago • 1 comments

Everytime I restart my wallabag container, it takes hours before the container is ready to begin servicing requests. This started after upgrading from 2.4.2 to 2.4.3. Below is the output of ps -elf run as root inside the container. Please note that process 7 is 1h42 and the server is still not ready to handle requests.

bash-5.0# ps -elf
PID   USER     TIME  COMMAND
    1 root      0:00 {entrypoint.sh} /bin/sh /entrypoint.sh wallabag
    7 root      1h42 {ansible-playboo} /usr/bin/python3 /usr/bin/ansible-playbook -i /etc/ansible/hosts /etc/ansible/entrypoint.yml -c local
  230 root      0:00 {ansible-playboo} /usr/bin/python3 /usr/bin/ansible-playbook -i /etc/ansible/hosts /etc/ansible/entrypoint.yml -c local
  241 root      0:00 /bin/sh -c /usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1649526269.6815948-230-49720380011236/AnsiballZ_file.py && sleep 0
  242 root      3:58 /usr/bin/python3 /root/.ansible/tmp/ansible-tmp-1649526269.6815948-230-49720380011236/AnsiballZ_file.py
  243 root      0:00 bash
  250 root      0:00 bash
  265 root      0:00 ps -elf

norweeg avatar Apr 09 '22 23:04 norweeg

so I did some digging and it appears that it is hanging trying to chown nobody:nogroup the entire /var/www/wallabag directory at start. Is there a reason why it does this?

norweeg avatar Apr 30 '22 01:04 norweeg

It's to ensure permission are ok for the server to write log and other stuff.

j0k3r avatar Nov 30 '22 22:11 j0k3r

It's to ensure permission are ok for the server to write log and other stuff.

Why would the permissions have changed? This check is extremely unnecessary to run every single time the container starts. I am running a single-user instance and it takes hours to check and set permissions on every single cached image. I have had to get in the habit of moving the image directory OUT of the mapped volume just so it will boot quickly, then move the images back in.

norweeg avatar Dec 01 '22 05:12 norweeg

I can understand. But what did you suggest instead? We should ensure permission ok when running the container. What are other option to avoid running it every time someone restart its container?

j0k3r avatar Dec 14 '22 08:12 j0k3r

do the check once on the first time the container is started then never again? it would be unusual for the permissions on these directories to be changed after the container sets them the first time it starts unless someone intentionally went in and changed them, breaking their system. Assuming that the average user isn't going to intentionally change permissions to break their installs, lengthy re-checking of permissions isn't necessary every time

norweeg avatar Dec 16 '22 05:12 norweeg

I'm ok for that, you can open a PR to fix the problem :)

j0k3r avatar Dec 16 '22 09:12 j0k3r

something changed upstream the docker image no longer exhibits this behavior as of the 2.5.3 image. Closing this Issue. Thanks for fixing this! Startup of my wallabag server now takes < 1 minute!

norweeg avatar Feb 02 '23 20:02 norweeg