Fixed Legit attachments sometimes marked as "unassociated" and disappear after 24 hours

One user says he has the problem when he starts a quote and then insert a picture using drag and drop.
I could not reproduce, but maybe that will lead to the right track.
 
One user says he has the problem when he starts a quote and then insert a picture using drag and drop.
I could not reproduce, but maybe that will lead to the right track.
Different to what was previously described, it has nothing to do with drag and drop.

This user did a little bit of debugging in a test thread, try to reproduce that bug.
Win 10 (current version)
Google Chrome (current version)

I couldn't see any schema.

1613726720996.png
 
Different to what was previously described, it has nothing to do with drag and drop.

This user did a little bit of debugging in a test thread, try to reproduce that bug.
Win 10 (current version)
Google Chrome (current version)

I couldn't see any schema.

View attachment 246728

The user inserted the attachments into the post as normal, but they are not assigned to the post

1613727325287.webp
1613727461053.webp
 
Different to what was previously described, it has nothing to do with drag and drop.

This user did a little bit of debugging in a test thread, try to reproduce that bug.
Win 10 (current version)
Google Chrome (current version)

I couldn't see any schema.

View attachment 246728
we have the problem with the same user on another forum where no add-ons are installed
 
There have been a lot of attachment issues lately. Maybe it could all be related.

In our case, members are able to post attachments fine for most of the time unless they trigger a server error:
LogicException: Temp hash must be specified if no content is specified. src/XF/Entity/Attachment.php:270
This specific error has been circling the official xenForo forum and there's an XF ticket with more details about it.

To the issue at hand..

Sometimes legit attachments are disappearing after 24 hours. The members make the post fine and it all goes through, but they're marked as "unassociated" and are deleted by xenForo when it cleans up unassociated attachments. There's no dead image(s) when the post is published.

I've noticed:

If you copy/paste the image, you get the attachment URL and a hash.

The image attachments work fine in posts. There's no dead BB Code when the member publishes their post. If you copy/paste them to get the attachment URL, you'll get it and a hash. If you copy/paste the attachment from a post that isn't affected by this issue, there's no hash.

The members use the usual Attachment BB Code:
Code:
[ATTACH type="full"]2310543[/ATTACH]
Copying URL of a problematic attachment to clipboard:
Code:
https://www.domain.com/community/attachments/name.2310543/?hash=3adc794e66dd2b803d3715151d8d5fa1

Permission error when loading the attachment directly without a hash

If you remove the hash part of the URL and load the attachment URL directly of the problematic attachment that's marked as unassociated in the admin panel, that's when it'll say "You do not have permission to view this page or perform this action".

The image loads fine in the post itself until xenForo cleans it up after 24 hours.

If you try to directly load an attachment URL that's marked as unassociated (when it should have been a associated with the post) without the hash in a private browsing window, you'll be prompted to a login screen. If you're logged into an account and view the URL without the hash, you get the permission error.

Images are killed later

After 24 hours, the above changes to a dead attachment link. Clicking it will then say "The requested page could not be found." Our members lose their attachments when the system marks legit attachments that are posted as "unassociated".

This issue has even affected staff members and they've confirmed they didn't take a long time to write up their posts and leave the uploaded attachment to linger for the unpublished post.

This cannot be reproduced to my knowledge

As ProCom has stated, it's a nightmare trying to reproduce this. There's no one magic attachment that triggers this issue. xenForo is choosing to mark certain attachments as "unassociated" when it wants to and then delete it 24 hours later.

ProCom said:
It’s been a nightmare trying to track down the cause of this issue! The dozen of members helping us troubleshoot are experiencing the problem, then try again and the same attachment works, then try again and it is unassociated, etc. etc. etc.

I’ve never seen such a completely inconsistent issue/bug that has zero consistency between users, processes, images, browsers, settings, etc.
ProCom said:
We even got about 10 members that were all having the issue to come together online at the same time so we could disable ALL addons to see if that would do the trick... but then they all stopped having the issue, even using the same images, browsers, steps, network connection, etc. etc. etc.

... that is until a little later when they started having issues again!

