<p>I have an issue with attaching a file to a Matrix field and then saving the entry takes up to 2 minutes. If I open up another tab with the Craft CMS admin interface I can see that Craft is performing the task: "Delete Stale Template Caches"</p>

<p>This does not happen in DevMode.</p>

<p>I have read: <a href="https://craftcms.com/support/stuck-tasks" rel="nofollow noreferrer">https://craftcms.com/support/stuck-tasks</a> but none of our templates are using the {% cache %} tag. Also there is nothing logged in: craft/storage/runtime/logs/phperrors.log I also tried clearing the caches to no avail.</p>

<p>I have also found:
<a href="https://craftcms.stackexchange.com/questions/15850/saving-some-entries-and-a-matrix-field-settings-takes-a-very-long-time">Saving some entries and a matrix field settings takes a very long time</a>
but this does not provide any real answers.</p>

<p>The server is running PHP 7.0.20 and running Nginx as a reverse proxy in front of Apache via ServerPilot.</p>

CC BY-SA 3.0
2017-07-05T18:11:13.907Z
Does it happen when you save the same Matrix field without attaching a file?  How big is the file and what type of file is it?
Brad Bell
CC BY-SA 3.0
2017-07-07T14:38:05.173Z
This does not happen when adding a matrix field without a file attached. Further testing suggest that it only happens with PDF files. This was a 27Kb .pdf file. With a larger .png it does not happen. Both files were already uploaded to assets, so they where just attached to the entry.
Pim Verbij
CC BY-SA 3.0
2017-07-07T18:16:43.970Z
Hrm... all PDF files or just that one? Any chance you've got something like mod_security or Suhosin installed on that box?
Brad Bell
CC BY-SA 3.0
2017-07-09T18:20:01.303Z
This happens with any PDF files. Mod_Security or Sushosin are not installed.
Pim Verbij
CC BY-SA 3.0
2017-07-09T22:28:07.167Z
Are you using http://php.net/manual/en/book.image.php or http://php.net/manual/en/book.imagick.php on your server?  If it's the former, can you try installing the later? Craft will automatically use it by default if it is installed.
Brad Bell
CC BY-SA 3.0
2017-07-10T08:14:43.293Z
Hi Brad, thanks for looking at this. Unfortunately, still no luck, I installed and verified ImageMagick as per: https://serverpilot.io/community/articles/how-to-install-the-php-imagemagick-extension.html but the issue still happens.
Pim Verbij
CC BY-SA 3.0
2017-07-10T18:58:12.843Z
Hi Brad, just an update, this seems to be happening with .xlsx (MS Excel) files. Could it be some security scanning issue, I'm think xss filtering on EE had simular issues.
Pim Verbij
CC BY-SA 3.0
2017-07-11T01:25:49.130Z
Hrm... seems unlikely?  Craft does some cleansing of image files and SVG files, but pretty much leaves all of the other ones alone.  Super weird, though.
Brad Bell
CC BY-SA 3.0
2017-07-11T10:33:40.480Z
Ok, I think I have found the issue. We were using a Craft plugin called SearchPlus to index the entries on Angolia, not indexing this type of entry anymore solved the issue. I will look further into why this was happening and report back any findings. Thanks for the help Brad.
Pim Verbij
CC BY-SA 3.0
2017-07-12T00:10:59.557Z
Ahh... nice find.  Be sure and add an answer once you get to the bottom of it... might save someone a headache in the future.
Brad Bell
<entries><matrix>
Attaching a file to a Matrix field and then saving the entry takes up to 2 minutes
# Attaching a file to a Matrix field and then saving the entry takes up to 2 minutes

(Asked by: username_0 on 2017-07-05)

I have an issue with attaching a file to a Matrix field and then saving the entry takes up to 2 minutes. If I open up another tab with the Craft CMS admin interface I can see that Craft is performing the task: "Delete Stale Template Caches"

This does not happen in DevMode.

I have read: <https://craftcms.com/support/stuck-tasks> but none of our templates are using the {% cache %} tag. Also there is nothing logged in: craft/storage/runtime/logs/phperrors.log I also tried clearing the caches to no avail.

I have also found:
[Saving some entries and a matrix field settings takes a very long time](https://craftcms.stackexchange.com/questions/15850/saving-some-entries-and-a-matrix-field-settings-takes-a-very-long-time)
but this does not provide any real answers.

The server is running PHP 7.0.20 and running Nginx as a reverse proxy in front of Apache via ServerPilot.

**Tags:** entries, matrix

> **Comments:**
> **username_1**: Does it happen when you save the same Matrix field without attaching a file?  How big is the file and what type of file is it?  
> **username_0**: This does not happen when adding a matrix field without a file attached. Further testing suggest that it only happens with PDF files. This was a 27Kb .pdf file. With a larger .png it does not happen. Both files were already uploaded to assets, so they where just attached to the entry.  
> **username_1**: Hrm... all PDF files or just that one? Any chance you've got something like mod_security or Suhosin installed on that box?  
> **username_0**: This happens with any PDF files. Mod_Security or Sushosin are not installed.  
> **username_1**: Are you using http://php.net/manual/en/book.image.php or http://php.net/manual/en/book.imagick.php on your server?  If it's the former, can you try installing the later? Craft will automatically use it by default if it is installed.  
> **username_0**: Hi Brad, thanks for looking at this. Unfortunately, still no luck, I installed and verified ImageMagick as per: https://serverpilot.io/community/articles/how-to-install-the-php-imagemagick-extension.html but the issue still happens.  
> **username_0**: Hi Brad, just an update, this seems to be happening with .xlsx (MS Excel) files. Could it be some security scanning issue, I'm think xss filtering on EE had simular issues.  
> **username_1**: Hrm... seems unlikely?  Craft does some cleansing of image files and SVG files, but pretty much leaves all of the other ones alone.  Super weird, though.  
> **username_0**: Ok, I think I have found the issue. We were using a Craft plugin called SearchPlus to index the entries on Angolia, not indexing this type of entry anymore solved the issue. I will look further into why this was happening and report back any findings. Thanks for the help Brad.  
> **username_1**: Ahh... nice find.  Be sure and add an answer once you get to the bottom of it... might save someone a headache in the future.  

---

## 0 answers

