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

/tmp is filling up, when occ preview:generate-all is used #1327

Closed
ErikSteiner opened this issue Oct 29, 2024 · 4 comments
Closed

/tmp is filling up, when occ preview:generate-all is used #1327

ErikSteiner opened this issue Oct 29, 2024 · 4 comments
Labels
needs details Issue waiting for more details

Comments

@ErikSteiner
Copy link

Describe the bug

Temporary files are written to the Docker host under /var/lib/docker/overlay2 until the hard drive is full and the host dies. The corresponding container can be traced back to the app container of the attached Docker compose. Under /tmp of the container, 43 GB of data accumulates in a very short time, each of which is filled in folders of approx. 500 MB.

The problem first occurred after Memories was installed and a cron job was activated to create the preview images.

I would be grateful for any help in finding out the reasons for this.

This is the content in the docker container app:

# ls -lah
total 43G
drwxrwxrwt 1 root root 4.0K Oct 29 14:35 .
drwxr-xr-x 1 root root 4.0K Oct 28 20:31 ..
-rwxr-xr-x 1 1004 1004 8.5M Oct 28 20:32 exiftool-ocgh0x2ccfv3-12.70-c435c63a
-rwxr-xr-x 1 1004 1004 7.4M Oct 28 20:36 exiftool-ocgh0x2ccfv3-12.70-f3319c53
-rwxr-xr-x 1 1004 1004 4.9M Oct 28 20:32 go-vod-ocgh0x2ccfv3-0.2.5-7345fee3
drwx------ 3 1004 1004 4.0K Oct 28 20:36 par-53595354454d
-rw------- 1 1004 1004 502M Oct 28 22:14 php0xPDBG
-rw------- 1 1004 1004 504M Oct 29 07:54 php10sO80
-rw------- 1 1004 1004 501M Oct 29 07:48 php1EO9WC
-rw------- 1 1004 1004 501M Oct 29 07:52 php2Oh3y6
-rw------- 1 1004 1004 502M Oct 28 22:12 php32xkfQ
-rw------- 1 1004 1004 502M Oct 28 22:17 php3JQIq4
-rw------- 1 1004 1004 501M Oct 29 07:54 php5eLAGJ
-rw------- 1 1004 1004 501M Oct 29 07:48 php64sSUM
-rw------- 1 1004 1004 503M Oct 29 07:56 php7PBuCy
-rw------- 1 1004 1004 505M Oct 28 22:17 php7qvkrz
...

Docker Compose: docker-compose.txt

Cron job on Docker Host:
/etc/systemd/system/nextcloud-preview-generator.service:

[Unit]
Description=Nextcloud Preview Generator

[Service]
Type=oneshot
User=root
IOSchedulingClass=2
IOSchedulingPriority=7
ExecStart=/usr/bin/docker compose -f /docker/nextcloud/docker-compose.yml exec app php occ preview:generate-all

[Install]
WantedBy=basic.target

Cron timer:
/etc/systemd/system/nextcloud-preview-generator.timer:

[Unit]
Description=Run Nextcloud Preview Generator daily at 04:00

[Timer]
OnCalendar=*-*-* 4:00:00
Persistent=true

[Install]
WantedBy=timers.target

Steps To Reproduce

No response

Platform

- OS: Ubuntu 22.04.5 LTS (GNU/Linux 5.15.0-1068-kvm x86_64)
- Browser: N/A
- Memories Version: 7.4.1
- Nextcloud Version: Nextcloud Hub 8 (29.0.8)
- PHP Version: 8.2.24

Screenshots

No response

Additional context

  • Any errors in the JS console?
  • Any errors in the Nextcloud server logs?
@ErikSteiner ErikSteiner added the needs triage To be triaged label Oct 29, 2024
@pulsejet
Copy link
Owner

pulsejet commented Nov 1, 2024

Does this issue go away if you don't run the cron job to generate previews? In that case it's a bug in preview generator https://github.com/nextcloud/previewgenerator

@pulsejet pulsejet added needs details Issue waiting for more details and removed needs triage To be triaged labels Nov 1, 2024
@ErikSteiner
Copy link
Author

As far as I can understand, the problem is due to php-fpm. It creates phpxxxxx files under /tmp. If these only occur when uploading and especially when using WebDAV, I would say that the problem has nothing to do with the preview or memories. The fact that the PHP process dies and leaves a file under /tmp has been fixed by adjusting php-fpm settings.

@pulsejet
Copy link
Owner

pulsejet commented Nov 5, 2024

For the record, can you indicate which setting this is?

@ErikSteiner
Copy link
Author

Sorry for the delay. I had disassembled my PC for a long time.

Here are the relevant settings with which I have had no problems since then. The settings cannot be adopted one-to-one. They are calculated and are linked in the docker-compose excerpt.

zz-pm.conf

[www]
pm.max_children = 64
pm.start_servers = 16
pm.min_spare_servers = 16
pm.max_spare_servers = 48
  app:
    build: ./mediadc
    restart: unless-stopped
    user: ${UID}:${GID}
    depends_on:
...
    volumes:
...
      # zz-pm.conf needs root:root
      # https://chrismoore.ca/2018/10/finding-the-correct-pm-max-children-settings-for-php-fpm/
      # calculator: https://tideways.com/profiler/blog/an-introduction-to-php-fpm-tuning 
      - ./zz-pm.conf:/usr/local/etc/php-fpm.d/zz-pm.conf
      - /etc/localtime:/etc/localtime:ro
      - /etc/timezone:/etc/timezone:ro
    tmpfs:
      - /tmp:exec   

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs details Issue waiting for more details
Projects
None yet
Development

No branches or pull requests

2 participants