HTTP Error 521 Problems

Joined
Jun 28, 2016
Messages
158
Likes
116
Degree
1
Keep getting butt smacked with their 521 server errors on Knownhost, keeps failing (3rd time this month) and its not like I'm generating massive traffic. Anyone else having issues? Paying $37 a MONTH! Think its time to choose Siteground or WPX hosting or Dreamhost. Thoughts on host alternatives?
 
Last edited:
I've had zero problems across my many servers with them. BuSo is hosted with them too.

One thing to keep in mind is you need to check probably once a month in WHM if you need to gracefully reboot the servers. If you don't do this, after 6 months or a year you can start to encounter problems as software modules aren't updated until you reboot.

Otherwise, hit up their support. They should be able to solve the problem very quickly.

Are you using Cloudflare? I though that was a Cloudflare error code.
 
I can see that you're using wp-cron on the site, which can contribute to higher resource usage on the server:

I would recommend converting these to system crons to help reduce stress on the webserver; we have a guide on how to do that here: https://www.knownhost.com/wiki/cms/wordpress/cron-convert

I can also see that the site is running on PHP 7.1 which is end of life and no longer supported: https://php.net/eol.php

I've started Apache again to bring things back online, but if these issues aren't addressed, you're likely to encounter these errors more in the future. If you're expecting higher traffic in the future or can't update your sites, you may want to consider moving to a server with more available memory.

Please review and let me know if you have any other questions or concerns. "

____

That's the response I got, I'm not super technical. Guessing my theme doesn't have updates anymore?

It is a cloudflare error code but its said cloudfare is fine. It said it was the host's end (when the server went down).
 
If you can't update your theme that's going to eventually be a problem. It may be compatible with with versions of PHP past 7.1. It may not. Same with plugins. That's not your host's fault. But technically 7.1 is already pretty fast and is not likely to be causing your problems.

If you're getting enough traffic, wp-cron can cause memory problems because it checks if it needs to run on every single page load. Of course that's too much. You can stop that from happening by adding this to your wp-config.php file:

Code:
/** Limit Chron Runs **/
define('WP_CRON_LOCK_TIMEOUT', 900 );

That's 900 seconds. You can change it to whatever you want but that's once per 15 minutes. That's a HUGE drop in resources compared to something like 30 checks per minute or second even.

It sounds like you might have a plugin that's abusing the Wordpress Heartbeat API. There's plugins like this that can help you disable the Heartbeat or reduce the demands it creates.

How much daily traffic are you getting? It sounds like you have a combo of theme and plugins that aren't performing well under an appreciable amount of traffic.
 
Was getting a few hundred but recently some of my traffic dropped (pinterest mainly) past month. I'm in my cpanel now in my mutitphp manager. I'm checking to see if theme is fine. I just updated my plugins the other day, they all updated. Each one of them.

says"
System PHP Version
EOL warning
Set the system default PHP version.
Any domain that is set to the inherit value indicates that it does not have its own PHP version explicitly set. Read more about inherit.
PHP 7.1 (ea-php71) Edit
Warning: Your system’s PHP version has reached EOL. We recommend that you update to a supported version of PHP. Learn more about supported versions.
To use PHP-FPM on accounts using PHP “7.1, ea-apache24-mod_proxy_fcgi, ” you must install PHP-FPM for those PHP versions. To do so, perform the following steps below:
  1. Click Install to open EasyApache 4 in a new window.
  2. Install the following packages:
    • ea-php71-php-fpm
    • ea-apache24-mod_proxy_fcgi
  3. After you install the desired packages, return to the previous window and click Refresh. The system will display your updated PHP-FPM packages
"
Talk to the guy tomorrow before i do anything. Has an install button and refresh. Should fix the issue then i'll limit cron, thanks dude!
 
Last edited:
You need to increase the RAM. Get a higher plan for that. You got some bullshit running that’s causing your RAM to run out.

i don’t know if there is a graph that shows memory but I have a feeling it is maxed out. If no graph look at SWAP usage. Should be at 0. If not 0 that means you are running out of RAM and the server is now using harddrive space to run memory. Harddrive is x2000+ slower than RAM.
 
I pay 37 a month and need more ram? wtfffff. It is the memory cmoney. I know people who pay less and get more traffic and their server is fine. maybe its the theme.


