• wp.db get memory error, this is apache log

    [Fri Aug 05 15:36:02.970088 2016] [:error] [pid 988] [client 151.57.27.232:18305] PHP Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 72 bytes) in
    /var/www/vhosts/www.site.com/httpdocs/wp/wp-includes/wp-db.php on line 2349

    Stack trace is

    /var/www/vhosts/www.site.com/httpdocs/wp/wp-content/plugins/better-wp-security/core/modules/backup/class-itsec-backup.php(140): wpdb->get_results(\’SELECT * FROM `…\’, \’ARRAY_N\’)
    #1 /var/www/vhosts/www.site.com/httpdocs/wp/wp-content/plugins/better-wp-security/core/modules/backup/class-itsec-backup.php(80): ITSEC_Backup->execute_backup(false)
    #2 [internal function]: ITSEC_Backup->do_backup()
    #3 /var/www/vhosts/www.site.com/httpdocs/wp/wp-includes/plugin.php(525): call_user_func_array(Array, Array)
    #4 /var/www/vhosts/www.site.com/httpdocs/wp/wp-settings.php(393): do_action(\’init\’)
    #5 /var/www/vhosts/www.site.com/httpdocs/wp/wp-config.php(106): require_once(\’/var/www/vhosts…\’)
    #6 /var/www/vhosts/www.site.com/httpdocs/wp/wp-load.php(37): require_once(\’/var/www/vhosts…\’)
    #7 /var/www/vhosts/www.site.com/httpdocs/wp/wp-blog-header.php(13): require_once(\’/var/www/vhosts…\’)
    #8 /var/www/vhosts/www.site.com/httpdocs/index.php(21): require(\’/var/www/vhosts…\’)

    File class-itsec-backup.php line 140 is calling a “SELECT * FROM wp_postmeta” without any LIMIT.
    Our wp_postmeta is more than 126.000 rows and if you try to put all the records in memory it crashes (we already have 256MB memory limit).

    https://ww.wp.xz.cn/plugins/better-wp-security/

Viewing 8 replies - 1 through 8 (of 8 total)
  • @deestilled

    Have you tried this ?

    dwinden

    Thread Starter deestilled

    (@deestilled)

    Hi dwinden,
    yes, we already did optimization,
    but with respect for your response your answer is out of topic,
    the problem is not the fragmentation of the table,
    the problem is that this query should NOT get all records in an array!
    This is a bad programming choice and should be fixed by the plugin developers.

    @deestilled

    Amen ! Good luck with that πŸ˜‰

    This has been an issue for several years, so the prospect does not look good.

    Don’t rely on the (Database) backup feature of this plugin. Instead look for a more reliable backup solution.

    dwinden

    Thread Starter deestilled

    (@deestilled)

    @dwinden
    lol,
    you’re right, we usually don’t use these kind of feature, I don’t even know why the backup was active.
    I’m new with this plugin and I didn’t know about their “fast assistance”.

    Thank you for your answer.

    @deestilled

    The Security Check module enables the Database Backup module.

    However the Database Backup module Schedule Database Backups setting is not enabled by the Security Check module.

    Usually Database Backups are only created automatically when the Schedule Database Backups setting is enabled.

    It could be a new bug was introduced in the new UI (since 5.4.0) that triggers automatic database backups when only the Database Backup module is enabled.

    dwinden

    @deestilled

    Got curious and checked the backup code.

    Found evidence that seems to indicate simply enabling the Database Backup module is enough to trigger automatic database backups … –> bug !

    However this will only happen if (Schedule Database Backups) Backup Interval setting > 0.
    The default Backup Interval value seems to be 3 (days) …

    To check the Backup Interval value tick the Schedule Database Backups checkbox. As a result the Backup Interval setting and its value will be displayed underneath.

    So in theory ticking the Schedule Database Backups checkbox and then setting the Backup Interval setting to 0 followed by clicking on the Save Settings button will stop triggering automatic Database Backups even though the Database Backups module is enabled.

    I know, it doesn’t make sense but it will probably allow to workaround the bug …

    Since the database backup runs out of memory in your env it’s probably best to disable the Database Backup module.

    dwinden

    I also got this type of error:

    Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 12582920 bytes) in …/wp-content/plugins/better-wp-security/core/modules/backup/class-itsec-backup.php on line 165

    I have now disabled iThemes Security Database Backup module and hope this error does not happen again.

    Hey @deestilled

    When we install Some Security application would be like this to solve this check top10 from here

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘PHP Fatal error: Allowed memory size … in wp.db’ is closed to new replies.