• Resolved ljmac

    (@ljmac)


    Hi,

    Since version 1.7, I’ve been getting a lot of the following error:

    [06-Sep-2013 04:05:57 UTC] PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 523800 bytes) in [URL REMOVED]/wp-content/plugins/wp-simple-firewall/src/icwp-firewall-processor.php on line 328

    Please note that my MySQL max_allowed_packet is set to the default of 1MB, and PHP5 is set to the default memory allocation as well.

    http://wordpress.org/plugins/wp-simple-firewall/

Viewing 15 replies - 1 through 15 (of 20 total)
  • Plugin Author Paul

    (@paultgoodchild)

    This isn’t a MySQL error at this point, it’s a PHP memory limit error.

    You must have a lot of plugins loaded for you to be exceeding 128MB. It just so happens it’s the firewall that is the straw breaking the camel’s back here.

    I can guarantee that if you review your plugins and try and find 1 or 2 that you’re not actively using, and disable them, you’d fix this error.

    Give that a shot and let me know how you get on πŸ™‚

    Thread Starter ljmac

    (@ljmac)

    Okay, I have to say that I find your explanation difficult to accept in this case, for two reasons:

    1) I’ve been running my server for years, and I’ve never had a PHP out of memory error before – it has only happened since I installed 1.7.

    2) It has happened 17 times so far, and every single time your plug-in has been the one that the error logs blame for the error.

    These two things combined seem to clearly point to a memory issue with 1.7.x.

    Plugin Author Paul

    (@paultgoodchild)

    Hey,

    Yep, I hear you… and that’s the thing, it’s probably the straw that broke the camels back after you’ve had this site running so long.

    It makes more sense it would happen in 1.7 than before with this plugin because I moved the initialization of the firewall from the loading of the plugin, to a hook that occurs slightly later in the whole WordPress load – this was to better support WPMS Multisite.

    Now I have spent the better part of today really trying to optimize the plugin to ensure it’s using as little of the components as required unless necessary, but the components that it’s using are actually tiny in the first place. They’re just a bunch of variables that are themselves not very large.

    That said, I’ve given a good crack at further optimizing and all I can say is you try it out. I haven’t released it live, but instead you can download the zip and manually install it.

    Either way, always worth reviewing what plugins you have installed too… and if you really need them all.

    http://downloads.wordpress.org/plugin/wp-simple-firewall.zip

    Let me know if this helps.
    Cheers,
    Paul.

    Thread Starter ljmac

    (@ljmac)

    Thanks again for your help.

    I already have a policy of “minimum number of plug-ins to do the job”, so unfortunately (except for one plug-in that your new comment protection functionality might be able to replace), there isn’t much I can do re the rest of my plug-ins.

    I should point out that I run a BuddyPress site, which are obviously quite a bit heavier than most WordPress sites. I’ll try your new version, and if that doesn’t work, I’ll try doubling the memory limit.

    Thread Starter ljmac

    (@ljmac)

    Bad news: the memory error still occurs, and I’m getting a new PHP error as well:

    [07-Sep-2013 01:59:33 UTC] PHP Fatal error: Call to a member function getOpt() on a non-object in [URL REMOVED]/wp/wp-content/plugins/wp-simple-firewall/icwp-wpsf.php on line 495

    Good news: my original MySQL error issue hasn’t re-occurred since 1.7. Fingers crossed!

    I have reverted to 1.7.1, and increased the PHP memory limit to 256MB.

    Thread Starter ljmac

    (@ljmac)

    Okay, I doubled the memory to 256MB, and almost immediately got the same errors:

    [07-Sep-2013 04:33:52 UTC] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 3216 bytes) in [URL REMOVED]/wp-content/plugins/wp-simple-firewall/src/icwp-firewall-processor.php on line 334

    So 1.7.x unquestionably has a serious memory leak – I’ve reverted to 1.6.2 for now.

    Thread Starter ljmac

    (@ljmac)

    One of my bloggers was reporting 503 errors as well, which disappeared after reverting to 1.6.2. I suspect this is related to mod_limitipconn, which suggests 1.7.x is filling up the available Apache connections.

    Plugin Author Paul

    (@paultgoodchild)

    Okay, I’ve fixed the fatal you reported… it was a result of my juggling things around a bit in the optimizations.

    That last memory limit error you gave was the clue I needed to find this. The problem wasn’t 1.7, but actually code that’s been in there since 1.2.6 where I put in code to cater for parameters that could be arrays.

    I think it was hitting an infinite loop even though I had code in there specifically to avoid that scenario. I’ve given a fresh go on that infinite loop protection and I’m fairly confident it’s working better.

    I know no-one wants to be a beta tester here, but can I ask you to try out the latest trunk version?

    http://downloads.wordpress.org/plugin/wp-simple-firewall.zip

    It looks like the WordPress.org SVN repo has completely screwed up today and it’s offering out the 1.7.2beta2 version I posted and there are no other versions available. Wonderful.

    If you could test this when you get a chance, I’ll officially put it live then.

    Thanks so much for your help!
    Paul.

    Thread Starter ljmac

    (@ljmac)

    Hi Paul,

    Installed your ‘new’ version, but it says it’s beta 1, and it’s dated September 6. I am unable to download beta 2 no matter what I do, so I’ve gone back to 1.6.2 again.

    I forgot to mention another problem with 1.7: I cannot set the email throttle to zero (as I have with all previous versions).

    The link that Paul provided above says it’s 1.7.1 but it has code modifications as it is different than the 1.7.1 that was released days ago. I briefly tested it, and noticed that the comment/spam protection was no longer working when I swapped the files. So I just swapped them back. Didn’t have a chance to look and see if any of my settings had changed. Sorry, didn’t have time to inspect it any further.

    Plugin Author Paul

    (@paultgoodchild)

    Yea, the SVN Repository is a little broken as of yesterday:
    http://wordpress.org/plugins/wp-simple-firewall/developers/

    This is supposed to list all the versions for download and it only lists the beta2 for me. It’s a bit of a mess, but there’s nothing I can do about that.

    And the errors you’ve reported is why I tried to keep this beta and not release it as final version… just bad timing with the broken SVN repo.

    I’ll address these problems you mentioned and fire up a new release and hopefully you guys can give it a spin.

    I hope you don’t mind this back and forth… your help to work out these kinks can only make the plugin far stronger going forward. Last thing I want to do is break a site with a bug.

    Thanks again!
    Paul.

    Plugin Author Paul

    (@paultgoodchild)

    alright, the plugin is now on 1.7.3. and it looks like that update fixed the SVN repo listing.

    I’ve fixed the problem with setting the value to 0 for email (and others).

    Hopefully that infinite loop is no more, and any other outstanding bugs are resolved.

    MickeyRoush, when you say the comment spam filtering wasn’t working, can you elaborate on that?

    Again, apologies for the hassle for the last couple of days, I just hope we’re past it now and good to move on πŸ™‚

    Please let me know how you get on with the latest version.

    Cheers,
    Paul.

    It’s working now. I usually just SFTP’d the files over without going into the Dashboard to make sure the settings are set. Didn’t know I had to do that with the update. I’m so use to just examining the files then SFTPing them.

    Thread Starter ljmac

    (@ljmac)

    Good news: I’ve been running 1.7.3 for about half a day now, and no out of memory errors. No 503s either. Email throttle setting working too. It does indeed appear to be fixed.

    Plugin Author Paul

    (@paultgoodchild)

    Okay, that’s great to hear! Delighted in fact πŸ˜€

    There’s quite a lot changed in the inner workings to get there and I’m fairly sure that that memory problem was the potential infinite loop – as there is only 1 place in the code that has a loop like that.

    MickeyRoush – are you saying you don’t use the WordPress update mechanism when you update plugins? Each time this plugin updates, it effectively resets itself and any cached values/objects (though you don’t actually need to reset your options)

    This ensures you have a clean and compatible configuration each time you upgrade. I normally only reset cached objects on the admin page so your visitor don’t incur any performance hit by checking/rebuilding the cache while they browse.

    When you update the plugin, it’s always a good idea to load any admin page once – that’ll give the plugin a chance to clean up and migrate any old settings to new (if any).

    Guys, huge thank you for your patience in the last couple of days and for your testing and helping me track all this down – it’s greatly appreciated and I couldn’t have gotten there without you!

    Cheers,
    Paul.

Viewing 15 replies - 1 through 15 (of 20 total)
  • The topic ‘New PHP Error Since 1.7’ is closed to new replies.