[BUG] chown -R /comics is slow on networked filesystem
thebearmayor opened this issue · comments
The command chown -R abc:abc /config /defaults /app /comics
in the startup script takes a long time when there are many files in /comics
, and /comics
is a mounted network filesystem. Additionally, something kills this command after 5 minutes, causing a restart loop
Expected Behavior
Container should start successfully.
Current Behavior
I am deploying this container using the TrueCharts chart on TrueNAS SCALE. /comics
is an NFS mount to localhost, due to limitations in SCALE. There are ~10k files in /comics
.
Today, I noticed the yacreaderlibraryserver app was not starting successfully. Shelling into the container, I found the chown
process running for several minutes. strace
showed it was chowning every file in /comics
, even if the ownership was correct. Additionally, strace
showed the process was killed after 5 minutes, and a new chown
process was started.
After deleting some files in /comics
, yacreaderlibraryserver started successfully.
Steps to Reproduce
- Create a comics directory with many files on a network drive.
- Start container with network drive mounted on
/comics
. - Shell into container and observe that
chown
is running for several minutes. - Observe that
chown
is killed after 5 minutes and YACReaderLibraryServer does not start.
Screenshots
If applicable, add screenshots to help explain your problem.
Environment
OS: TrueNAS SCALE
CPU architecture: x86_64
Command used to create docker container (run/create/compose/screenshot)
Docker logs
Additional information
It might be faster to do find . -not \( -user abc -and -group abc \) -exec chown abc:abc {} +
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
I've updated the init script - do you want to give the new release a try and see if it is running faster for you/not failing in the networked environment?
Thank you for taking a look at this. I suppose it was more of a problem with Truenas SCALE than with NFS specifically. I'm no longer using Truenas SCALE, just running on Docker, and both versions are fast now. Hopefully this helps somebody in my old situation.
Right on, it couldn't have hurt to speed up the chown operation anyway, so thanks for the suggestion!