1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.2 Massive Posts, 502 Error

Discussion in 'XenForo Questions and Support' started by Warchamp7, Mar 1, 2014.

  1. Warchamp7

    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?
     
  2. Jeremy

    Jeremy XenForo Moderator Staff Member

    Are they BBCode heavy? Disable the rich text editor in your preferences.
     
    Warchamp7 likes this.
  3. Warchamp7

    Warchamp7 Active Member

    That 'solved' opening them. Is there anything I can set anywhere to 'fix' these posts to be openable with the Rich Text Editor?
     
  4. Jeremy

    Jeremy XenForo Moderator Staff Member

    Your server is most likely killing the process for taking to long to process the BBCode output.
     
  5. Warchamp7

    Warchamp7 Active Member

    And what value would I tweak for that?
     
  6. Mike

    Mike XenForo Developer Staff Member

    Just to confirm, what XF version are you running?
     
  7. Warchamp7

    Warchamp7 Active Member

    1.2.4 I believe
     
  8. Mike

    Mike XenForo Developer Staff Member

    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.
     
  9. Warchamp7

    Warchamp7 Active Member

    Here you are
     
  10. Mike

    Mike XenForo Developer Staff Member

    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.
     
  11. Warchamp7

    Warchamp7 Active Member

    Indeed it appears we have the max post length disabled. I'll have to ask the other admins about the reasoning for that.
     
  12. Mike

    Mike XenForo Developer Staff Member

    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.
     
  13. Warchamp7

    Warchamp7 Active Member

    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.
     
  14. Gene Steinberg

    Gene Steinberg Well-Known Member

    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.
     
  15. Mike

    Mike XenForo Developer Staff Member

    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.
     
  16. Gene Steinberg

    Gene Steinberg Well-Known Member

    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.
     
  17. Mike

    Mike XenForo Developer Staff Member

    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.
     
  18. Gene Steinberg

    Gene Steinberg Well-Known Member

    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.
     

Share This Page