How to Fix 502 HTML status error in WordPress website

Recently, one of my client’s websites encountered a 502 HTML status error. This occurred when I first log in at the WordPress backend then the most critical happened after trying to submit a form to the contact us page. This is what it looks like after submitting the form.

502 html status

This is really weird since it was my first time learning about this 502 HTML status error.  For a while, I tried to ignore this when I first encountered this error when I also tried to login at the backend of the site. I thought that there must be some kind of server issue but what I never anticipated was a real problem that all the forms that are related to WP Mail SMTP are now affected and could not send any form to the intended recipient. I tried to troubleshoot and google this issue and found some forum that mentioned that there must be a plugin conflict with the recent version of WordPress which I remembered that I updated the WP core version to 5.5.1. So I started to disabled all possible plugins that I believe might affected this issue but with no avail. So I decided to contact WPEngine to ask for their support and the thread to my conversation with the WPEngine support team does really help. To protect the real identity of my client’s personal business I simply replace some names in this thread. Chat Transcript with TechSolutionForWeb

Chat started on 21 Oct 2020, 05:31 AM (GMT+0)
(05:31:20) *** Me joined the chat ***
(05:31:20) Me: BOT: picture message BOT: What can I help you with today? Click on a topic, ask me a question, or say “support” at any time to talk to a Support tech. USER: support BOT: What is your Support PIN? It can be found in the lower left hand corner of your screen. USER: A10785
(05:31:28) *** WPENGINE-Agent-1 joined the chat ***
(05:31:32) Me: BOT: Connecting you now… USER: presence message
(05:31:33) WPENGINE-Agent-1: Hello TechSolutionForWeb! Thank you for contacting WP Engine Support.
(05:31:36) WPENGINE-Agent-1: How can I help?
(05:32:34) Me: Hello Brendan, I need help to fix the 502 status issue in our website.
(05:33:15) Me: Actually I have contacted one of the agent yesterday and we already updated the DNS from godaddy but the problem still there.
(05:33:39) WPENGINE-Agent-1: I’m checking it
(05:34:17) Me: Also could you please give me a permission to update the wp-config so I can update the debug option. It was being swap by one of the agent in wpengine yesterday.
(05:35:01) WPENGINE-Agent-1: I believe I can help with that. One moment.
(05:35:13) Me: thanks 🙂
(05:37:41) WPENGINE-Agent-1: I fixed the permissions on that wp-config.php file. Were you able to update it now?
(05:38:29) Me: Ok thanks. I’m hoping if you could check on the server side if there’s any issue on our account for myclientswebsite.com.au website.
(05:38:59) Me: I just can’t send any email through our contact us form.
(05:39:02) WPENGINE-Agent-1: Also, that 502 error was happening when you tried to send a test email from the https://www.myclientswebsite/wp-admin/options-general.php?page=swpsmtp_settings#testemail page right?
(05:40:35) Me: yes exactly, do you have any idea what really happened? Because three months ago everything was working right after I updated the DNS pointing all records to wpengine and everything was working.
(05:40:52) WPENGINE-Agent-1: I was looking into the cause of that right now
(05:42:26) Me: Thanks again. I will continue checking every plugins as well. I updated every plugins but I will try to disable one plugin at a time hoping I could also fix by knowing which plugin has the issue.
(05:48:01) WPENGINE-Agent-1: The 502 error itself was due to the page taking longer than 60 seconds to load, and then getting timed out by the server, but I was still looking into why it was taking that long to load.
(05:48:48) Me: Ok thanks for letting me know. Hope you could trace the issue to fix this error on our website.
(05:56:30) WPENGINE-Agent-1: It appears to be waiting on a MySQL query while it’s just spinning like that, though when I checked the MySQL query itself, it wasn’t actually doing anything, it was just keeping the connection open. Would it be alright if I copied the site to myclientswebsite.staging.wpengine.com for further testing?
(05:57:10) Me: sure
(05:59:16) Me: the 502 status will appear during the first login attempt but the next time I logged out and then try to login it won’t display the 502 status. This is really confusing.
(06:00:10) WPENGINE-Agent-1: Thanks, it’s copying over right now
(06:01:28) Me: I remember installing a w3 total cache then wpengine take it down so I’m not sure if that is related on the issue… I just learned that some plugins are not allowed in wpengine.
(06:07:09) WPENGINE-Agent-1: It could be due to something else loading on the page, like a plugin conflict. I’m still looking into that. Thanks for all your patience by the way.
(06:09:13) Me: Yes, I’m currently deactivated some plugins and see which one is making the 502 issue.
(06:13:42) WPENGINE-Agent-1: Even with all the plugins except easy-wp-smtp disabled, it was still giving the error. I’m still looking into what else it could be though.
(06:16:36) Me: Yes, it’s kindda weird. This is actually my first time encountering this kind of issue.
(06:22:40) WPENGINE-Agent-1: I might need to get this chat escalated to a senior rep to look into this issue further.
(06:23:43) Me: Ok thanks
(06:23:53) *** WPENGINE-Agent-1 has transferred chat to Shared Escalation ***
(06:23:57) *** WPENGINE-Agent-2 joined the chat ***
(06:24:17) WPENGINE-Agent-2: Hi TechSolutionForWeb! I hope you’re keeping well, just a moment while I catch up on this. Be right back.
(06:24:35) Me: Thanks Jessica
(06:25:24) *** WPENGINE-Agent-1 left the chat ***
(06:28:01) WPENGINE-Agent-2: Alrighty, I’m up to date on the issue. These 502s errors are due to our long process script that kills anything taking longer an 60 seconds for server performance. Often the result of a plugins or theme. Could I try toggling PHP versions to test that out first?
(06:29:11) Me: yes please
(06:29:51) WPENGINE-Agent-2: Awesome! I’m just waiting to replicate the problem here and then I’ll try that out. If that doesn’t prove successful then I’d like to turn on performance monitoring tool and disable our kill script temporally to to help identify the root cause.
(06:31:30) Me: Ok thank you and just do everything you can so this issue will be resolved. 🙂
(06:34:11) WPENGINE-Agent-2: Great, PHP version didn’t make difference to trying the other thing now. It does take some time to set up and then trace a request. So I’ll need about 5-10 minutes. Thanks, I’ll be sure to keep you posted.
(06:34:49) Me: Thanks Jessica
(06:44:07) WPENGINE-Agent-2: Thanks for your patience, everything in place but the SMTP POST request is at 370 seconds and counting. Hopefully that actually completes so we can get a trace. Although I briefly remember a similar issue a while back and I think the problem was that the SMTP server wasn’t responding, causing a continuous time load. I’ll give this a couple more minutes to see. Thanks for waiting 🙂
(06:47:32) Me: ok
(06:48:59) WPENGINE-Agent-2: While waiting I’ve reading into this and found the following: A bug has been discover which is linked to WordPress version 5.5 and WP MMAIL SMTP plugin. This plugin is having some issue with that version of WordPress. Can I downgrade core on the staging site to test?
(06:51:09) Me: BOT: Connecting you now… USER: presence message
(06:52:00) WPENGINE-Agent-2: Well that fixed it 🙂 I downgraded staging to 5.4.2
(06:52:05) WPENGINE-Agent-2: Agent uploaded: Screenshot-2020-10-21-at-07.51.47.png URL: https://v2uploads.zopim.io/M/E/o/MEoe9WgzX2LAEe26TCMgiupyC3npVYuU/1c4ad34469206d39afdf15978c8a730efdf6bf6c.png Type: image/png Size: 80596
(06:52:32) Me: sure please
(06:52:59) WPENGINE-Agent-2: Just to confirm, you’d like me to downgrade the live site to the last secure and stable version of wordpress?
(06:53:03) Me: Let me know if that solved the issue.
(06:53:38) WPENGINE-Agent-2: I think our chat system might be skipping messages. I’m happy to confirm that downgrading staging did work and I’d like to downgrade live too 🙂
(06:53:43) WPENGINE-Agent-2: Agent uploaded: Screenshot-2020-10-21-at-07.51.47.png URL: https://v2uploads.zopim.io/M/E/o/MEoe9WgzX2LAEe26TCMgiupyC3npVYuU/b7690e1da29655ab85e21a9ea059d7e970a45fed.png Type: image/png Size: 80596
(06:53:58) Me: Yes, but how do I upgrate it for the later update? And if there is still an issue for the later update how do I downgrade it?
(06:55:10) WPENGINE-Agent-2: I use WPCLI to upgrade and downgrade core versions: wp core update –version=5.4.2 –force You can access this via SSH: https://wpengine.com/support/ssh-gateway/ Or you can come into support and we’ll be happy to do it.
(06:56:12) Me: ok noted on that.
(06:57:01) WPENGINE-Agent-2: Awesome! I have just downgraded live if you want to test it out 🙂
(06:57:48) Me: I don’t understand why WordPress give us the latest version with bug on their new update.
(06:58:14) Me: I will be testing thanks Jessica
(06:59:09) WPENGINE-Agent-2: Yeah it’s difficult to say why the plugin is conflicting with the newest version of wordpress, I did find this discussion you might be interested in: https://wordpress.org/support/topic/plugin-cant-connect-to-smtp-after-install-wp-5-5/ You’re very welcome TechSolutionForWeb
(07:00:29) Me: Yey! Thanks Jessica. Is WPCLI a plugin where I can use to downgrade a wordpress version?
(07:02:42) WPENGINE-Agent-2: There are some for sure plugins like this one: https://wordpress.org/plugins/wp-downgrade/ Although we can’t officially recommend any specific one. But there seems to a few going around. Feel free to take a look and find one best suited for your sites.
(07:04:20) Me: Thanks for the advise. You just save my day 🙂
(07:04:28) WPENGINE-Agent-2: Anytime TechSolutionForWeb, always happy to help! 😀
(07:05:07) Me: Could you please send me the thread for this conversation
(07:05:42) WPENGINE-Agent-2: Sure thing, I’ll send it to admin@techsolutionforweb.com
(07:05:53) Me: Cool!
(07:06:39) WPENGINE-Agent-2: If you require any further assistance please do not hesitate to reach out to us again. It was nice talking to you. Have a great day!
(07:09:32) *** WPENGINE-Agent-2 left the chat ***
(07:09:33) *** Me left the chat ***

After downgrading the WP core version to 5.4.2 everything works perfectly again.

SMTP test email

Here’s the reference for the WordPress lists of the latest release of WordPress core version https://wordpress.org/download/releases/ and here’s the plugin I use to downgrade or upgrade the WP core version called WP Downgrade | Specific Core Version by Reisetiger.

Conclusion

I really don’t understand why WordPress gives us the recent version with conflict to the WP Mail SMTP. One thing I’ve learned that even the most powerful CMS like WordPress still have their own issue with other plugins especially the most essential that are being used by many WordPress developers nowadays. Hope this blog will also help other developers on how to fix the 502 HTML error especially if you host your file to WPengine.

1 reply

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *