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

webbouk

Well-known member
Affected version
2.2
Every now and again we have an issue where a member might post a few photos and instead of the photo displaying they see a link in their post as such:

View attachment 96824 (I've killed the link)

The actual link would be: https://www,maggotdrowning,com/forums/attachments/96824/ (commas added to kill the link)
which returns the following error message:

Oops! We ran into some problems.​

You do not have permission to view this page or perform this action.



When I look in the ACP I can see the image within ACP>Content>Attachments but it has 'Unassociated' alongside it:

1612388810765.webp


Please can anyone shed any light on why this happens and what to do to prevent it?

Like I posted, it's not happening all the time, nor happening all the time for one particular poster, it seems to be occasionally with no particular pattern

Thanks
 
I got some errors which I thought was this add on, see post here;


But maybe not. And I just noticed I got similar unassociated attachments with it
 
I don't have that add-on installed.

Tbh I don't recall an issue before upgrading to XF 2.2.3 but that might be just me
 
Typically unassociated attachments are due to members bailing out of a post or some other content.

They are deleted via a routine cron (after 24 hours).
 
These don't seem to be though, as in the example above where the member bought it to my attention after trying to post the photo twice.
 
We would need steps to consistently reproduce the issue to determine what may be causing it.

I've never seen it myself in years of using different XF forums.
 
I don't have that add-on installed.

But if you look at the other posts in that thread by @Xon and @Brogan you will see that it (probably) isn't due to the addon. It only seems to be that one user having problems so I suspect some browser issue maybe. Same user had another attachment issue here, which he found got fixed when emptying safari cache. There is also currently an issue with safari and video embeds, I wonder if that is connected.

I think it may the same issue as you are having. This is what I see under attachments

Screenshot 2021-02-04 at 10.37.23.webp


and it is to do with this error:


Code:
Server error log

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

    Generated by: DavidUK Feb 3, 2021 at 11:59 AM

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(SV\AttachmentImprovements\XF\Attachment\Post), Object(SV\AttachmentImprovements\XF\Entity\AttachmentData), '[{"id":"458869-...', Object(XF\FileWrapper))
#4 src/XF/Attachment/Manipulator.php(170): XF\Service\Attachment\Preparer->insertAttachment(Object(SV\AttachmentImprovements\XF\Attachment\Post), Object(XF\FileWrapper), Object(SV\ConversationEssentials\XF\Entity\User), '[{"id":"458869-...')
#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(SV\AttachmentImprovements\XF\Pub\Controller\Attachment), NULL)
#8 src/XF/Mvc/Dispatcher.php(113): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(SV\AttachmentImprovements\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}

Request state

array(4) {
  ["url"] => string(131) "/attachments/upload?type=post&context[thread_id]=31023&hash=%5B%7B%22id%22%3A%22458869-0%22%7D%2C%7B%22id%22%3A%22458889-0%22%7D%5D"
  ["referrer"] => string(62) "https://cafesaxophone.com/threads/todays-buy-what-is-it.31023/"
  ["_GET"] => array(3) {
    ["type"] => string(4) "post"
    ["context"] => array(1) {
      ["thread_id"] => string(5) "31023"
    }
    ["hash"] => string(37) "[{"id":"458869-0"},{"id":"458889-0"}]"
  }
  ["_POST"] => array(3) {
    ["_xfToken"] => string(8) "********"
    ["_xfResponseType"] => string(4) "json"
    ["_xfWithData"] => string(1) "1"
  }
}
 
On a site which I have admin access on, a handful of members are also reporting this issue, and the attachments that yield the permission error do show up as being "Unassociated", however it's been reported that the permission errors didn't only occur when attachments were uploaded with Safari, but that they had also occured when other browsers were used. One member encountered the issue when using the DuckDuckGo browser on Android. We have had @Xon's Attachment Improvements add-on installed for quite a while, but the issue seemed to only appear after we upgraded to XF 2.2, which we did very recently. The occurrence of the issue does appear to be sporadic, but I'm also pretty sure that it would have been reported earlier if it were also present when using XF 2.1.
 
Last edited:
I noticed what appears to be the same error as the one posted above, yet it looks like it was only generated by one user uploading attachments which failed to associate, while the error was not logged when others ran into the same issue. It also now looks like the issue may have occured before the upgrade to XF 2.2, as there is a post which was made several days before the upgrade which contains attachment links that yield a page not found error. There have also been attachments uploaded after the upgrade which yield that error, but I'm not sure if that was the error that was present when the posts were made, or if it started out as the aforementioned permission error, and then changed to the page not found error after the unassociated attachments were automatically deleted.
 
Ugh, what's really troubling is that it can't be consistently reproduced. It appears to have spontaneously resolved, at least for now, and I know that it wasn't exclusive to Safari.
 
We have had @Xon's Attachment Improvements add-on installed for quite a while,
And in that thread xon suggested it was an addon (not his) responsible. He asked about any of Andy's that involved attachments. At the time as you can see I did have Andy/ConvertImageMediaGallery however it was not active.

Here is a list of the addons I had installed at the time and their active/inactive status:

Add-onActive
xenMade/STFRTYes
SV/ConversationEssentialsYes
SV/ConversationImprovementsYes
SV/HidePollResultsYes
SV/LiveContentYes
SV/StandardLibYes
SV/UserMentionsImprovementsYes
SV/WarningImprovementsYes
Siropu/AdsManagerYes
Siropu/Custom404PageYes
Snog/MoviesYes
Snog/TVYes
ThemeHouse/HolidaysYes
Truonglv/IgnoreContentYes
XDinc/FTSliderYes
XFYes
XFESYes
SV/AttachmentImprovementsYes
OzzModz/ReactionLikeYes
AddonFlare/PaidRegistrationsYes
Andy/ChangeDateYes
XF301VBYes
Andy/CountdownYes
Andy/MemberSearchYes
Andy/RSSFeedYes
Andy/RegisterEmailYes
Andy/ShowDeletedYes
Andy/SimilarThreadsYes
Andy/SoldYes
BassMan/TopNavigationYes
LiteSpeedCacheYes
MaZ/AMPYes
XenSoluce/DisallowLinksNo
XFRMNo
XFMGNo
Andy/ConvertImageMediaGalleryNo
AddonsLab/LinkCheckerNo
Andy/AdvancedSearchNo
BassMan/LightAndDarkModeSwitchNo
Siropu/ShoutboxNo
AL/CoreNo
 
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.
 
We've had similar, the same user, same device, same attachment, one minute unassociated the next uploading fine
Yup!

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!
 
I've also received a bunch of these errors yesterday for the first time. The only change that I've made to my site was updated to 2.2.3 patch 1 from 2.2.2 the night before.

2021-02-11_8-03-44.webp
 
Last edited:
Top Bottom