UGH!
We lose attachments from around 2-3 posts per day because of this issue.

Troubleshooting thread - https://xenforo.com/community/threads/is-anyone-else-missing-attachments-in-posts.191197/
Brogan asked me to post a bug report to bring this to the developer's attention, so here it is.

Thanks!
 
Last edited:
I just had this issue with a conversation.

First drag and drop 3 images - just get the attachment links and no pictures. Click on link and:

Screenshot 2021-02-22 at 17.04.27.webp

Tried again as attachments - same issue

Then (3rd time lucky) tried using the image icon and browsing for the images, all fine


Screenshot 2021-02-22 at 17.07.24.png
 
This is happening to more and more of my members, about a 100 times today, been driving me mad trying to track it down. Hopefully someone clevereer than me will find out what is wrong soon.
 
I experienced this today for the first time on a site that wasn't one of my own.

Like I said before, I've never had a situation where a problem was so hard to reproduce / find some level of consistency for where, when, to-whom, etc. it is happening. We've tried to isolate processes, users, images, browsers, addons, etc., and nothing has turned up.

Same user, same image, same process, same everything... but one time the image uploads / displays fine, and another it shows the "attachment xyz#" and then links to the "oops" error page.
 
We were advised by Xenforo to open a bug report, have any of you done that yet?


It has been



And then somehow we wonder if it's related to the video upload issue:

 
now i can see some errors in log:


LogicException: Temp hash must be specified if no content is specified.
src/XF/Entity/Attachment.php:270

Stack trace​

#0 src/XF/Mvc/Entity/Entity.php(1355): XF\Entity\Attachment->_preSave()
#1 src/XF/Mvc/Entity/Entity.php(1208): XF\Mvc\Entity\Entity->preSave()
#2 src/XF/Service/Attachment/Preparer.php(267): XF\Mvc\Entity\Entity->save()
#3 src/XF/Service/Attachment/Preparer.php(29): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XFMG\XF\Attachment\Post), Object(XFMG\XF\Entity\AttachmentData), '[{"id":"1516294...', Object(XF\FileWrapper))
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\XF\Attachment\Post), Object(XF\FileWrapper), Object(XFMG\XF\Entity\User), '[{"id":"1516294...')
#5 src/XF/Pub/Controller/Attachment.php(89): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(XF\Http\Upload), NULL)
#6 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#9 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
 
Temp hash must be specified if no content is specified.
src/XF/Entity/Attachment.php:270


Stack trace​

#0 src/XF/Mvc/Entity/Entity.php(1355): XF\Entity\Attachment->_preSave()
#1 src/XF/Mvc/Entity/Entity.php(1208): XF\Mvc\Entity\Entity->preSave()
#2 src/XF/Service/Attachment/Preparer.php(267): XF\Mvc\Entity\Entity->save()
#3 src/XF/Service/Attachment/Preparer.php(29): XF\Service\Attachment\Preparer->insertTemporaryAttachment(Object(XFMG\XF\Attachment\Post), Object(XFMG\XF\Entity\AttachmentData), '[{"id":"1516294...', Object(XF\FileWrapper))
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(XFMG\XF\Attachment\Post), Object(XF\FileWrapper), Object(XFMG\XF\Entity\User), '[{"id":"1516294...')
#5 src/XF/Pub/Controller/Attachment.php(89): XF\Attachment\Manipulator->insertAttachmentFromUpload(Object(XF\Http\Upload), NULL)
#6 src/XF/Mvc/Dispatcher.php(350): XF\Pub\Controller\Attachment->actionUpload(Object(XF\Mvc\ParameterBag))
#7 src/XF/Mvc/Dispatcher.php(257): XF\Mvc\Dispatcher->dispatchClass('XF:Attachment', 'Upload', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Attachment), NULL)
#9 src/XF/Mvc/Dispatcher.php(55): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#10 src/XF/App.php(2326): XF\Mvc\Dispatcher->run()
#11 src/XF.php(488): XF\App->run()
#12 index.php(20): XF::runApp('XF\\Pub\\App')
#13 {main}
 
Top Bottom