Plugin creates json and 505 errors
-
Hi,
Thank you for your great work with pods. Really fantastic.
We are using pods in two websites, one in a linux server and one in a windows server, both pods 2.9.19 version, and both using wpml for translation.
After the last updates, the website in the windows server is going fine as always, even after recreating the pods fields database.
But something went wrong with the one in the linux server, after the last updates:
- When deactivating pods, the website works fine, but without pods I can’t have my info displayed;
- When activating pods, any changing and saving returns “The response is not a valid JSON response”. This happens with pods, pages, posts, and any other plugin;
- Further, when visiting the website it returns a 505 error;
- Resaving the permalinks, corrects the 505 error and the website is back, but jus for a while because when making changes follows on “The response is not a valid JSON response”.
- Therefore, pods is now deactivated and I turned on maintenance mode.
For testing purposes, in the linux server, we installed a fresh website from the ground: new database, new wordpress, new plugins (wpml, pods,….), but the “The response is not a valid JSON response” and the 505 appeared.
We also have contacted the hoster to check the linux server configuration, but the answer was: the problem is on your side.
Can you imagine why pods is causing such errors?
Should we change the website to a windows server?
Thank you for any clue or advise on this, as we are very worried after tons of work already made using pods. We can’t imagine going to other plugin.
Many thanks.
Rogerio
-
This topic was modified 2 years, 10 months ago by
norte2017.
The page I need help with: [log in to see the link]
-
Hi Rogerio,
HTTP 505 would be a bit odd, as that specific code means that the server does not support the HTTP protocol version being requested by the browser. It usually indicates an out-of-date browser in use or a misconfigured proxy service, such as Cloudflare or Imunify360.
However, when I load the URL you provided, I get an error 500 (not 505), which is a generic server error, and I can see the site is not behind Cloudflare. With the information provided, I was able to verify some things, which may narrow down the possibilities of what could be causing the error:
- I can load https://greenlines-institute.org/license.txt successfully and consistently in multiple browsers. This indicates that your HTTP server, which appears to be Nginx on Plesk, is working fine for static files, but not PHP.
- This article indicates Plesk will return an error 500 is PHP hits an out-of-memory error, or if .htaccess or nginx.conf has errors, such as recursion.
- If it is an out-of-memory error, see this article on wp-config.php and check the PHP error logs, which would indicate an out of memory error from PHP and possibly a file responsible. The wp-config setting will only modify the limit of what is allowed for an individual request — it will not change the amount of physical memory available for all processes. This Plesk extension may be available and relevant for viewing memory usage. If not that, the CLI commands
cat /proc/meminfoorfreeorvmstatortopmight give you the relevant information. - I mention memory in particular because if I try to load https://greenlines-institute.org/xyz, I am able to see a 404 page from the
maintenanceplugin, but only intermittently. Sometimes it indicates an error 500. This intermittent nature of the error again indicates a server under load or running out of memory. I can also load https://greenlines-institute.org/en/ with the same maintenance page displayed intermittently. As you indicated maintenance is active and Pods is inactive, this indicates a general memory issue with the server, infinite redirects, background tasks running on Cron, or a combination of such things. - Regarding the connection to Permalinks and valid JSON responses: it is the case that Permalinks not being set will cause
/wp-json/requests, such as Gutenberg and various plugins, to not work. But again, the intermittent issue points to memory — either due to load or a memory leak due to recursion or aggressive queries or other errors in logic.
Based on those items, here are some things I would look for:
- First, check PHP and Nginx error logs to see if more relevant information, such as a path to a failing file, can be found. Also check Apache if it’s running behind Nginx.
- Check .htaccess and nginx.conf and Pods and WPML for any configurations that might result in infinite loops. e.g., non-default configurations, or URL mappings that might conflict with each other. For example, I see your home page redirects to
/en/. If there is some HTTP server rewrite, custom post type, taxonomy, multisite, or other data structure existing in multiple plugin or code configurations that conflict in such a way as to cause an infinite loop, it would cause an out of memory error 500 very quickly. Query Monitor can be useful for analyzing what rewrite rules are registered, for example. It will also tell you how much time, memory, and how many database queries occur for a given page load. Keep in mind this metric is for one load of WordPress — the server’s total available memory divided by memory for one uncached load would be an indicator of how many simultaneous page loads it can bear without crashing. Some configurations of page loads, such as the maintenance page with a 404 mentioned below, load WordPress multiple times. - Check your templates for potentially errant redirects or infinite loops. Testing with a default theme or disabling custom Pods templates one-by-one is a quick way to rule this out.
- If all that fails, check for any background processes or aggressive queries that might be running intermittently or on catch-all actions such as
wp,init, ortemplate_redirect. As you’re having issues with REST responses, I’d suspect functions on the first two more than the third.
When attempting to analyze the site further, I was blocked for a period with HTTP 403 from a service called
Imunify360(imunify360-webshield/1.21), so if searches for memory usage or infinite redirects don’t pan out, it might also be worth checking the logs of that firewall service. Its documentation indicates some configurations and conflicts can result in an error 500. If that service is running in Plesk, it’s also taking memory to operate.Some final edge-case notes:
- It’s running PHP 7.4.33. The end of life date for PHP 7.4 was November 28, 2022. This means it is no longer updated for newly found vulnerabilities or errors. It might be worthwhile to try updating PHP.
- XML-RPC is enabled. It’s usually prudent to disable this if you’re not using it, which you’re probably not, as it can be used by robots to automate login attempts, which consumes server resources, such as memory.
- There’s no WordPress version being output by the 404 page. Unless this is a behavior of the maintenance plugin, this might indicate the site running a security plugin, such as Wordfence, which could be a source of conflicts with the redirects or memory consumption.
- If analysis leads to memory problems, and you’re not running an object cache such as Memcache, Pods Alternative Cache may help reduce memory usage.
- This probably isn’t it, but the maintenance plugin the site is running has a setting which intentionally sends a
503 Service temporarily unavailableHTTP error. Doesn’t seem like that would be the case, as it sometimes displays, but might as well check that it’s off. - Check for 404 occurring in templates. For example, the logo on the maintenance page is a 404. When a file 404s in WordPress with permalinks enabled, it causes the 404 template to load, which instantiates a additional HTTP and PHP threads to load WordPress to display that template. As your 404 template currently itself contains that 404, this would be an example of a possible infinite loop that would only be mitigated by a browser choosing to not process HTML returned in response to a request for an image. At a minimum, every page load for the maintenance page and 404 page is loading WordPress twice. 404 should be cached to load as quickly as possible to conserve memory, as robots will often request random paths from web servers. If a web crawler were configured to parse HTML responses regardless of the type of file requested, such a configuration could query your site infinitely until either the server fails to respond or the crawler hits a recursion limit.
- If you are running any database writes on frontend page loads without user interaction, this will consume memory very quickly.
- If your test site was installed on the same server that’s running the site with memory errors, the test site would still be on a server that’s running out of memory.
If all that doesn’t lead anywhere and you’re still at a loss, if you deploy a test instance to Digital Ocean with Sail, it has a performance profiler that will tell you exactly how much processing time and memory is used by every action, filter, and function for any analyzed page request. Doing that would take some time, but the server resources for a test analysis are fairly inexpensive.
Hi Paul,
thank you for your kind and detailed reply. Awesome. As I’m not a developer and having basic knoledge on wordpress it as quite impressive.
*Sorry, I wrote 505 but should have been 500.
Some details:
wp memory: 1024 M
Changed php version to alt-php82-fastcgi.
Activate debug but no errors registered.
Disabled xmlrpc.php.
Intalled pods cache.
Activated pods and it failed again: shows 500 and I can’t save anything without the json error to occur.
I’m with your oppinion, also suspect on some memory or some server misconfiguration.
Therefore, I’m insisting with the hoster to give me an answer.
Many thanks for your help.
Rogerio
Since your configuration is specific to Pods + WPML, here is an open issue on the Pods GitHub that gives an example complex query that may result, along with a possible resolution.
As multilingual sites are complex, such things will vary significantly depending on your configuration and templates, but that may help to get an idea of possible optimization that may be necessary, or reasons for increasing memory in general.
I can’t comment on WPML much further than that — in my limited experience with multilingual sites, I’ve generally had better luck with Polylang, and more recently moved to a plugin of my own design that fits my limited use cases.
It’s also possible to configure ML using a WP multisite and switch_to_blog() for necessary cross-site queries.
Much of this will change in the near future, as multilingual block editor support is slated for the 4th phase of the long-term Gutenberg roadmap.
Great, thanks for the response and follow-up. One note on this line:
wp memory: 1024 M
This may not be what an actual page view is consuming — see Query Monitor or Sail or memory_get_peak_usage() for that — but it does mean one inefficient page load could consume up to 1GB of of physical RAM before shutting down; loading an admin page could easily take up to 4GB+ for one view if admin-ajax or wp-json were hit just a few times with inefficient queries. Check actual memory usage in Plesk — you may find that the server container itself is running out of resources.
Glad to hear PHP has been upgraded to 8.2 :). Also consider how many PHP threads Fast CGI is allowed to spin up. e.g., if there’s an inefficient query or two in there, each individual thread could consume up to 1GB before shutting down; easily overwhelming the server if not identified and optimized.
It’s not difficult to run into such resource limits if queries are running across many languages, post types, and fields to generate a complex layout! Proactive caching can help, but sometimes complex queries have to be identified and optimized to get things working on servers with limited resources.
I’m not familiar with the details of your specific host, but Plesk usually means a VPS, which has hard memory limits. Even if it’s dedicated hardware, the physical RAM runs out at some number. Some WordPress hosts make it possible to auto-scale available resources, if it’s easier to throw hardware at the problem than it is to debug the specific queries, templates, and data models.
Hi Paul,
it’s out of my boundaries to get deeper on this.
I’m waiting the hoster response, and probably migrate to a more stable and updated service. If our other website that is hosted in a windows plesk server which is running a quite heavy pods structure with wpml without any errors , that should be considerer as a reference for the server configuration.
Your support was amazing, thank you once more.
Greetings,
Rogerio
Alright good luck! With any luck there may be a host willing to migrate it to a new environment on your behalf.
There will be no problem, they will do the migration to another server managed by them.
Just one more question, if I may.
Is the following ok:
Debug information for Pods installations.
Server Software Apache
Your User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/115.0
Session Save Path /opt/alt/php73/var/lib/php/session
Session Save Path Exists Yes
Session Save Path Writeable Yes
Session Max Lifetime 1440
Opcode Cache: Apc No
Opcode Cache: Memcached No
Opcode Cache: OPcache No
Opcode Cache: Redis No
Object Cache: APC No
Object Cache: APCu No
Object Cache: Memcache No
Object Cache: Memcached No
Object Cache: Redis No
Current Memory Usage 107.023M / 1024M
Current Memory Usage (real) 23.000M
Pods Network-Wide Activated No
Pods Install Location /wp-content/plugins/pods/
Pods Developer Activated No
Pods Tableless Mode Activated No
Pods Relationship Table Enabled Yes
Pods Relationship Table Count 229
Pods Light Mode Activated No
Pods Strict Activated No
Pods Allow Deprecated Yes
Pods API Cache Activated Yes
Pods Shortcode Allow Evaluate Tags No
Pods Sessions Disable sessions
Pods Can Use Sessions Yes
Setting: Types only No
Setting: Watch Changed fields Yes
Setting: Watch WP Metadata calls Yes
Setting: Override WP Metadata values YesThank you.
- Those last 3 options can be configured under Pods Admin > Settings > Performance. Turning off the filtering of meta etc makes things run much more efficiently if they’re not needed.
- Everything does better with an Object Cache, but you’ve installed Pods Alternative Cache which does much of the same work.
- Everything else looks normal to me.
Thanks.
The topic ‘Plugin creates json and 505 errors’ is closed to new replies.