XF 2.2 File Attachment Problem in Posts

Matthew H

Active member
This has been randomly plaguing my site for several months now, and happens infrequently enough that I've yet to find a reliable way to track it. It's not even showing up in XF's server error logs when it happens. Has anyone seen anything like this?

file-attachment-error.webp
 
This message is shown when XenForo receives error code 7 from PHP upload processing

UPLOAD_ERR_CANT_WRITE
Value: 7; Failed to write file to disk.

One typical cause for such an error would be upload-tmp-dir running out of disk space.

If this was / is the problem: Get a better host!
This should not happen and if it does happen the host should at least know the cause ...
 
Welp, I've updated the ticket I started with my host last month. Meanwhile, no one can upload anything and we're a digital art forum. I've tried six times in the last 20 minutes and it's returned the same error.
 
The problem resolved itself at around 7:30pm last night, but I've no idea how. Meanwhile, Dreamhost told me the server's tmp folder was empty, and confirmed XF's internet temp folder is also empty (I could've told them that :: roll eyes :: ).

They've asked me for time stamps from previous instances when the error happened. Since it happens so infrequently and randomly, all I could send them was the post date from the thread I started last month alerting my users to the problem. Meanwhile, I've taken the day off work to either solve the problem, or set up shop with a new host.
 
While it is possible to use the same directory for XenForo temp folder and for upload_tmp_dir this is not normally the case.

What is the value of upload_tmp_dir?
Do you have Shell/SSH access?

If so, what is the output of df -h <path> (with <path> being the path configured for upload_tmp_dir)?
 
Just finished a live chat session with my host after the file attachment error returned this morning.

All they were able to learn is that the forum is storing temp files somewhere other than its default file path or their server, and they're unable to figure out where. Meanwhile, the only solution they could suggest is to find a developer who can point the board to a custom temp folder and set up a cron job will periodically clean it out.

I told them I know nothing about server maintenance and suggested finding a new host instead, so they're going to conduct a more extensive review and follow up with me via email. Until then, we're SOL until the server resets again and clears the current cache, and I have no idea when or how often that happens.
 
All they were able to learn is that the forum is storing temp files somewhere other than its default file path or their server, and they're unable to figure out where.
Jesus, you really need to get a host who knows their stuff ...

It isn't rocket science to find out where disk space is allocated :eek:

XenForo (with default confiuguration and without Add-ons) doesn't store temp files anywhere except
  • internal_data/temp via XenForo code
  • The directory returned by sys_get_tmpdir() via vendor code
    This is usually /tmp but could be anywhere as configured by sys_temp_dir
Additionally to that, PHP itself stores temporarily stores uploaded file in the directory configued by upload_temp_dir

The webserver (Apache, nginx, LiteSpeed, etc.) might also store temporary data on disk, if and where it does that depends on the webserver configuration.
 
My file attachment error resurfaced tonight. I also discovered I'm using an outdated version of PHP: 8.1.27. Could that be why my board isn't using XF's default temp folder?
 
Welp, it's looking more and more like a complete wipe may be necessary. Hopefully, whatever's causing the problem won't get caught in a site backup and then restored along with it.
 
I learned how to access the server via SSH a few minutes ago. It's already showing 100% of 4G space used since Dreamhost last cleared the directory last night. I've notified them and will have to wait for them to clear it again.

In light of my discovery, I think it may be time for me to seriously consider other options, like dedicated hosting or moving to a new host.

Thank you all for your time and effort in helping me find solutions. There will be no further updates to this thread.
 
Last edited:
Back
Top Bottom