php error: allowed memory size exhausted
As I mentioned in #161 I'm getting continually the error Service Timeout with my Github webhook. My hoster log reports such php errors:
PHP message: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 257538424 bytes) in /var/www/virtual/XXXX/html/wp/wp-includes/wp-db.php on line 1102\n'
I already increased the memory to 512 MB. The hoster recommends not go higher with this number.
I've got two custom post types and Polylang installed. I tried to disable all plugins except WPGHS as well.
Any help is very appreciated.
On my personal site, I installed an object cache and have never run into this particular issue. Short-term, that's the best option.
As I noted in #193, I haven't had a lot of time to put into this plugin, and this problem in particular sounds like it could be fairly sticky. I'm not sure I can provide a lot of additional help here.
We also had some memory problems and slow wp queries with this plugin. We repeatedly upped the memory, installed Redis and increased the compute. The thing that worked was deleting a bunch of wpghs's rows in the options table. To see if this is your problem too, I recommend https://wordpress.org/plugins/query-monitor. I hope this saves a headache somewhere.
I just found out that this plugin stores tons of data in wp_options. This is not smart and caused tons of memory overflows. Even after deactivating (or even removing) the memory overflows kept occurring. Had to DELETE FROM wp_options WHERE option_name LIKE '%ghs%'; to get the site back in a good state.
I'm a noob of WordPress tech but it seems far from optimal to store tons of data in wp_options.
(@princessruthie I had to take the memory up to 2000M and even with that the site was almost unusable. After ditching the wp_options 100M seemed to be fine but I put it at 200M just to be on the safe side.)
I'm not saving to wp_options, I'm saving to transients, which WordPress sends to wp_options when no object cache is provided. This is why my recommendation has always been to install an object cache.
If none is provided, short of writing my own caching system (that... saves to the filesystem? not sure how I'd go about it), I don't really know what the alternative would be here.
It took me 2 days to figure out that the problem came from github-sync - also because deactivating github-sync didn't fix it. I learned a lot about wordpress in the process but I think it'd be nice to make it more obvious that some object cache is needed.
It may help others to somehow show a warning in the dashboard if there's ghs stuff in wp_options, possibly combined with high memory use?
Yeah, or ejecting old cache entries. My issue is it feels like that sort of thing should be WP's responsibility. The other is I haven't really dedicated a lot of time to this plugin lately, and testing it reliably has been pretty difficult.