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

Numbers tab exhausting memory limit #752

Open
alexmigf opened this issue Mar 18, 2024 · 3 comments · May be fixed by #755
Open

Numbers tab exhausting memory limit #752

alexmigf opened this issue Mar 18, 2024 · 3 comments · May be fixed by #755
Assignees

Comments

@alexmigf
Copy link
Member

A customer reported issues when trying to load the Numbers tab. Note that this user has 26k orders, which might be the reason for the memory exhausting issue.

An error of type E_ERROR was caused in line 1168 of the file /var/www/website.com/wp-content/plugins/woocommerce/src/Internal/DataStores/Orders/OrdersTableDataStore.php. Error message: Allowed memory size of 536870912 bytes exhausted (tried to allocate 266240 bytes)

@kingyyyyyy
Copy link

System report for my site, if it helps:-

`

WordPress Environment

WordPress address (URL): https://myeliquidsupplies.com
Site address (URL): https://myeliquidsupplies.com
WC Version: 8.6.1
REST API Version: ✔ 8.6.1
WC Blocks Version: ✔ 11.8.0-dev
Action Scheduler Version: ✔ 3.7.1
Log Directory Writable: ✔
WP Version: 6.4.3
WP Multisite: –
WP Memory Limit: 512 MB
WP Debug Mode: –
WP Cron: ✔
Language: en_GB
External object cache: –

Server Environment

Server Info: Apache/2.4.58
PHP Version: 7.4.33
PHP Post Max Size: 120 MB
PHP Time Limit: 300
PHP Max Input Vars: 10000
cURL Version: 7.68.0
OpenSSL/1.1.1f

SUHOSIN Installed: –
MySQL Version: 8.0.36-0ubuntu0.20.04.1
Max Upload Size: 120 MB
Default Timezone is UTC: ✔
fsockopen/cURL: ✔
SoapClient: ✔
DOMDocument: ✔
GZip: ✔
Multibyte String: ✔
Remote Post: ✔
Remote Get: ✔

Database

WC Database Version: 8.6.1
WC Database Prefix: wp_
Total Database Size: 1279.95MB
Database Data Size: 814.12MB
Database Index Size: 465.83MB
wp_woocommerce_sessions: Data: 1.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_api_keys: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_attribute_taxonomies: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woocommerce_downloadable_product_permissions: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_order_items: Data: 9.52MB + Index: 3.52MB + Engine InnoDB
wp_woocommerce_order_itemmeta: Data: 108.63MB + Index: 55.14MB + Engine InnoDB
wp_woocommerce_tax_rates: Data: 0.02MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_tax_rate_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zones: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_zone_locations: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_woocommerce_shipping_zone_methods: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_payment_tokens: Data: 0.20MB + Index: 0.06MB + Engine InnoDB
wp_woocommerce_payment_tokenmeta: Data: 0.45MB + Index: 0.41MB + Engine InnoDB
wp_woocommerce_log: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_actions: Data: 15.02MB + Index: 17.13MB + Engine InnoDB
wp_actionscheduler_claims: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_groups: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_actionscheduler_logs: Data: 12.02MB + Index: 8.03MB + Engine InnoDB
wp_cli_scripts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_cmplz_cookiebanners: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_cmplz_cookies: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_cmplz_dnsmpd: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_cmplz_services: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_cmplz_statistics: Data: 0.27MB + Index: 0.00MB + Engine InnoDB
wp_commentmeta: Data: 1.52MB + Index: 1.97MB + Engine InnoDB
wp_comments: Data: 81.61MB + Index: 40.09MB + Engine InnoDB
wp_links: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_mailchimp_carts: Data: 1.02MB + Index: 0.00MB + Engine InnoDB
wp_mailchimp_jobs: Data: 12.09MB + Index: 0.00MB + Engine InnoDB
wp_options: Data: 89.23MB + Index: 7.08MB + Engine InnoDB
wp_postmeta: Data: 256.80MB + Index: 141.28MB + Engine InnoDB
wp_posts: Data: 17.55MB + Index: 8.06MB + Engine InnoDB
wp_rapidload_job: Data: 0.11MB + Index: 0.00MB + Engine InnoDB
wp_rapidload_job_data: Data: 2.38MB + Index: 0.03MB + Engine InnoDB
wp_rapidload_job_optimizations: Data: 1.50MB + Index: 0.02MB + Engine InnoDB
wp_rapidload_uucss_job: Data: 0.22MB + Index: 0.00MB + Engine InnoDB
wp_rapidload_uucss_rule: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_revslider_css: Data: 0.13MB + Index: 0.03MB + Engine InnoDB
wp_revslider_css_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_revslider_layer_animations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_revslider_layer_animations_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_revslider_navigations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_revslider_navigations_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_revslider_sliders: Data: 0.03MB + Index: 0.03MB + Engine InnoDB
wp_revslider_sliders_bkp: Data: 0.03MB + Index: 0.00MB + Engine InnoDB
wp_revslider_slides: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_revslider_slides_bkp: Data: 0.05MB + Index: 0.00MB + Engine InnoDB
wp_revslider_static_slides: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_revslider_static_slides_bkp: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_smush_dir_images: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_snippets: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_term_relationships: Data: 0.36MB + Index: 0.20MB + Engine InnoDB
wp_term_taxonomy: Data: 0.06MB + Index: 0.03MB + Engine InnoDB
wp_termmeta: Data: 0.14MB + Index: 0.13MB + Engine InnoDB
wp_terms: Data: 0.05MB + Index: 0.03MB + Engine InnoDB
wp_usermeta: Data: 10.52MB + Index: 8.03MB + Engine InnoDB
wp_users: Data: 1.52MB + Index: 0.36MB + Engine InnoDB
wp_vivawallet_data: Data: 0.14MB + Index: 0.00MB + Engine InnoDB
wp_wc_admin_note_actions: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_admin_notes: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_category_lookup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_customer_lookup: Data: 1.52MB + Index: 1.69MB + Engine InnoDB
wp_wc_download_log: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_order_addresses: Data: 7.52MB + Index: 7.06MB + Engine InnoDB
wp_wc_order_coupon_lookup: Data: 0.09MB + Index: 0.13MB + Engine InnoDB
wp_wc_order_operational_data: Data: 5.52MB + Index: 3.03MB + Engine InnoDB
wp_wc_order_product_lookup: Data: 9.52MB + Index: 7.06MB + Engine InnoDB
wp_wc_order_stats: Data: 3.52MB + Index: 3.48MB + Engine InnoDB
wp_wc_order_tax_lookup: Data: 2.52MB + Index: 1.97MB + Engine InnoDB
wp_wc_orders: Data: 11.52MB + Index: 13.97MB + Engine InnoDB
wp_wc_orders_meta: Data: 136.67MB + Index: 127.66MB + Engine InnoDB
wp_wc_points_rewards_user_points: Data: 0.02MB + Index: 0.03MB + Engine InnoDB
wp_wc_points_rewards_user_points_log: Data: 0.02MB + Index: 0.05MB + Engine InnoDB
wp_wc_product_attributes_lookup: Data: 3.31MB + Index: 3.30MB + Engine InnoDB
wp_wc_product_download_directories: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_product_meta_lookup: Data: 3.52MB + Index: 3.36MB + Engine InnoDB
wp_wc_rate_limits: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_reserved_stock: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wc_tax_rate_classes: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wc_webhooks: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_wcpdf_invoice_number: Data: 1.52MB + Index: 0.00MB + Engine InnoDB
wp_wcpdf_packing_slip_number: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wdr_order_discounts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wdr_order_item_discounts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wdr_rules: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wmfo_fraud_attempts: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wmfo_logs: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woocommerce_shipping_table_rates: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_woodmart_wishlist_products: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_woodmart_wishlists: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpae_blocked_ip: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpae_spam_data: Data: 0.19MB + Index: 0.00MB + Engine InnoDB
wp_wpae_spammer_ip: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpae_submission_id: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpfm_backup: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpmailsmtp_debug_events: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpmailsmtp_tasks_meta: Data: 0.02MB + Index: 0.00MB + Engine InnoDB
wp_wpr_rocket_cache: Data: 0.09MB + Index: 0.14MB + Engine InnoDB
wp_wpr_rucss_used_css: Data: 0.02MB + Index: 0.09MB + Engine InnoDB
wp_yoast_indexable: Data: 1.52MB + Index: 0.22MB + Engine InnoDB
wp_yoast_indexable_hierarchy: Data: 0.08MB + Index: 0.16MB + Engine InnoDB
wp_yoast_migrations: Data: 0.02MB + Index: 0.02MB + Engine InnoDB
wp_yoast_primary_term: Data: 0.06MB + Index: 0.06MB + Engine InnoDB
wp_yoast_seo_links: Data: 0.08MB + Index: 0.03MB + Engine InnoDB

Post Type Counts

attachment: 825
cms_block: 16
custom_css: 1
mc4wp-form: 1
nav_menu_item: 81
oembed_cache: 13
page: 22
post: 17
product: 561
product_variation: 22023
shop_coupon: 26
shop_order: 26736
shop_order_refund: 86
vg_gateway_condition: 3
wp_navigation: 1
wp_template: 2
wpcf7_contact_form: 1

Security

Secure connection (HTTPS): ✔
Hide errors from visitors: ✔

Active Plugins (40)

Akismet Anti-spam: Spam Protection: by Automattic - Anti-spam Team – 5.3.1
Autoptimize: by Frank Goossens (futtta) – 3.1.11
Cloudflare: by Cloudflare
Inc. – 4.12.6

Code Snippets: by Code Snippets Pro – 3.6.4
Complianz Privacy Suite (GDPR/CCPA) premium: by Really Simple Plugins – 7.0.8
Conditional Payment Methods For WooCommerce: by StoreApps – 4.1.0
Contact Form 7: by Takayuki Miyoshi – 5.9.2
GTM4WP - A Google Tag Manager (GTM) plugin for WordPress: by Thomas Geiger – 1.20
Free Shipping Label: by Devnet – 3.0.2
WP Armour - Honeypot Anti Spam: by Dnesscarkey – 2.1.18
WPBakery Page Builder: by Michael M - WPBakery.com – 7.5
Mailchimp for WooCommerce: by Mailchimp – 3.7
MC4WP: Mailchimp for WordPress: by ibericode – 4.9.11
Slider Revolution: by ThemePunch – 6.6.20
AG Opayo (Formerly SagePay) Server - WooCommerce Gateway: by Aaron Bowie – 1.6.4
Simple Cloudflare Turnstile: by Elliot Sowersby
RelyWP – 1.25.0

Trustpilot-reviews: by Trustpilot – 2.5.925
Unbranded E Liquid Formula Calculator: by ZHORA Studio – 1.0
RapidLoad 2.2 - Speed Monster in One Plugin: by RapidLoad – 2.2.15
UpdraftPlus - Backup/Restore: by UpdraftPlus.Com
DavidAnderson – 2.24.1.26

User Role Editor: by Vladimir Garagulya – 4.64.2
Viva Wallet Smart Checkout: by Viva Wallet – 3.6.8
WooCommerce Dynamic Pricing & Discounts: by RightPress – 2.4.6
Premmerce Permalink Manager for WooCommerce: by Premmerce – 2.3.11
Country Based Restrictions for WooCommerce: by zorem – 3.6.1
PDF Invoices & Packing Slips for WooCommerce: by WP Overnight – 3.8.0
PDF Invoices & Packing Slips for WooCommerce - Premium Templates: by WP Overnight – 2.21.5
Product SKU Generator for WooCommerce: by SkyVerge – 2.5.0
WooCommerce Store Credit: by KoiLab – 4.5.1
WooCommerce Table Rate Shipping: by WooCommerce – 3.1.6
WooCommerce Xero Integration: by WooCommerce – 1.8.4
WooCommerce: by Automattic – 8.6.1
Woodmart Core: by – 1.0.42
Yoast SEO: by Team Yoast – 22.2
WP Armour Extended - Honeypot Anti Spam: by Dnesscarkey – 1.26
WP Mail SMTP: by WP Mail SMTP – 4.0.1
WP Rocket - D-bugger: by WP Rocket Support Team –
WP Rocket: by WP Media – 3.15.9
Smush: by WPMU DEV – 3.15.5
WPS Hide Login: by WPServeur
NicolasKulka
wpformation – 1.9.13.2

Inactive Plugins (0)

Dropin Plugins (1)

advanced-cache.php: advanced-cache.php

Settings

API Enabled: –
Force SSL: –
Currency: GBP (£)
Currency Position: left
Thousand Separator: ,
Decimal Separator: .
Number of Decimals: 2
Taxonomies: Product Types: external (external)
grouped (grouped)
simple (simple)
store_credit (store_credit)
variable (variable)

Taxonomies: Product Visibility: exclude-from-catalog (exclude-from-catalog)
exclude-from-search (exclude-from-search)
featured (featured)
outofstock (outofstock)
rated-1 (rated-1)
rated-2 (rated-2)
rated-3 (rated-3)
rated-4 (rated-4)
rated-5 (rated-5)

Connected to Woo.com: –
Enforce Approved Product Download Directories: –
HPOS feature screen enabled: ✔
HPOS feature enabled: ✔
Order datastore: Automattic\WooCommerce\Internal\DataStores\Orders\OrdersTableDataStore
HPOS data sync enabled: ✔

WC Pages

Shop base: #15 - /shop/
Basket: #16 - /basket/
Checkout: #17 - /checkout/
My account: #18 - /my-account/
Terms and conditions: #33 - /terms-conditions/

Theme

Name: Woodmart Child
Version: 1.0.0
Author URL: http://xtemos.com
Child Theme: ✔
Parent Theme Name: Woodmart
Parent Theme Version: 7.4.3
Parent Theme Author URL: http://themeforest.net/user/xtemos
WooCommerce Support: ✔

Templates

Overrides: woodmart/woocommerce/archive-product.php
woodmart/woocommerce/cart/cart-item-data.php
woodmart/woocommerce/cart/cart.php
woodmart/woocommerce/cart/cross-sells.php
woodmart/woocommerce/cart/mini-cart.php
woodmart/woocommerce/checkout/form-checkout.php
woodmart/woocommerce/checkout/thankyou.php
woodmart/woocommerce/content-product-cat.php
woodmart/woocommerce/content-product.php
woodmart/woocommerce/content-single-product.php
woodmart/woocommerce/content-widget-product.php
woodmart-child/woocommerce/emails/customer-completed-order.php
woodmart-child/woocommerce/emails/customer-processing-order.php
woodmart-child/woocommerce/emails/email-styles.php
woodmart/woocommerce/global/breadcrumb.php
woodmart/woocommerce/global/form-login.php
woodmart/woocommerce/global/quantity-input.php
woodmart/woocommerce/loop/add-to-cart.php
woodmart/woocommerce/loop/loop-end.php
woodmart/woocommerce/loop/loop-start.php
woodmart/woocommerce/loop/no-products-found.php
woodmart/woocommerce/loop/orderby.php
woodmart/woocommerce/loop/pagination.php
woodmart/woocommerce/loop/sale-flash.php
woodmart/woocommerce/myaccount/form-login.php
woodmart/woocommerce/product-searchform.php
woodmart/woocommerce/single-product/add-to-cart/grouped.php
woodmart/woocommerce/single-product/add-to-cart/variable.php
woodmart/woocommerce/single-product/meta.php
woodmart/woocommerce/single-product/product-attributes.php
woodmart/woocommerce/single-product/product-image.php
woodmart/woocommerce/single-product/product-thumbnails.php
woodmart/woocommerce/single-product/rating.php
woodmart/woocommerce/single-product/related.php
woodmart/woocommerce/single-product/sale-flash.php
woodmart/woocommerce/single-product/tabs/description.php
woodmart/woocommerce/single-product/tabs/tabs.php
woodmart/woocommerce/single-product/title.php
woodmart/woocommerce/single-product/up-sells.php
woodmart/woocommerce/single-product-reviews.php
woodmart/woocommerce/single-product.php

Admin

Enabled Features: activity-panels
analytics
product-block-editor
coupons
core-profiler
customer-effort-score-tracks
import-products-task
experimental-fashion-sample-products
shipping-smart-defaults
shipping-setting-tour
homescreen
marketing
mobile-app-banner
navigation
onboarding
onboarding-tasks
product-variation-management
product-virtual-downloadable
product-external-affiliate
product-grouped
product-linked
remote-inbox-notifications
remote-free-extensions
payment-gateway-suggestions
shipping-label-banner
subscriptions
store-alerts
transient-notices
woo-mobile-welcome
wc-pay-promotion
wc-pay-welcome-page

Disabled Features: customize-store
minified-js
new-product-management-experience
product-pre-publish-modal
settings
async-product-editor-category-field

Daily Cron: ✔ Next scheduled: 2024-03-19 00:19:12 +00:00
Options: ✔
Notes: 9
Onboarding: completed

Action Scheduler

Complete: 44,877
Oldest: 2024-02-16 16:35:46 +0000
Newest: 2024-03-18 16:27:45 +0000

Pending: 719
Oldest: 2024-03-18 15:18:58 +0000
Newest: 2024-03-25 14:00:41 +0000

Store Credit

Prices entered with tax: yes
Show My Account: yes
Delete after use: yes
Individual use: yes
Include tax: no
Apply to shipping: yes
Coupon code format: {coupon_code}
Overrides: -

Status report information

Generated at: 2024-03-18 16:28:10 +00:00
`

