Support » Plugin: PowerPress Podcasting plugin by Blubrry » 2 site-breaking function calls in Powerpress

  • 360zen

    (@360zen)


    For about a year now, I’ve been manually patching Powerpress in order to prevent it from breaking our site. In powerpress.php, there is an indiscriminate get_terms() call that can be considered borderline malicious on large sites. We run a site with many users, using CoAuthors Plus, many tags, and other custom taxonomies. The count of our wp_terms table is over 90,000. On EVERY page load, Powerpress tries to hold and object representation of EVERY WP_Term object available in memory. On a site of our size, this is essentially a DOS attack on our database and PHP process memory. Can this please be refactored?

    Here’s a snippet of where it this call is happening:

    
    if( !empty($PowerPressTaxonomies) ) {
        $terms = get_terms();
        $ttid_found = 0;
        ...
    }

    The reason I finally posted the above is that I found a second such call in the newer version(s) of Powerpress. Thankfully, this one doesn’t break the public page views, but…the powerpressadmin_welcome() function literally tries to store an object of every post in the database in memory. Our site has 180,000+ posts, which means we can no longer access the main Powerpress admin screen (this function breaks the page even when I’ve got our PHP memory limit set to 2+ GB. Here’s the code. Why does this happen? It appears this is purely to get the most recent episode.

    function powerpressadmin_welcome($GeneralSettings, $FeedSettings)
    {
        $posts = get_posts(array('numberposts' => -1));
        $numEp = 0;
        $foundEp = false;
        ...
    }

    Please patch ASAP. I’m happy to answer any questions you may have.

    • This topic was modified 9 months ago by 360zen.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author benbeecroft

    (@benbeecroft)

    Hi 360zen,

    Thanks for using PowerPress!

    The return from this call is actually also used to count the total number of podcast episodes. In our next update, we will include a fix where we don’t report this number (thereby eliminating the need for this query) if there are too many posts on the site.

    Ben

    Thread Starter 360zen

    (@360zen)

    OK, thanks. I would think there would be an easier way to keep track of episodes, rather than querying the whole posts table, then checking meta entries for each of the posts. Couldn’t you just query the meta table directly for the enclosure keys?

    Also, to get the most recent, you could probably do it much more safely with a pagination loop. I.e. grab posts 500 or 1000 at a time, break when the first enclosure is found.

    Also, the get_terms() call I mentioned is actually a much more serious issue. I don’t know what the solution is, because that if statement already looks like a bit of a hack, but my patch for it is to completely remove that block. Hopefully that’ll get looked at in the next update as well.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘2 site-breaking function calls in Powerpress’ is closed to new replies.