Simple Machines Community Forum

SMF Support => SMF 2.1.x Support => Topic started by: rty42 on May 16, 2025, 09:55:19 AM

Title: repairboards function timeouts
Post by: rty42 on May 16, 2025, 09:55:19 AM
I have an SMF 2.1.4 forum (https://hobbicncforum.hu/) with 375k posts (wast majority is migrated from a custom-engine forum).
Since some topics do not properly show the last post data on the topic list I'm trying to call the "repair all errors" tool which worked earlier (before all the topics were migrated so there were significantly less posts/topics) and this resolved any lingering issues like this.
Since all the content has been migrated now the tool just timeouts after 5 minutes. It doesn't get to an intermediate step where it would be interrupted, the initial load attempt timeouts.

Is there any setting to tweak (even in the source) to make this more granular perhaps?  ::)
Title: Re: repairboards function timeouts
Post by: shawnb61 on May 16, 2025, 11:51:27 AM
The short answer is no, there is no existing utility to do F&RE in smaller pieces.

I've run across this before as well.  F&RE temporarily stores outstanding work to do in your session.  If it finds a LOT of issues, this can exceed the size of the 'data' field in the sessions table, which breaks things... 

So...  Things that might help:
- Temporarily cutting over to file based sessions & running F&RE; cut back to database sessions when done, as this sounds like a one-time event
- Increasing the size of the data field in the sessions table (at least temporarily)

We've also seen some instances where the host has a ridiculously low values for wait_timeout.  It may help to see if that is reasonable.

Related topics:
https://www.simplemachines.org/community/index.php?topic=589490.0
https://www.simplemachines.org/community/index.php?msg=4158487
Title: Re: repairboards function timeouts
Post by: rty42 on May 16, 2025, 01:59:16 PM
I changed data from text to mediumtext but it did not help :(

I see the code tries to increase the apache timeout to 10 minutes, I ask my server's host whether thay can somehow allow it...
Or worst case I'll do cleanup manually (it's doable I think).

Thank you for the info!
Title: Re: repairboards function timeouts
Post by: shawnb61 on May 16, 2025, 02:00:34 PM
Using file-based sessions temporarily usually works for me.  There's no column width restriction...
Title: Re: repairboards function timeouts
Post by: rty42 on May 16, 2025, 06:18:30 PM
Is this achieved by unchecking "Use database driven sessions"?
If so, it didn't help...
Title: Re: repairboards function timeouts
Post by: shawnb61 on May 16, 2025, 06:40:33 PM
Yeah, sorry.  Not sure what to tell you next...   

An http 5xx is usually accompanied with an error in one of the server logs (apache, mysql, or php).

Hunting down the underlying message in the logs might point you in the right direction, eg, timeout or other resource constraint.
Title: Re: repairboards function timeouts
Post by: rty42 on May 17, 2025, 04:37:06 AM
It seems to indicate a timeout, these are the error logs from the 5 minutes while the page has run:

[Sat May 17 10:24:59.681006 2025] [authz_core:error] [pid 2293924:tid 2294024] [client 45.146.130.98:57346] AH01630: client denied by server configuration: /home/jepfzdhb/domains/hobbicncforum.hu/private_html/.env
[Sat May 17 10:24:59.843533 2025] [authz_core:error] [pid 2293924:tid 2294047] [client 45.146.130.98:57624] AH01630: client denied by server configuration: /home/jepfzdhb/domains/hobbicncforum.hu/private_html/.env
[Sat May 17 10:25:07.121705 2025] [security2:error] [pid 2293924:tid 2293947] [remote 20.171.207.231:37984] ModSecurity: Access denied with code 406 (phase 2). Operator EQ matched 0 at REQUEST_HEADERS. [file "/etc/modsecurity.d/REQUEST-943-APPLICATION-ATTACK-SESSION-FIXATION.conf"] [line "100"] [id "943120"] [msg "Possible Session Fixation Attack: SessionID Parameter Name with No Referer"] [data "Matched Data: phpsessid found within ARGS_NAMES:PHPSESSID: 0"] [severity "CRITICAL"] [ver "OWASP_CRS/4.13.0"] [tag "application-multi"] [tag "language-multi"] [tag "platform-multi"] [tag "attack-fixation"] [tag "paranoia-level/1"] [tag "OWASP_CRS"] [tag "OWASP_CRS/ATTACK-SESSION-FIXATION"] [tag "capec/1000/225/21/593/61"] [hostname "hobbicncforum.hu"] [uri "/index.php"] [unique_id "aChH48HIZFd7GFDYqsKotwAAcgU"]
[Sat May 17 10:25:45.800581 2025] [lsapi:warn] [pid 2293924:tid 2294061] [client 3.216.106.253:46804] [host hobbicncforum.hu] Backend log: XML error: Not well-formed (invalid token) at line 1, column 1\n
[Sat May 17 10:29:25.057026 2025] [lsapi:error] [pid 2293924:tid 2293963] [remote 31.46.181.239:60606] [host hobbicncforum.hu] Error on sending request(POST /index.php?action=admin;area=repairboards HTTP/2.0); uri(/index.php?action=admin;area=repairboards) content-length(259): ReceiveAckHdr: timeout 300 is exceeded, referer: https://hobbicncforum.hu/index.php?action=admin;area=repairboards
Title: Re: repairboards function timeouts
Post by: shawnb61 on May 17, 2025, 11:12:26 AM
I'd show that to the host...

It looks like a modsec rule is being triggered.  Tell them you need that modsec rule (or all of modsec) disabled.

So the server kills the process, and the client times out waiting for it.
Title: Re: repairboards function timeouts
Post by: rty42 on May 17, 2025, 02:15:30 PM
The host says the 5 minutes timeout is a server level global security setting (any php thread is killed after 5 minutes) that will not be modified for my sake :(
Also says the modsec log is nothing to worry about, those indicate deflected hacking attempts (and there are a LOT of these in the logs, not just when I try to run the F&RE).

I'm afraid I will have to recalculate those cached "last post" properties displayed on the topic list with a small php page (but maybe it can be done in plain SQL...).
Can you direct me where in the database are these stored? Finding the last post per topic shouldn't be a problem, I just don't know where to put these data :)