--
This is the same issue as a few days ago; the server is running out of memory:
May 7 20:32:18 vz12-wa kernel: [4664292.195527] Out of memory in UB 24389: OOM killed process 365966 (httpd) score 0 vm:495488kB, rss:47964kB, swap:0kB
May 7 20:32:18 vz12-wa kernel: [4664292.329384] Out of memory in UB 24389: OOM killed process 365967 (httpd) score 0 vm:495388kB, rss:48288kB, swap:0kB
May 7 20:32:18 vz12-wa kernel: [4664292.520901] Out of memory in UB 24389: OOM killed process 365891 (httpd) score 0 vm:565484kB, rss:46964kB, swap:0kB
May 7 20:32:19 vz12-wa kernel: [4664292.711073] Out of memory in UB 24389: OOM killed process 365968 (httpd) score 0 vm:565380kB, rss:46852kB, swap:0kB
May 7 20:32:19 vz12-wa kernel: [4664292.867394] Out of memory in UB 24389: OOM killed process 365892 (httpd) score 0 vm:493436kB, rss:45892kB, swap:0kB
I can see that you're using wp-cron on the site, which can contribute to higher resource usage on the server: "
--

Anyways, I limited the Cron time out thanks to @Ryuzaki code or I would have to created a cron job and all this technical command line jargon....Now they're upgrading it to 7.4. as well. Uh issues like this are annoying. Think I'll continue learning Javascript/php/server side tech stuff on my downtime, one hour each night, something like that.
 
Last edited:
You have to increase the php.ini file’s limit on the memory variable. It’s probably still set to 128MB.
 
The dude told me yesterday if i fixed both these issues, then it should be fine. Now the 2nd tech guy tells me

"I checked ticket 1111066 and it was mentioned there to upgrade VPS plan as well to improve server's performance. Let me know if you need further assistance. "

no malware on the site, clean etc..So either the theme just is killing the resources(change a new theme), or I need to find a plugin that's killing eating up my resources. dude said it's set to 32MB, not even close to 128. Am I reading this right? Is he saying if i increase memory, it'll limit it and create more "out of memory" errors? Nevermind he said its the other way around. Keeping the limit low will keep it from running out of memory he said.


Hi,It's set to 32MB
====
root@host [/home/beyond/public_html]# php -i|grep -i memory_limit
memory_limit => 32M => 32M
====Would you like to increase it? Please note that increasing memory_limit could lead to more OOM errors potentially. Thanks,


Next response

That's why we recommend to keep MEMORY LIMIT low. If you have memory limit high, web server will be taking MORE RAM to run websites which will results in MORE OOMs.

Thanks.
 
Last edited:
That dude is insane. Keeping memory low results IS the reason your processes are being killed - cause they are running out of the memory limit.

32MB - WTF. What. The. Fuck.

You do have a plugin doing something stupid - need to figure it out, but the memory being 32MB, WTF.

How much RAM do you have available on your new plan? If possible increase it to 512MB.

What hosting are you using? They're a circus.
 
Knownhost bro I'm trying to find the culprit. If anything I'm just going to switch to a lighting fast theme. Fuck me. I'm checking to see how much ram I have left bare with me, trying to find it. let me google to see where it is

