Warning: touch(): Utime failed: Operation not permitted in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save() (line 98 of /drupal/core/lib/Drupal/Component/PhpStorage/MTimeProtectedFastFileStorage.php).

CommentFileSizeAuthor
#3 stack.txt11.93 KBfgm

Comments

A.Eid created an issue. See original summary.

Anonymous’s picture

Status: Active » Closed (cannot reproduce)

You're going to have to provide some more details on this issue...

fgm’s picture

Version: 8.1.0 » 8.1.x-dev
Priority: Major » Normal
Status: Closed (cannot reproduce) » Active
StatusFileSize
new11.93 KB

Got this on today's 8.1.x HEAD, at /admin/config/development Running on single server Ubuntu 16.10: MySQL 5.7, PHP 7, standard install profile. Installed contrib: devel, kint, config_inspector, all at current HEAD. Local (but sloooow) file system on magnetic disk.

Downgrading to normal because it doesn't prevent site use.

Probably significant : the error does not reappear when refreshing page.

I attached the full trace because it's rather noisy.

dawehner’s picture

Isn't that mostly a permission issue? Maybe you are running some CLI scripts as a different user, which then lets phpstorage have directories with different users.

fgm’s picture

Something is indeed strange here: directories starting at sites/default/files/php/twig have permissions 0777/myself/www-data and twig-compiled files are 0644/myself/www-data (my umask is 0002 and my primary group is www-data).

Even stranger is the fact that the error does not recur on refresh.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

replicaobscura’s picture

We run into this problem constantly on Pantheon, and I'm not sure why yet. After clearing the cache, we often see a ton of these error messages show up once the first time a page is loaded, then not again until the next cache clear.

They fill up the DB logs and are really annoying, but don't appear to cause any actual problems with the site. I'd very much like to find a fix, however.

The errors seem to be:

Warning: touch(): Utime failed: No such file or directory in Drupal\Component\PhpStorage\MTimeProtectedFastFileStorage->save()

Followed by a bunch of errors about specific twig cache files such as:

Warning: filemtime(): stat failed for sites/default/files/php/twig/5909ef0b8825a_commerce-cart-blocks-cart_MaNNmvNIStysTb2NfG4WkcQNO/9qdTOGo5K4ECts7czpasaqgXDVY7qI8qIGBhQca3glQ.php in Drupal\Component\PhpStorage\MTimeProtectedFileStorage->checkFile()

dman’s picture

Me too.
Only just starting to wonder if I need to debug it.
FWIW, I just started seeing it on the switch from a dev env running apache2handler on PHP Version 7.0.15-0ubuntu0.16.10.4 - where we didn't see the error - to cgi-fcgi (Identical OS)
So it feels related to the permissions of the user account that fcgi delegates to.

I'm about to go looking carefully at the file perms now... It's quite possible they need a tweak, as I just did a full files transfer to the new server.

Gravypower’s picture

@bmcclure I am also experiencing this issue with Pantheon.

It appeared after I updated to 8.3.0 and think it has something to do with thousands of twig files being generated. It is coupled with very bad performance until I clear the cache. I can't say whether the file generation is a fault of mine or not but will keep this thread updated as I am looking into the issue atm.

Aaron

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Omar79’s picture

I changed permissions of the google_tag folder so that my Apache can access it and this issue was resolved for me. However, on every cache reset, the ownership of my google_tag folder is reset and the error occurs again.

Omar79’s picture

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

vuil’s picture

Status: Active » Needs review

Please update your version PHP>=7.2

This is main requirement of Drupal core 8.8/8.9 and above.

colan’s picture

Status: Needs review » Active

I'm running PHP 7.2 and I'm still getting this. So that's not the problem.

Fixing status as there's no code here.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
quietone’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +Bug Smash Initiative

This appears to be an uncommon error. It has been reported to happen with Pantheon and outdated versions of PHP and Drupal.

Is anyone experiencing this error on a currently supported version of Drupal?

If so, reopen the issue, by setting the status to 'Active', and provide complete steps to reproduce the issue (starting from "Install Drupal core") and your PHP version, Drupal version and environment.

Thanks

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

tonka67’s picture

I've got this problem on a new local install with Docker. Also Ubuntu/Pantheon. I'm running Drupal 9.4.8 and PHP 8.0.24.

tonka67’s picture

Status: Postponed (maintainer needs more info) » Active
superrn’s picture

This is happening on 9.4.8 and PHP 8.1 for us as well, on a production site. Not clear what is causing it. The call stack does show the issue is related to twig.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

dunebl’s picture

Same as #26 but on D9.5.1/Ubuntu 22.04 with php 8.1.14

dunebl’s picture

It happens each time I uninstall a module with the GUI. (But it happens also on other occasions, but I don't see a pattern)

dunebl’s picture

I found the reason why this warning pop-up: this is because the PHP touch() function works only if the file or directory being touched is owned by the PHP user (www-data for apache). If the file or directory have only the group set as www-data it will not work.
As a requirement we must say that all Drupal temp files must be www-data:www-data

ragnarkurm’s picture

We are experiencing this problem on NFS based filesystem.
We had distributed system where many hosts worked with the same NFS filesystem.

What seems to be happening is this:

  1. Drupal creates a file
  2. NFS starts to sync file creation operation to the NFS server
  3. Some other process was seeing the file and removed it
  4. Drupal tries to touch the file, but NFS get confused
  5. Drupal issues error/warning of touch()

Note: there is another problem also involved: the file sometimes has a random mtime, usually far in the past.

_kom__’s picture

I've got the similar warnings when I've tried to mount 'drupal' folder on the host via nfs+bindfs plugin into guest machine managed by Vagrant+Virtualbox. Mount configuration is:

config.vm.synced_folder "drupal", "/vagrant-nfs", type: "nfs", nfs_udp: false
config.bindfs.bind_folder "/vagrant-nfs", "/var/www/drupal",
      u: 'vagrant',
      g: 'vagrant',
      perms: 'u=rwX:g=rwD',
      o: 'nonempty'
  config.nfs.map_uid = Process.uid
  config.nfs.map_gid = Process.gid

Vagrant and www-data are members of both groups 'vagrant' and 'www-data'.

On the other hand, there is no warnings when using native vboxsf with same user:group:

config.vm.synced_folder "drupal", "/var/www/drupal", owner: "vagrant", group: "vagrant"

No errors observed on production server with totally same configuration: Drupal 9.5.8, Ubuntu 22.04.2,
PHP 8.1.18, Apache 2.4.52 with another 'sysadmin:sysadmin' user and no mount directories.

solideogloria’s picture

This error can be fixed by deleting the public://php/ folder and clearing the site cache with drush cr. The site will recreate the folder with www-data as the owner and drwxrwxrwx (777) permissions.

Alternatively, if you copy the folder on deploy, you can set permissions with something like this after:

# public://php/
sudo find /var/www/html/web/sites/default/files/php/ -type d -exec chown www-data:www-data {} \; -exec chmod 777 {} \;
sudo find /var/www/html/web/sites/default/files/php/ -type f -exec chown www-data:www-data {} \; -exec chmod 777 {} \;
fgm’s picture

Not necessarily: it will recreate with the user running drush as owner. And in many cases this means a user that is not www-data (or is equivalent on other distros) but which has www-data as its primary group. That's a situation I encounter quite frequently when doing audits.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.