• Resolved bzadmin

    (@bzadmin)


    Hi, I was just starting to evaluate ATUM and I’m getting the “Allowed memory size exahsuted” (I’m using 512MB!) The issue happens on this callstack:

    apply_filters (dev-wp/wp-includes/plugin.php:184)
    wpdb->get_col_charset (dev-wp/wp-includes/wp-db.php:2811)
    wpdb->process_field_charsets (dev-wp/wp-includes/wp-db.php:2465)
    wpdb->process_fields (dev-wp/wp-includes/wp-db.php:2392)
    wpdb->_insert_replace_helper (dev-wp/wp-includes/wp-db.php:2216)
    wpdb->insert (dev-wp/wp-includes/wp-db.php:2160)
    Atum\Inc\Upgrade->migrate_atum_products_data (dev-wp/wp-content/plugins/atum-stock-manager-for-woocommerce/classes/Inc/Upgrade.php:479)
    Atum\Inc\Upgrade->create_product_data_table (dev-wp/wp-content/plugins/atum-stock-manager-for-woocommerce/classes/Inc/Upgrade.php:401)
    Atum\Inc\Upgrade->__construct (dev-wp/wp-content/plugins/atum-stock-manager-for-woocommerce/classes/Inc/Upgrade.php:97)
    Atum\Inc\Main->pre_init (dev-wp/wp-content/plugins/atum-stock-manager-for-woocommerce/classes/Inc/Main.php:141)
    WP_Hook->apply_filters (dev-wp/wp-includes/class-wp-hook.php:287)
    WP_Hook->do_action (dev-wp/wp-includes/class-wp-hook.php:311)
    do_action (dev-wp/wp-includes/plugin.php:478)
    require_once (dev-wp/wp-settings.php:540)
    require_once (dev-wp/wp-config.php:77)
    require_once (dev-wp/wp-load.php:37)
    require (dev-wp/wp-blog-header.php:13)
    {main} (dev-wp/index.php:17)

    Which points to this line:

    			// Insert a new row of data.
    			$inserted_row = $wpdb->insert( $wpdb->prefix . 'atum_product_data', $new_data );

    This line is called during a foreach loop that iterates on all products. We have 30K+ products so obviously things are going sideways here.

    A few things that would need to happen:
    – memory has to be properly managed during the loop
    – there should be a process by which the Upgrade() call is not done in the pre-init but rather in the setup/settings page such that it can be async (progress bar) OR a WP-CLI command that allows this to run for for a while without hitting any time-limits set by the apache php settings.

    Any ideas or pointers are much appreciated! can also contribute to any fix I find.

    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter bzadmin

    (@bzadmin)

    Oh.. as it happens it looks like this was a known issue and at one point the fix for it was commented out. Immediately after the insert line in Upgrade.php (#479) there’s this commented code:

    // TODO: Move meta deletion to ATUM settings -> Tools
    // If the row was inserted, delete the old meta.
    // phpcs:ignore Squiz.Commenting.BlockComment.NoNewLine
    /*if ( $inserted_row ) {
        foreach ( array_keys( $meta_keys_to_migrate ) as $meta_key ) {
            delete_post_meta( $product->ID, $meta_key );
        }
    }*/

    Uncommenting de if.. foreach fixes the problem and the install goes through correctly.

    Plugin Author Salva Machi

    (@salvamb)

    Hi @bzadmin

    Thanks for your feedback and the detailed info.
    We’re going to investigate this issue and if we find any bug there, we’ll fix it for the next version.

    Best Regards,
    Salva.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Allowed memory size exhausted during installation’ is closed to new replies.