Support » Plugin: WP RSS Multi Importer » [Plugin: WP RSS Multi Importer] Many feeds leads to too much memory use

  • Hi,

    I am trying to set this excellent plugin to pull info from quite a few feeds.

    When the number of feeds I pull information from reaches ~70 feeds the page (the page that a visitor would see) will not display.

    Instead an error message appears:

    “Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 196736 bytes) in /nas/wp/www/staging/bkwine/wp-includes/functions.php on line 316”

    Does this plugin consume a lot of memory, or is there for some other reason a limit to the number of feeds that one can have?

    -Per

    http://wordpress.org/extend/plugins/wp-rss-multi-importer/

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Author Allen

    (@amweiss98)

    Hi
    I haven’t tried using more than 40 feeds but I can say that is a typical WordPress error that is a result of a memory limit (which can be made to go away if you increase memory but I think that is in the core php file). Have you tried turning on the caching in the settings panel which will store the feeds in cache memory?

    Allen

    Hi,

    Thanks for a rapid answer!

    Yes, I did turn on the caching (30 minutes). Figured it could help, but it didn’t make much difference. (none that I could notice actually)

    I’m testing it on a staging site (on WP Engine) and I am not sure if that perhaps limits the caching possibility. I don’t think it does, but I am not sure.

    I’m struggling to figure out a way around this, since it is such a nice tool but not sure what I could do.

    -Per

    Plugin Author Allen

    (@amweiss98)

    Well, what I’ve done when I’m on a development server is increase the memory limit, which makes the warning go away. Not sure what else I can say…what appears to be happening is that SimplePie, which is responsible for fetching the feeds, puts the memory load…my plugin isn’t that memory intensive (there is some memory load when it gets to the stage of resizing images, etc.) but the memory error always occurs way before that…when the feeds are being fetched, and that is being done, as I said, by SimplePie.

    Looks like you have access to the php.ini file, if so, you can increase memory there and see if that solves the problem. You can also go into the wordpress wp-config.php file and use this:

    define(‘WP_MEMORY_LIMIT’, ’64M’);

    and increase from 64M to 128M, etc.

    Not sure what else I can say…it may just be a limit that I will need to test and see if I can find some other way to optimize the memory for the plugin..which I’ll try to do

    I’ll check with my hosting provider to see if there’s anything they can do.

    I know nothing about the php files and how it is set up so I am reluctant to manipulate any of them myself.

    -Per

    They’re looking into it.

    Meanwhile, some more details. It is not systematic that I get the error message. Sometimes it works.

    But even when it works the page load time is very long, 30+ seconds. So I guess this is not a good way to do what I want to do.

    Plugin Author Allen

    (@amweiss98)

    and that happens even when you have the caching on? When the cache is on, it doesn’t go out and fetch new feed, but instead gets the data from the database. Assuming this is unrelated to our server, then it may just be a limit as to how many feeds my plugin can handle.

    Well, perhaps. Caching was set to 30 min and it is just a bit over 30 min since I checked the page, so I guess it passed the limit. I’ll change caching to 300 and test again to make sure I’m withing the caching time period.

    Plugin Author Allen

    (@amweiss98)

    also, if you go to google and type in

    Fatal error: Allowed memory exhausted /wp-includes/functions.php on line 316″

    you’ll see this is actually a quite common problem on wordpress..plus you’ll see how people are usually solving this by some changes to their wordpress config file, like this one:

    http://wordpress.org/support/topic/fatal-error-allowed-memory-size-6?replies=13#post-1017842

    You’re correct. Caching makes a big difference. From what I can see now.

    How does the caching work? Does it go out and fetch *everything* at the same time once the caching limit is reached? Which means that one will ge the slow response time then. Or is there some kind of progressive update of the different items?

    Plugin Author Allen

    (@amweiss98)

    Correct. What you could do is set up a cron service to hit the page every 30 min (and set the cache for 30 min). That way nobody will ever go to the page and need to bring in the feeds (they will always be refreshed and in the database). Does that make sense?

    Except that I don’t know what a cron service is. 😉

    I’ll see if it makes sense or if I should do something else. It seems not to be an ideal way of doing it, in view of the issues.

    Plugin Author Allen

    (@amweiss98)

    A cron service is just something that hits your web page at designated intervals. Like this site
    https://www.setcronjob.com/

    although, there are other ways to do this..I’m going to include a cron service in a future update to the plugin.

    Plugin Author Allen

    (@amweiss98)

    Hi Per
    I figured out a cron solution…if you want to give it a try, let me know and I’ll send you instruction on how to do this within my plugin.

    Allen

    Allen,

    Thanks for the suggestion! would be interesting to look at.

    You can find an email to reach me on here:
    http://www.bkwine.com/contact/

    However, I think I’ll wait a bit with implementing it live. My web host is looking at what might be the reason for the memory issue so I’ll let them get on with that first.

    -Per

    Allen,

    Have had some feedback from my hoster. thought it might be of interest to you. You may understand a bit more of it than I do.

    Here:

    —————-

    The first error that’s coming up is:
    “Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 196736 bytes) in /nas/wp/www/staging/bkwine/wp-includes/functions.php on line 316”

    Now, line 316 in “wp-includes/functions.php” pertains to data being serialized so it can be stored in the WordPress database. It’s specifically the “return serialize( $data );” in this bit of code:

    /**
    * Serialize data, if needed.
    *
    * @since 2.0.5
    *
    * @param mixed $data Data that might be serialized.
    * @return mixed A scalar data
    */
    function maybe_serialize( $data ) {
    if ( is_array( $data ) || is_object( $data ) )
    return serialize( $data );

    // Double serialization is required for backward compatibility.
    // See http://core.trac.wordpress.org/ticket/12930
    if ( is_serialized( $data ) )
    return serialize( $data );

    return $data;
    }

    And now, the second error:

    “Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 321481 bytes) in /nas/wp/www/staging/bkwine/wp-includes/wp-db.php on line 791”

    Which refers to “return addslashes( $string );” in “wp-includes/wp-db.php” in this stretch of code:

    /**
    * Real escape, using mysql_real_escape_string() or addslashes()
    *
    * @see mysql_real_escape_string()
    * @see addslashes()
    * @since 2.8.0
    * @access private
    *
    * @param string $string to escape
    * @return string escaped
    */
    function _real_escape( $string ) {
    if ( $this->dbh && $this->real_escape )
    return mysql_real_escape_string( $string, $this->dbh );
    else
    return addslashes( $string );
    }

    That’s turning slashes (of which there are a bunch) into properly escaped slashes for storage in the database. So basically, the feed plugin is running out of memory processing 70+ feeds at once. You need to either take this up with the plugin developer
    Or consider an alternative feed processing script that allows you to stagger how often feeds are checked. A solid one (with great support) is:
    http://premium.wpmudev.org/project/autoblog/

    ————————————————

    (There’s also another one I’ve looked at, that is not at all as feature rich as RSS Multi-Importer but that does not seem to have the same problem with a large number of RSS feeds: WP RSS Aggregator.)

    -Per

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘[Plugin: WP RSS Multi Importer] Many feeds leads to too much memory use’ is closed to new replies.