502 Error on all Replies and on Admin Replies Page
Our forum has operated perfectly for 3 years. Suddenly, the past 2 days we get 502 server error with every reply. We also get 502 server error when trying to access the “Replies” page on Admin. We can access Topics page, Forums page, and all settings of the plugin. However, when anyone tries to submit a reply on a forum, 502 error. When we try to go to the “replies” page on admin, 502 error.
We have deactivated all plugins. Still 502 errors. We have not added any plugins or changed our software at all. This just suddenly started happening.
The forum is located at: https://bitbillions.com/community/
Maybe to help out a bit:
PHP7.0-fpm (latest stable)
Nginx 1.10 (latest stable)
Ubuntu 16.04 (latest stable)
bbPress Advanced Statistics 1.4.02
bbPress NewTopics 1.0.1
bbPress No CAPTCHA reCAPTCHA 1.0
BuddyPress Version 2.7.2
BuddyPress Activity Plus 1.6.4
Buddypress Messages Spam Blocker 2.5
BuddyPress Profile Tabs 1.6.1
If you have changed nothing, then I would suspect you host/server
If it were our host, it should happen to more than just one page out of hundreds of thousands of pages. We are only getting a 502 error on this page:
All other functions of BBPress work perfectly and all other pages of our site work perfectly. It is like something is breaking the php when that page is trying to load.
Update. Today we did the following:
1. Deactivated all BuddyPress and bbPress plugins. Uninstalled all BuddyPress and bbPress plugins. Removed all BuddyPress and bbPress data from the database, but kept a backup copy of the data and tables.
2. Installed fresh WordPress on fresh server. Installed new, fresh plugins.
3. Site worked.
4. Replaced data from backup.
5. Entire site works, EXCEPT there is a 503 error when people try to post a reply on a forum, and a 503 error when we try to go to the “replies” page from the wp-admin.
So, maybe something in the data? Could someone have posted a reply that has some content that is breaking the php code when trying to see the Admin panel “replies” page or when people try to post a reply?
We have learned another thing. When people post a reply, the reply DOES go into the db and it is visible to other members on the forum. HOWEVER, the person posting the reply gets a 503 error during the process and has to come back to the site fresh to see the forum, including their post.
Something is causing a 503 error ONLY when replying OR when we try to access the Admin “Replies” page as admin. It is very very strange.
We use newrelic remotely and also some server-side tools, but wireshark looks interesting. Will see what it could reveal. The problem with the tools we have is that the break comes before they can seem to tell us why. It is almost like there is something appearing on the page that is causing the php to break before rendering the page. But we have combed through the database and can’t seem to find something a user could have posted or uploaded that would be doing that.
RESOLVED: before we had time to try the wireshark tools we ran a script on the database looking for broken relationships. Found that a post that had been removed using correct tools somehow had broken a relationship and the replies page would not load. Here is what happened:
1. A member joined our forum and spammed the crud out of it.
2. Akismet caught the spam and blocked it all, marking all topics and posts as “spam”.
3. One of our keymasters marked the user as a “spammer” according to the moderation tools provided by bbPress.
4. One of our admin staff moved the spam topics and posts to the trash, using the tools on the WordPress admin.
5. The same admin staff emptied the trash using the tools on the WordPress admin.
After this, they did not notice the replies page was not working or that people could no longer post. Later when people reported they could no longer post, our admin went to the WordPress admin and got a 503 error on the “replies” page. We fought this 503 error issue for nearly 1 week. After finding one broken relationship between a topic and the replies in that topic, we fixed the relationships and the 503 error went away. Now, all the forum is working perfectly.
So, somehow, using all the tools provided by bbPress, a user was marked as a spammer, their spam was blocked, trashed and emptied. And then the entire forum was broken due to a broken relationship. Fixed now, but really strange it could happen in the first place.
UPDATE. NOT RESOLVED.
After repairing broken relationships the site was working as expected. Then, about 1 hour ago, a member reported that 503 errors are back on our bbPress forum. After looking at a narrower window of data, here is what we have found.
Replies are NOT being associated with their parent forum. They go into the database and even have their proper topic parent ID assigned in the post_parent column. The admin “replies” page, which becomes accessible after running “Recalculate the parent topic for each post” tool. Then, the forum for the post shows as “No Forum”.
Upon inspection of the form where users enter replies, we see this:
<input type=”hidden” name=”bbp_topic_id” id=”bbp_topic_id” value=”HIDDEN”/>
<input type=”hidden” name=”bbp_reply_to” id=”bbp_reply_to” value=”0″/>
<input type=”hidden” name=”action” id=”bbp_post_action” value=”bbp-new-reply”/>
NOTICE: we put “HIDDEN” into the value for bb_topic_id because it is not relevant here. It does show correctly. However, you will notice that the bb_reply_to is ALWAYS being set as value=”0″. There is some reason that bbPress is setting ALL replies to 0. We cannot seem to figure out why.
suggest you go back to basics and try :
Deactivate all but bbpress and see if this fixes. if it does, re-enable one at a time to see which is causing the error.
If plugins don’t pinpoint the problem, as a test switch to a default theme such as twentyfifteen, and see if this fixes.
I know this is an older thread, but wondering if a solution was found. We’re experiencing the 502 error only on replies started from the admin area, as well. I’ve removed all posts and replies and we still have the error.
have you been through the actions in my post immediately before yours?
Yes. But I’ve just confirmed that this is specific to certain users. And, for us, some of the users were imported. So, I think we must have something corrupted in some accounts. Poring through the db now.
Update… the only plugin I didn’t disable in the testing before is Buddypress (the core plugin). I just disabled everything except bbpress and buddypress. And changed back to the default theme. Still got the same error. Then I disabled buddypress itself. That stopped the error. But, I also only get the error for some users.
I’m going to replace all the core buddypress files to see if that resolves it.
ok, thanks – please do come back whatever, so that we can help others
Just to drop in here on the thread I originally started. We worked on this for several days. Probably put in way too many hours and way too much manpower. We never ever could resolve it. There are a few interesting things to note:
A. When we ran some of the “optimizing” and “updating” tools built into BBPress (like the tools to re-link posts with their authors, re-set user privileges, etc.), the site would function. Then as soon as someone made a post, everything broke again. So it was most definitely something in a relationship within the db that was breaking down. Running all the db cleaning tools in BBPress would fix the problem until a member made any post or replied to anything.
B. After looking deeply into the db, I found that new replies were somehow not being associated correctly across all tables with their author sometimes, but mostly the issue was they were not being correctly linked to their parent. What this did was to mess up WP’s (and BBPress’s) ability to render the pages in proper ordering. You know, who posted what, who replied, nested responses, etc. So, the page 500 errored out.
Now then, our company did not have the time or money for us to spend fixing this problem or rooting out what caused it. So, we had to make the financial decision to back up our data, set up clean db and WP app servers, and migrate to them. Then, destroy the problem db and app servers. On the clean install, moved data across and everything works absolutely perfectly.
This is good for us. But this is bad for people experiencing what we went through. Unfortunately, we never found what caused it, or how to solve it. Other than just manually “fixing” the db with BBPress tools every time someone made a post or reply. But that is just stupid.
Well, I think I found our main issue (though, another one was being experienced that I didn’t realize — a 502 that only shows up on the first attempt to enter a reply, but then disappears when you try again — and only for some people).
The issue for those of us seeing a 502 and unable to load the new reply page at all was an entry in the database’s wp_bp_notifications table (by user id) where the component_name was “forums” and the component_action was “bbp_new_reply.” I noticed these only appeared for the user ids/people who were experiencing the 502 errors. I deleted them from the table (after backing it up) and no more immediate 502 errors when trying to create a new reply through the wp-admin.
Now I just need to see if I can find the issue for the person getting the 502 after entering the reply (but who can then click update and it eventually goes through).
Will post back after. Oh, and replacing all the buddypress files (per my previous post) had no effect. The issue only resolved after deleting the offending records in the db.
Ok. Latest update. The only remaining 502 errors seem to happen after the initial reply is entered successfully (in the admin interface) and then we need to change something in it (in our case, it’s often the author id) — AND when there is a hyperlink in the text entry. We’re using the WYSIWYG/visual editor. And only on the first update (after the original submission goes in). I can change the author 10 times after it fails (on the first update only) and they all go fine. I can change the author on a text only entry and never get the 502.
So, it’s looking like our initial issue is resolved (502 preventing the new reply admin page from loading at all for some admin users — fixed by the removing the entry in wp_notifications), but now we have an issue where we can enter replies, but editing them the first time, if they contain a hyperlink, causes a timeout/502 error. And this one really times out (takes a while before we see the 502). The initial problem of not loading the admin reply page at all and seeing a 502 was an instantaneous error — no delays.
I spoke too soon. It’s not just edits with hyperlinks. Back to trying to figure out if there’s a pattern.
please keep posting, as I am following your great work in trying to get to a definitive problem.
- You must be logged in to reply to this topic.