XF 1.2 Massive Posts, 502 Error

Warchamp7

Active member
There are a couple very large posts on our forum, and attempting to edit one just kicks to a 502 error rather quickly.

What settings server-side would pertain to something like this?
 
Ideally it shouldn't happen. Can you view one of the posts in the plain editor and paste its contents into a text file and attach it here? I have made changes to sort this issue and we haven't had a report of it for months, IIRC.
 
Well, that may just be a general timeout but I will look into it. Please bear in mind that this post is almost 10 times the standard maximum post length -- there's a good reason for that value, especially with BB code heavy posts like this one.
 
I don't have any problems with this locally. It runs reasonably quickly.

It looks like this is likely down to exceeding the stack size with recursion. I have optimized the regular expression as much as I can, but I think on this post, it's still triggering around 9000 recursive calls in PCRE. Based on the PCRE discussion of this (http://regexkit.sourceforge.net/Documentation/pcre/pcrestack.html), that will use some where around 4.5MB of stack space.

Common values are over 8MB, so this should generally be ok, but it sounds like it's a problem on your system. Can you run this shell command:
Code:
ulimit -s
What does that output?

You can potentially use that command to increase the stack size which may sort it:
Code:
ulimit -s 16384
Would set it to 16MB. (Note I haven't tried this locally, so I'm not sure off hand if it will cause other problems though hopefully not as it can be modified per process as well.)

Alternatively, reducing the maximum message size even to something like 50,000 may well prevent it from erroring out.
 
The output is 8192. It should be noted it doesn't take a long time for these posts to results in a 502 error, it is within a couple seconds.

I'm guessing this is attributable to an add on based on the results here.
 
I realize this is an old post, but I'm having a similar problem in sending 4,000 plain text emails sent via sendmail to our members. The operation times out about a third to halfway through the process with an nginx 502 error.

Are there any PHP settings I might use to resolve this issue. The server is using PHP 7.0.4, with 16GB RAM. It seldom uses more than a third of that.
 
Your issue would be unrelated to this, aside from them both generating the same underlying error which likely indicates that PHP crashed/was killed. The troubleshooting would really be what was mentioned in your ticket. There should be an error logged within Nginx to confirm the crash. Short of recursion (which isn't used here), PHP code should never crash PHP, so if it's a crash, it may be indicative of another issue, though that's very difficult to debug.
 
I could not find any error log for nginx for that date, March 16. The last error occurred the previous month.

It's a Plesk 12.5.30 server running PHP-FPM over Apache, but there was no Apache error log for the date in question either.

So any other starting points as to what I should check? Does allocating more memory to PHP help (it's 256GB now)?

Note that a similar mailing in February went through without a hitch.
 
You mentioned Nginx explicitly in your ticket, but now you mention Apache, so I don't know what your server setup is. You've also mentioned PHP-FPM. There should be some indication in one of those logs why a 502 is being returned.

This is very unlikely to be memory related.
 
A Plesk server would have Apache running with nginx "as a frontend server."

I was not able to find anything error related in the Apache or nginx logs for March 16. I checked.

Default setting:

Smart static files processing If turned off, Apache will process all requests for static files. nginx will only pass requests and responses without modification. Turn off this option only for troubleshooting.
 
Back
Top Bottom