@alexmigf
Copy link
Member Author

alexmigf commented Mar 18, 2024

I also got the same issue:

Screenshot from 2024-03-18 16-30-38

Log message:

PHP Fatal error: Maximum execution time of 30 seconds exceeded in /woocommerce/includes/class-wc-meta-data.php on line 43

We might need to improve the query to be quicker, and maybe cache the results.

@alexmigf
Copy link
Member Author

This seems a bit quicker:

// add document title or 'Deleted'
if ( ! empty( $results ) && ! empty( $document_type ) ) {
	$document_titles = WPO_WCPDF()->documents->get_document_titles();
	
	foreach ( $results as $key => $result ) {
		$result         = (array) $result;
		$document_types = array( $document_type );
		$order_id       = isset( $result['order_id'] ) ? absint( $result['order_id'] ) : 0;
		
		if ( 0 === $order_id ) {
			continue;
		}
		
		$order = wc_get_order( $order_id );
		
		if ( empty( $order ) ) {
			continue;
		}
		
		if ( 'invoice' === $document_type && ! empty( $invoice_number_store_doc_types ) ) {
			$document_types = array_merge( $document_types, $invoice_number_store_doc_types );
		}
		
		foreach ( $document_types as $doc_type ) {
			$meta_number = $order->get_meta( '_wcpdf_'.$doc_type.'_number', true );
			
			if ( ! empty( $meta_number ) &&  isset( $result['id'] ) && absint( $result['id'] ) === absint( $meta_number ) ) {
				$results[ $key ]->document_title = $document_titles[ $doc_type ];
			}
		}
	}
}

But I think we should limit the number of recent orders with an input.

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

Successfully merging a pull request may close this issue.

4 participants