i got the VPS-1 package. Checking under my service status in my cpanel. It usages from 79 to 80% of the memory, leaving 20% left. I'm going to ask him to increase it to 512MB once he responds. Maybe it's the theme, using the herald or like you said, a plugin I need to get rid of. I remember having this similiar issue a long time ago with them and my herald theme couldnt run on their server from slowdaddy, they increased the memory now that i think about it? When I first migrated to them, I might have the emails saved. (actually that's when I was getting this error and he told me to increase it, they did it themselves actually) -
The uploaded file exceeds the upload_max_filesize directive in php.ini

  • 2 Core CPU Processor
  • 2 GB Guaranteed RAM
  • 50 GB RAID-10 SSD Storage
  • 2 TB Premium Bandwidth
  • 2 IP Addresses
  • DirectAdmin or cPanel/WHM

Checking the site health. says Memory: 12 of 128 MB (9%) | WP LIMIT: 40 MB | I'm in the multiphp basic editor cpanel. Memory limit is at 32MB. Says by default it was at 128MB. oh vey. I changed it and checked the editor to confirm. We'll see what happens
 
The 521 errors you see are usually from Cloudflare. It means the origin server is down. It's just a catchall, and not very informative for what actually fails on the server.

I'd check the log files and see what service gives you out of memory errors.

Do you use some Pinterest poster plugin that posts via WP cron jobs? I think there's a plugin to see all queued cron jobs in WP, same with slow DB queries. Maybe you have some freak show of a plugin or theme that does all sorts of weird stuff and hogs up memory. Turn off the trackbacks and the XMLRPC stuff in WP.

For about the price you're paying (~30$) I have a 2gb VPS + a separate 2gb DB instance on AWS. It still has plenty of resources, and even that is over-paying as AWS is kinda expensive for what you're getting.

You can probably host 10 Wordpress sites on 2 GB VPS though. Unless you get a ton of traffic.
 
I'd highly recommend going to Linode and getting a VPS with them. $20 a month gets you 4 GB RAM, 2 cores and they aren't going to do anything stupid like limit you and play "server daddy". You're able to cherry pick the best software to run and you don't have to ask permission any time you want to step outside the norm. Currently I'm using OpenLiteSpeed for the web server along with the latest PHP for clients that are running WP sites. For the most part, upgrading a server (Ubuntu as example) is as easy as "apt update && apt upgrade -y && apt dist-upgrade -y", no need for a cpanel to hide something that simple under a bunch of menus and buttons.

Normally when I see high memory usage on a WP site, 9 times out of 10 it's because the DB is getting hit hard. If you're on a console, doing a "tail -f" on the log file can go a long way along with htop to make sure no processes are trying to rape the server. This is normally due to comment spam or a plugin that's hitting the DB unnecessarily. I recall "WordPress Popular Posts" being a major culprit more than once.
 
I agree with the above, and if you still want a "control panel", I recommend going with one that's not hosted on your server, but instead works as an abstraction layer between the command line and you via an API (via SSH).

Some good solutions are serverpilot.io and runcloud.io. Both have free tiers (not sure about Serverpilot anymore), and they are very affordable.

It will allow you to work with Nginx confix files, simple caching, process monitoring in Supervisor, and run PHP in a safe way (as a non-root user, one user per app), without having to even open the command line. As they are not hosted on your server, they consume very little resources.

I run this for a few clients. Servers have been up all year, and some get a decent amount of traffic.

They are PHP centric approaches, more or less built for Wordpress, with WP CLI setup already. This way you can easily run backups and do maintenance.

Runcloud has an Apache +Nginx reverse proxy setup (or you can run just Nginx). This works well, as some WP plugins like caching plugins only work with Apache, while you can still serve static files directly from Nginx.

This won't do anything you can't do yourself, but it's an easy way to move away from the shitty managed web hosting providers with a sweatshop support center in India. Many of these run on cloud providers, and just pass the cost of marketing, Cpanel licensing, and ops onto you.

If you then want more resources, you can just scale your instance in Linode/Digital Ocean/whatever cloud provider, and it will "magically" work. It will go down for a few minutes, and once it's back up you have more resources.

It will take you less than an hour to migrate over - and just ask in this thread if you need a hand with it.
 
Last edited:
Regardless I had to change the host anyways as they were spanking me in $$$. I had my friend help me out. Helped migrate the site to Dreamhost. I might need help and have someone guide me because I'm trying to go in my phpmyadmin to see get to my wordpress password ( can't log in) in my dreamhost board and help with the memory limit and cron job if need be.

Basically I tried re-adding the site back up but couldn't log in with a backup plugin I had. My friend went to knownhost and just downloaded the public html WP files and mySQL and FTP it to Dreamhost.

@BCN Yes I was reading XMLRPC and trackbacks. Didn't know those are eating up at the resources possibly and hit with a lot of spam they said. I'll have to disable them.

I'll pay (paypal skype: alatefi3) you for your time(I know you guys are busy and got tons of work). Don't need crazy stuff work done just some minor kinks ,silly stuff, but make it worth your time.

Tanks for the help guys! @SmokeTree cool name too

Oh and @CCarter that guy said the opposite is true lol. I just said, I'm out dude, not going to get into a silly debate. Listen to a friend who writes programs (Other sources say the said the same thing you did) vs some tech guy clipping his toenails in the cubicle.

You guys are awesome. This is why this is the best marketing/programming forum is the reigning champ.
 
Last edited:
My dude is helping me out. Didn't want to overload him with work, he's got his own projects to do, why I was asking if anyone else around, delegate work. The site was still sluggish. We got rid of the old theme. New theme pretty fast now (zeen themes). I went in the server and edited the phprc file. Increased the memory limit to 200MB(default they have it 90MB). Thinking more or less the theme itself was ripping memory usage. But heralds WP theme are generally optimized pretty well. Plugins were fine. No malware, who knows, not that advanced at it. Oh, now time to disable the XMLRPC file and trackbacks. Thanks again Busomaniacs!
 
Last edited:
Back