WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] admin.php tries to increase memory_limit (12 posts)

  1. helpy
    Member
    Posted 4 years ago #

    In my server logs there is the following error:

    [Thu Jun 03 13:14:08 2010] [error] [client 79.208.***.***] ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker '79.208.***.***', file '/is/htdocs/wp*******_**********/example.com/www/wp-admin/admin.php', line 91), referer: http://example.com/wp-admin/index.php

    Is there a way to avoid this?
    cu, guido

  2. IIRC, admin.php does that when you're running upgrades, but I could be wrong... What were you doing when that happened?

  3. helpy
    Member
    Posted 4 years ago #

    When I refresh the dashboard, there will be 5 (five) entries in the server log with the mentioned error message.

  4. I poked around but I can't repro that.

    What is your memory limit on that server?

  5. helpy
    Member
    Posted 4 years ago #

    The memory limit (listed in phpinfo()) is 128 MByte.

    And some more information:

    - PHP Version 5.2.12
    - Apache/2.2
    - WP 3.0 RC2 (was the same with RC1)
    - Multisite is ON ... using subdomains
    (1 main blog, 1 blog on a sub domain)
    - Buddypress ... and some other Plugins

  6. It may be a plugin that's causing that error.

  7. helpy
    Member
    Posted 4 years ago #

    OK! I disabled all plugins (except buddypress) ... it did not change anything!

    Then I searched the code of wordpress and all installed plugins!

    1. admin.php - line 90 + 91:

    if ( current_user_can( 'manage_options' ) )
    @ini_set( 'memory_limit', apply_filters( 'admin_memory_limit', '256M' ) );

    Nowhere else in the code the tag 'admin_memory_limit' is used!
    This means, the function apply_filters will return the value '256M' ...
    ... if I interpret this code correctly???

    cu,
    guido

  8. That looks like a correct interpretation, but I'll have to sit and read the whole check and ifs to see if there's a reason that gets called every time you run admin.php.

    This is now out of my depth, sorry :(

  9. helpy
    Member
    Posted 4 years ago #

    Thank you for your time!

    Solution, I do not like: ignore the "error" message in the server logs

    cu, guido

  10. Carlos Mundi
    Member
    Posted 4 years ago #

    I must have forgotten to hit the "post" button last night. Apologies to those I referred to this thread before I actually posted. :)

    I believe I am seeing the same thing. Any access -- just landing on the home page -- tries to eat 256MB.

    Ubuntu 9.04 x64 512MB VPS
    Cherokee 1.0.5
    MySQL 5.3.17
    PHP 5.2.10 / Suhosin

    phpinfo(): /etc/php5/cgi/php.ini with memory_limit=64MB
    wp-config.php: define('WP_MEMORY_LIMIT', '64M');

    Note that regardless of how low I set memory limits (simultaneously in php.ini and wp-config.php) my server log indicates that wp-admin.php is trying to grab 256M, as described by Helpy earlier in this thread.

    Symptoms are intense disk thrashing from a single pageload, leading to failed and partially rendered pages and server timeouts. Unusable.

    I tried very hard to follow the directions to install WP3, but maybe I did something wrong. Any ideas about what I should check?

    Or is it just a fact of life that WP really needs 256MB to be happy even with no plugins?

    Thanks,
    Carlos

  11. Carlos Mundi
    Member
    Posted 4 years ago #

    OK, I think I've made some progress.

    It now appears that the server logs complaining about an "attacker" trying to allocate 256MB and this being more than the php limit are only correlated with disk thrashing but not actually causation.

    My VPS recently bumped my RAM from 360MB to 512MB, but I was still running with a 360MB swap. I increased my swap to 512MB and

    1. the log messages still appear; but
    2. thrashing has stopped.
    3. I think this makes sense. Until I had WP going, everythign I had going on probably fit in 360MB of RAM most of teh time. So swapping, when even needed, was probably minimal. But now I have PHP grabbing up to 256MB. With only 360MB of swap, you can imagine the bottleneck. I don't have enough data to say this was definitely the cause of the thrashing, but the data I do have is consistent with this theory. I will monitor this for a few hours to see.

      So, yes, I did do something stupid.

      Thanks,
      Carlos

  12. carbontwelve
    Member
    Posted 3 years ago #

    The way to fix this is open your admin.php file within the wp-admin directory and search for 256M. I believe its on line 96. Change this to the maximum allowed memory limit as declared within your php settings and then save.

    The error is kicked up when wordpress attempts to increase the maximum memory limit for php. To be honest 256MB per php process is a HUGE amount of memory, I have happily used wordpress with a limit of 32MB and it has kept on ticking over fine.

Topic Closed

This topic has been closed to new replies.

About this Topic