Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory limit when generating large amounts of test data #152

Open
5 tasks done
mikkamp opened this issue Dec 11, 2024 · 1 comment
Open
5 tasks done

Memory limit when generating large amounts of test data #152

mikkamp opened this issue Dec 11, 2024 · 1 comment

Comments

@mikkamp
Copy link
Contributor

mikkamp commented Dec 11, 2024

Prerequisites

  • I have carried out troubleshooting steps and I believe I have found a bug.
  • I have searched for similar bugs in both open and closed issues and cannot find a duplicate.

Describe the bug

I tried to generate a large set of orders for testing (50k), however it seems that this eventually runs out of memory (1GB):

$ wp wc generate orders 50000 --date-start=2010-01-01 --date-end=2024-12-10
Generating orders  6  % [=======>                                                                                                              ] 33:14  / 478:53
2024/12/11 11:40:10 Resident memory usage of 1258954752 bytes exceeded maximum allowed value of 1258291200

    3.0mb	/bin/bash -i -l
  989.6mb	/usr/local/php8.3/bin/php /usr/local/bin/wp-cli --path=/srv/htdocs/__wp__/ wc generate orders 50000 --date-start=2010-01-01 --date-end=2024-12-10

I haven't looked into the details of the memory usage, but from this run it seems like it's not cleaning up some things after creating an order which is making the used memory grow, till it runs out.

WordPress Environment

Pressable site with:

WordPress 6.7.1
WooCommerce 9.4.3
WooCommerce Smooth Generator 1.2.1

Isolating the problem

  • I have deactivated other plugins and confirmed this bug occurs when only WooCommerce and WooCommerce Smooth Generator plugins are active.
  • This bug happens with a default WordPress theme active, or Storefront.
  • I can reproduce this bug consistently using the steps above.
@coreymckrill
Copy link
Contributor

I did some rudimentary profiling of the orders and products generators using xdebug. I don't really know what I'm doing with yet with the profiling tools, but from the output files, it looks like the biggest bottlenecks are:

  • Orders: Order::get_random_products
  • Products: Generator::generate_image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants