News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Images in post take a long time to appear

Started by NFG, June 10, 2025, 07:59:54 AM

Previous topic - Next topic

NFG

I've recently noticed that images added inline to a post will show up as 404 for about five minutes after the post is made.  I assume there's a background process at work that's making the thumbnails and whatever, but I would like to know what's the trigger for this process, and is there a way I can trigger it manually?

Because if I don't share that new post's link as soon as the post is made, I'll forget that it exists by the time the images are ready. 

Thanks for any clues or advice. 

Sesquipedalian

No, attachment processing does not happen in a background task. SMF fully processes all attachments when the post is submitted. By the time you see the page reload after clicking the submit button, SMF is done with it.

The symptoms you are describing strongly suggest that something else on your server is interfering after SMF has finished processing the attachments. (After all, the very fact that SMF is trying to show the image attachment in your post demonstrates that SMF thinks it is supposed to be there.)

Our friendly support volunteers will likely be here soon to ask you questions to help you figure out what might be causing this. They've seen a lot of weird stuff over the years, so they're good at sniffing out oddities.
I promise you nothing.

Sesqu... Sesqui... what?
Sesquipedalian, the best word in the English language.

Aleksi "Lex" Kilpinen

One thing worth checking, is it really 5 minutes or would a simple hard refresh after posting help? I remember seeing forums where the image just would not come up immediately, but a second page load (by anyone) already works. Not sure if it's some sort of race condition or what, just something I've seen.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

NFG

#4
Quote from: Aleksi on June 10, 2025, 01:28:41 PMis it really 5 minutes or would a simple hard refresh after posting help?

The fact that I can send the link to a friend in Norway and he can't see the images either definitely suggests it's not something a hard refresh will fix.  It might not have been five minutes exactly but it was way more than one minute and probably pretty close to five by the time they all worked.

Quote from: Kindred on June 10, 2025, 05:58:04 PMServer cache or browser cache

There is no cache on the server, it's a standard nginx + PHP7.4 setup.  If there's any kind of caching going on I can't imagine where it came from or how it works, or how it only affects SMF. 

The error shown when an image is clicked is a very simple, text-only '404: Not Found' (or similar, I didn't write it down).  It's not a server 404 page, it's coming from SMF.  The URL being requested is:

https://---/index.php?action=dlattach;attach=4541;image

shawnb61

This is a longshot, but...

In a recent support request, the proxy was intercepting requests and displaying the single-line WSOD 'File not found', instead of passing the request on.

Turns out that single-line message is the proxy's standard 404 page.  (Not Apache's...)

If the proxy is confusing the request with a filename, that might explain it.

The other issue was resolved with:
ProxyErrorOverride On...in the apache config.

Other issue:  https://www.simplemachines.org/community/index.php?topic=591391.0
A question worth asking is born in experience & driven by necessity. - Fripp

NFG

Quote from: shawnb61 on June 10, 2025, 06:45:35 PMTurns out that single-line message is the proxy's standard 404 page.  (Not Apache's...)

Yeah but I'm running nginx.

To be clear, this is my server, it's my whole computer built from the ground up, there's nothing running on that Ubuntu Server box that I didn't put there.  If there's any kind of proxy between nginx and PHP and SMF then I have no idea what it is or how it got there, and I'd really really like to know how such a thing could happen.

But that said, maybe there's some sort of built-in proxy capability?  But I'd expect to see an 'nginx proxy' error, not this vague thing.

shawnb61

A question worth asking is born in experience & driven by necessity. - Fripp

NFG

Quote from: shawnb61 on June 10, 2025, 07:05:36 PMLooks like it defaults to on:
https://nginx.org/en/docs/http/ngx_http_proxy_module.html

Yeah, nginx includes a proxy service by default, but it's not ON unless you turn it on.  I use it for apps that require it, like webcams, music streamers, and the like.  It's not used for things like standard webpages, and I don't use it for any services on the domain in question.


NFG

At this point it does seem like you've answered my question: it's not SMF that's doing it.

I guess I'm just going to have to wait until it happens again and kick its ass somehow.

shawnb61

Yeah, as Sesq said above, the SMF transaction is synchronous.  Once the post is done, the attachments should be available.

If SMF tries to load an attachment that doesn't exist, you can see a similar one-line message.  I'd be tempted to modify SMF's text... If you see that modified text, you'd know for certain that's an SMF message, & not from another component.

If confirmed it's an SMF message, we'll, that'd be interesting...  What would make the db say "I got it" then later say "nope"???...  In that case, I'd look closely at the db...
A question worth asking is born in experience & driven by necessity. - Fripp

Advertisement: