Moving or deleting files never responds, causes PHP to time out

Nextcloud version (eg, 18.0.2): 18.0.7
Operating system and version (eg, Ubuntu 20.04): Debian 10.4
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.38
PHP version (eg, 7.1): 7.3.20-1+0~20200710.65+debian10~1.gbpc9cbeb

The issue you are facing:

Moving or deleting a file never completes. The processing icon just spins forever. The HTTP request is dispatched but no response ever arrives.

Often the only way to continue working is to forcibly restart the server’s PHP-FPM service, service php7.3-fpm restart.

Is this the first time you’ve seen this error? (Y/N): N

Steps to replicate it:

  1. Try to delete or move a file.

The output of your Nextcloud log in Admin > Logging:
There are no new log entries when attempting the file actions.

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => 'ocs6pbp54s7p',
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
  'datadirectory' => '/var/www/cloud/data',
  'dbtype' => 'mysql',
  'version' => '',
  'overwrite.cli.url' => '',
  'installed' => true,
  'maintenance' => false,
  'dbname' => 'cloud_nextcloud',
  'dbhost' => '',
  'dbuser' => 'cloud',
  'dbpassword' => '',
  'mail_smtpmode' => 'sendmail',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'cloud',
  'mail_domain' => '',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'theme' => '',
  'loglevel' => 2,
  'mysql.utf8mb4' => true,

The output of your Apache/nginx/system log in /var/log/____:

Apache access log /var/log/apache2/ shows a 504 (gateway timeout):

***::11 - - [19/Jul/2020:13:44:37 +0200] "DELETE /remote.php/dav/files/1d07a501-605f11e8-8c77c862-0c77e7f2/Everyone/Re$ HTTP/1.1" 504 864 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.89 $afari/537.36"

Apache error log /var/log/apache2/ shows timeout talking with FastCGI:

[Sun Jul 19 13:44:53.478764 2020] [proxy_fcgi:error] [pid 12218] (70007)The timeout specified has expired: [client ***::11:52178] AH01075: Error dispatching request to : (polling)

/var/log/php7.3-fpm.log shows nothing special:

[19-Jul-2020 13:27:54] NOTICE: fpm is running, pid 3486
[19-Jul-2020 13:27:54] NOTICE: ready to handle connections
[19-Jul-2020 13:27:54] NOTICE: systemd monitor interval set to 10000ms
(Nothing further)

Looks like it happens when trying to unshare too, and renaming a file or folder.
This is terrible.