nextcloud / nextcloud/server

[Bug]: Some SVG files uploaded as logo make the server so slow it's unusable.

Open
#41,380 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage 26-feedback bug feature: theming performance 🚀
Dominant language
PHP
Stars
36.9k
Forks
5.2k
Avg merge
2d 3h
Merged PRs (30d)
713

Description

⚠️ This issue respects the following points: ⚠️
Bug description

TLDR : Some svg files uploaded in theme page make nextcloud spawn deadloop threads. There must be a check on image file upload confirming that it could be processed properly.

Symptoms : many php8.1-fpm thread that runs 100% cpu for very long time. All the server become sluggish for while, users complain.

After many hours of investigation, different tries over many days. Install of different PHP version, settings, file by file comparaison of two servers (one with the bug, the other is ok), activating apps one by one, and many other things. I found the error.
Each page load in admin console spawns a new buggy thread.
The thread top one core at 100% until php fpm max execution time.

This was the url that spawns the buggy thread : index.php/apps/theming/icon/settings?v=34

The thread has a handle on a tmp file :
#lsof -p #PID# | grep tmp

/tmp/magick-15561EyX140DZCYQ2

There were zilion of those files, all the same content. It's an svg file.

It was the logo in theming page.

The file is logo_coopdescommuns

Also, this error was preventing the test mail from being sent...

It appears on PHP8.1 PHP8.2, debian, apache...

Steps to reproduce
  1. upload the file as a theme logo
  2. refresh admin console
  3. watch the php-fpm thread go to 100% CPU for one hour :)
  4. refresh again to spawn other buggy threads and watch your server crawl
Expected behavior

Rejecting files that could not be properly processed.
Even if this bug is in imagemagick nextcloud must be sure to work fine anyways.

Installation method

Community Web installer on a VPS or web space

Nextcloud Server version

26

Operating system

Debian/Ubuntu

PHP engine version

PHP 8.2

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Fresh Nextcloud Server install

Are you using the Nextcloud Server Encryption module?

None

What user-backends are you using?
  • Default user-backend (database)
  • LDAP/ Active Directory
  • SSO - SAML
  • Other
Configuration report
not relevant
List of activated Apps
not relevant
Nextcloud Signing status
not relevant
Nextcloud Logs
not relevant
Additional info

I love you all :)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the admin console path index.php/apps/theming/icon/settings?v=34 and trace how the uploaded theme logo is processed. Reproduce with the reported SVG, then verify that refreshing the admin console does not create prolonged 100% CPU PHP-FPM threads or repeated temporary files. Done means the problematic file is rejected or handled without making the server unusable.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.