• Resolved markmont

    (@markmont)


    Hi, we’ve been getting the following error a lot. Website visitors get an error when this happens.

    [Fri Nov 03 09:30:51.316295 2023] [php:error] [pid 1381830] [client x.x.x.x:0] PHP Fatal error:  Allowed memory size of 536870912 bytes exhausted (tried to allocate 54883587 bytes) in /.../wp-includes/class-wpdb.php on line 2459
    • Hummingbird plugin version: 3.6.0
    • WordPress version: 6.3.2
    • PHP version: 8.1

    We’ve tried adding the MU plugin code given as the solution in another post, but that did not fix the problem:

    <?php
    
    add_action( 'plugins_loaded', function() {
    	if ( ! defined( 'WPHB_VERSION' ) ) {
    		return; // Hummingbird is not installed/enabled.
    	}
    	add_action( 'pre_get_posts', function( $query ) {
    		if ( ! empty( $query->query['post_type'] ) && 'wphb_minify_group' === $query->query['post_type'] ) {
    			if ( -1 === $query->query['posts_per_page'] ) {
    				$query->query['posts_per_page']      = 10;
    				$query->query_vars['posts_per_page'] = 10;
    			}
    		}
    	});
    });

    SELECT COUNT(ID) FROM wp_posts WHERE post_type = 'wphb_minify_group'; returns 1,474 matching posts.

    The error does not occur if we disable the Hummingbird plugin and install WP Fastest Cache instead, but it comes back again if we disable WP Fastest Cache and activate Hummingbird.

    Any ideas? I’ve asked for the Site Health info, and will post it here as soon as I get it.

    The page I need help with: [log in to see the link]

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Patrick – WPMU DEV Support

    (@wpmudevsupport12)

    Hi @markmont

    Sorry to hear you are having this issue.

    Could you please check the number of Assets you have in Hummingbird > Assets Optimization, in case it is a huge number for example more than 200 files, kindly switch to manual mode and see if any file isn’t being repeated there.

    Do you see any huge number of orphan data in Hummingbird > Advanced Tools > Plugin health?

    Best Regards
    Patrick Freitas

    Thread Starter markmont

    (@markmont)

    Thanks for the reply Patrick! I will get this information from the website owner and post it here. It won’t be until later this week since they currently have Hummingbird deactivated — I’ll need to arrange a low-traffic time with them to re-activate the plugin and get this information.

    Thread Starter markmont

    (@markmont)

    Hi, Patrick, thanks for your help!

    Hummingbird > Assets Optimization shows 28,635 assets. But every time the team tried to switch it to Manual it would crash.

    Orphan data in Hummingbird > Advanced Tools > Plugin health is only 35.

    Here is the Site Health information, with some sensitive details replaced with “…”

    ### wp-core ###
    
    version: 6.3.2
    site_language: en_US
    user_language: en_US
    timezone: America/Detroit
    permalink: /%year%/%monthnum%/%postname%/
    https_status: true
    multisite: false
    user_registration: 0
    blog_public: 1
    default_comment_status: closed
    environment_type: production
    user_count: 9
    dotorg_communication: true
    
    ### wp-paths-sizes ###
    
    wordpress_path: /.../web
    wordpress_size: 484.86 MB (508414756 bytes)
    uploads_path: /.../web/wp-content/uploads
    uploads_size: 6.24 GB (6703769157 bytes)
    themes_path: /.../web/wp-content/themes
    themes_size: 9.13 MB (9572105 bytes)
    plugins_path: /.../web/wp-content/plugins
    plugins_size: 45.35 MB (47556034 bytes)
    database_size: 238.73 MB (250329660 bytes)
    total_size: 7.00 GB (7519641712 bytes)
    
    ### wp-dropins (1) ###
    
    advanced-cache.php: true
    
    ### wp-active-theme ###
    
    name: Michigan Creative WP theme (creative-wp-theme)
    version: 1.0
    author: Michigan Creative
    author_website: (undefined)
    parent_theme: none
    theme_features: menus, widgets-block-editor, custom-logo, title-tag, post-thumbnails
    theme_path: /.../web/wp-content/themes/creative-wp-theme
    auto_update: Disabled
    
    ### wp-plugins-active (14) ###
    
    Advanced Custom Fields PRO: version: 6.2.1.1, author: WP Engine (latest version: 6.2.2), Auto-updates disabled
    Broken Link Checker: version: 2.2.3, author: WPMU DEV, Auto-updates disabled
    Enable Media Replace: version: 4.1.4, author: ShortPixel, Auto-updates disabled
    GTranslate: version: 3.0.4, author: Translate AI Multilingual Solutions, Auto-updates disabled
    Hummingbird: version: 3.6.0, author: WPMU DEV, Auto-updates disabled
    Native PHP Sessions for WordPress: version: 1.4.1, author: Pantheon, Auto-updates disabled
    Redirection: version: 5.3.10, author: John Godley, Auto-updates disabled
    Site Kit by Google: version: 1.111.1, author: Google, Auto-updates enabled
    SSH SFTP Updater Support: version: 0.8.5, author: TerraFrost, David Anderson + Team Updraft, Auto-updates disabled
    UMich OIDC Login: version: 1.2.0, author: Regents of the University of Michigan, Auto-updates disabled
    University of Michigan: Events: version: 1.3.2, author: U-M: Digital, Auto-updates disabled
    User Login History: version: 2.1.2, author: Er Faiyaz Alam, Auto-updates disabled
    WP All Import Pro: version: 4.8.5, author: Soflyy, Auto-updates disabled
    Yoast Duplicate Post: version: 4.5, author: Enrico Battocchi & Team Yoast, Auto-updates disabled
    
    ### wp-media ###
    
    image_editor: WP_Image_Editor_Imagick
    imagick_module_version: 1692
    imagemagick_version: ImageMagick 6.9.12-97 Q16 x86_64 18022 https://legacy.imagemagick.org
    imagick_version: 3.7.0
    file_uploads: File uploads is turned off
    post_max_size: 16M
    upload_max_filesize: 16M
    max_effective_size: 16 MB
    max_file_uploads: 20
    imagick_limits:
    	imagick::RESOURCETYPE_AREA: 125 GB
    	imagick::RESOURCETYPE_DISK: 9.2233720368548E+18
    	imagick::RESOURCETYPE_FILE: 3072
    	imagick::RESOURCETYPE_MAP: 62 GB
    	imagick::RESOURCETYPE_MEMORY: 31 GB
    	imagick::RESOURCETYPE_THREAD: 1
    	imagick::RESOURCETYPE_TIME: 9.2233720368548E+18
    imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FLV, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPEG, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
    gd_version: 2.3.3
    gd_formats: GIF, JPEG, PNG, WebP, BMP, AVIF, XPM
    ghostscript_version: not available
    
    ### wp-server ###
    
    server_architecture: Linux 4.18.0-477.21.1.el8_8.x86_64 x86_64
    httpd_software: Apache
    php_version: 8.1.24 64bit
    php_sapi: apache2handler
    max_input_variables: 1000
    time_limit: 30
    memory_limit: 512M
    max_input_time: 60
    upload_max_filesize: 16M
    php_post_max_size: 16M
    curl_version: 7.61.1 OpenSSL/1.1.1k
    suhosin: false
    imagick_availability: true
    pretty_permalinks: true
    htaccess_extra_rules: true
    current: 2023-11-06T17:28:49+00:00
    utc-time: Monday, 06-Nov-23 17:28:49 UTC
    server-time: 2023-11-06T12:28:48-05:00
    
    ### wp-database ###
    
    extension: mysqli
    server_version: 8.0.32
    client_version: mysqlnd 8.1.24
    max_allowed_packet: 268435456
    max_connections: 700
    
    ### wp-constants ###
    
    WP_HOME: undefined
    WP_SITEURL: undefined
    WP_CONTENT_DIR: /.../web/wp-content
    WP_PLUGIN_DIR: /.../web/wp-content/plugins
    WP_MEMORY_LIMIT: 40M
    WP_MAX_MEMORY_LIMIT: 512M
    WP_DEBUG: false
    WP_DEBUG_DISPLAY: true
    WP_DEBUG_LOG: false
    SCRIPT_DEBUG: false
    WP_CACHE: true
    CONCATENATE_SCRIPTS: undefined
    COMPRESS_SCRIPTS: undefined
    COMPRESS_CSS: undefined
    WP_ENVIRONMENT_TYPE: Undefined
    WP_DEVELOPMENT_MODE: undefined
    DB_CHARSET: utf8
    DB_COLLATE: undefined
    
    ### wp-filesystem ###
    
    wordpress: not writable
    wp-content: not writable
    uploads: writable
    plugins: not writable
    themes: not writable
    
    ### google-site-kit ###
    
    version: 1.111.1
    php_version: 8.1.24
    wp_version: 6.3.2
    reference_url: https://diversity.umich.edu
    amp_mode: no
    site_status: connected-site
    user_status: not authenticated
    verification_status: not-verified
    connected_user_count: 2
    active_modules: site-verification, search-console, analytics, analytics-4, pagespeed-insights
    recoverable_modules: none
    required_scopes:
    	openid: a?
    	https://www.googleapis.com/auth/userinfo.profile: a?
    	https://www.googleapis.com/auth/userinfo.email: a?
    	https://www.googleapis.com/auth/siteverification: a?
    	https://www.googleapis.com/auth/webmasters: a?
    	https://www.googleapis.com/auth/analytics.readonly: a?
    	https://www.googleapis.com/auth/tagmanager.readonly: a?
    capabilities:
    	googlesitekit_authenticate: a?…
    	googlesitekit_setup: a?…
    	googlesitekit_view_posts_insights: a?
    	googlesitekit_view_dashboard: a?
    	googlesitekit_manage_options: a?
    	googlesitekit_update_plugins: a?
    	googlesitekit_view_splash: a?…
    	googlesitekit_view_authenticated_dashboard: a?
    	googlesitekit_view_wp_dashboard_widget: a?
    	googlesitekit_view_admin_bar_menu: a?
    	googlesitekit_view_shared_dashboard: a?
    	googlesitekit_read_shared_module_data::["search-console"]: a?
    	googlesitekit_read_shared_module_data::["analytics-4"]: a?
    	googlesitekit_read_shared_module_data::["pagespeed-insights"]: a?
    	googlesitekit_manage_module_sharing_options::["search-console"]: a?
    	googlesitekit_manage_module_sharing_options::["analytics-4"]: a?
    	googlesitekit_manage_module_sharing_options::["pagespeed-insights"]: a?
    	googlesitekit_delegate_module_sharing_management::["search-console"]: a?
    	googlesitekit_delegate_module_sharing_management::["analytics-4"]: a?
    	googlesitekit_delegate_module_sharing_management::["pagespeed-insights"]: a?
    enabled_features:
    	adsenseSetupV2: a?…
    	enhancedMeasurement: a?
    	ga4Reporting: a?…
    	gm3Components: a?
    	newsKeyMetrics: a?
    	userInput: a?
    search-console_shared_roles: none
    search-console_management: owner
    analytics-4_shared_roles: none
    analytics-4_management: owner
    pagespeed-insights_shared_roles: none
    pagespeed-insights_management: all_admins
    search_console_property: https://diversity.umich.edu/
    analytics_account_id: 27...
    analytics_property_id: none
    analytics_profile_id: none
    analytics_use_snippet: yes
    analytics_4_property_id: 35...
    analytics_4_web_data_stream_id: 46..
    analytics_4_measurement_id: G-CT...
    analytics_4_use_snippet: yes
    Plugin Support Williams – WPMU DEV Support

    (@wpmudev-support8)

    Hi @markmont

    Thank you for response!

    Nearly 27,000 assets is enormously high number and definitely shows that Asset Optimization in this case is not working correctly.

    Usually it means that there is “something” on site that causes it to incorrectly detect – usually dynamically generated or dynamically loaded – assets. Commonly that’d be associated with things such as:

    – conflicts with other JS/CSS optimization tools/features (e.g. other similar plugisn) on site
    – some unusual or misconfigured page builder
    – issues (related to access permissions or conflict with other plugins) with correct handling of data in DB
    – or incorrectly functioning cron or action scheduler
    – sometimes it may also be due to server-side cache that’s either malfunctioning or not fully/properly integrated with site itself.

    Basically, it looks like Asset Optimization is (re)generating optimized assets all over again without updating/removing any removed/changed ones.

    —-

    Another – very rare – but important case is when Hummingbird cannot write optimized files to the file system.

    When plugin optimizes a file it does not “edit” CSS/JS file content “on the fly” but rather than this it saves optimized files into the /wp-content/uploads/hummingbird-assets folder and then it changes how site loads those files so it would load those saved ones instead of originals.

    Technically speaking:
    – files are analyzed and optimization actions (such as e.g. code minification/compression and combining multiple files togehter) are performed
    – information about processed assets are saved into DB (“wphb_minify_group” records)
    – optimized file is saved to aforementioned folder

    If it can’t save the file it will not be able to find them also when minification happens and may try to opimize them over and over again as if they were new files.

    I noticed that your /wp-content/ folder is currently not writable and that is very likely to be the cause of the issue. You have an SSH SFTP Updater Support plugin installed and I suppose you may have SSH configured in wp-config.php file via the FS_METHOD definition.

    Is that right? Or do you have SFTP configured in wp-config.php?

    If it’s SFTP – is there only FS_METHOD set or are there full credentials defined?

    I’m asking because if the /wp-content/ folder is not writable and you only have FS_METHOD defined but no crednetials (and instead use some 3rd-party plugin) it’s quite likely simply impossible for Hummingbird (and quite likely other plugins too) to write to /uploads folder and that would cause multiple issues, including issues with Asset Optimization.

    So the first thing to check here would be to make sure that site is configured in a way that allows plugin(s) to write to /wp-content/uploads folder. Once that’s done you would need to actually reset Asset Optimization so it would clear up all of its own data in DB and re-discover assets on site.

    Kind regards,
    Adam

    [Update]

    Just to clarify:

    1. I mentioned credentials configured in addition to FS_METHOD in wp-config. I’m sorry as I made it a bit unclear: I didn’t mean putting any credentials in “wp-config.php” file directly but rather making sure that if FS_METHOD is set – making sure that credentials are also added in site configuration in site’s back-end

    2. Also, even if configured, it may still sometimes prevent Hummingbird form being able to directly write to files, depending on what FS_METHOD is set – so which one is configured?

    Thread Starter markmont

    (@markmont)

    Hi, Adam — thanks for the very helpful reply. You are correct that the wp-content folder is not writable for security reasons, but within that folder, the uploads, wphb-cache, and wphb-logs folders are writable and within the uploads folder, the hummingbird-assets folder is also writable (114291149 below is the user ID that the web server runs as). The timestamp on the directory is from when we briefly re-enabled Hummingbird for testing yesterday, showing that Hummingbird did something there, but there are only two files in the directory (I expected many more) and the files were created more than a month ago.

    $ pwd
    /.../web/wp-content
    $ ls -ld uploads/hummingbird-assets/
    drwxr-xr-x. 2 114291149 apache 421888 Nov  6 12:36 uploads/hummingbird-assets/
    $ ls -l uploads/hummingbird-assets/
    total 161
    -rw-r--r--. 1 114291149 apache  59152 Oct  6 12:58 0af8e64a2b79d2097b64333c762b8ad1.css
    -rw-r--r--. 1 114291149 apache 104516 Oct  6 12:58 a0b6bdbec23ca11530095bba8b645ba2.css
    $

    When investigating today, I found that the total size of the website is 26 GB and there is only 3.6 GB space remaining in the filesystem quota. Just in case Hummingbird was trying to generate more than 3 GB of assets, I’m having the filesystem quota increased today (25 additional GB of space added, to give us 28 GB free space), we’ll reactivate Hummingbird, reset Asset Optimization, and then we’ll re-test things. We have not seen any out of disk space errors, though — just PHP memory limit exceeded errors.

    FS_METHOD is set to ‘ssh2′ in wp-config.php. There are no credentials in that file, database, or elsewhere — the ssh-sftp-updater-support plugin prompts for credentials when updating plugins and themes (wp-content and the plugin and themes sub-folders are not writable by the web server for security reasons). Since we only need this for updating WordPress core, plugins, and themes (and we don’t need to do those things right now), we’ll comment out this line in wp-config.php so that WordPress’ get_filesystem_method function will return ‘direct’, and see if that helps.

    Here are responses for the other things you listed:

    • conflicts with other JS/CSS optimization tools/features (e.g. other similar plugisn) on site — there are no other optimization plugins installed. We did originally use WP Fastest Cache before we switched to Hummingbird, but WP Fastested cache was deactivated and removed.
    • some unusual or misconfigured page builder — there is no page builder (such as Divi or Elementor) installed. We’re using Gutenberg.
    • issues (related to access permissions or conflict with other plugins) with correct handling of data in DB — we’ll see if increasing disk quota, commenting out the FS_METHOD define, and resetting Hummingbird Asset Optimization fixes things. I’m not aware of any plugins that would conflict (you have a list from our Site Health report), but I’ll keep an eye out for the possibility and we may try temporarily disabling other plugins to see if the problem goes away.
    • incorrectly functioning cron or action schedulerwp cron test returns “Success: WP-Cron spawning is working as expected.” and things such as version checks, upgrade checks, and expired transient deletions are all things we have observed to be working.
    • sometimes it may also be due to server-side cache that’s either malfunctioning or not fully/properly integrated with site itself — the only server-side cache is Hummingbird itself (no Varnish, no Redis or other object cache, and no other page cache plugin) although we do have the Cloudflare integration for Hummingbird configured and the site is behind Cloudflare.

    To summarize, our plan for right now is to do the following later today:

    1. Increase the disk quota substantially (add another 25 GB space so there will be 28 GB free space in total)
    2. Temporarily comment out the FS_METHOD define in wp-config.php
    3. Reactivate Hummingbird
    4. Reset Hummingbird Asset Optimization
    5. See if the problem happens again

    If I missed anything, got something wrong, or there is something else you can think of, please let me know. Thanks again for all your help on this, we really appreciate it!

    Thread Starter markmont

    (@markmont)

    We’ve done the steps above and so far Hummingbird is working. We’ve gone from two files in wp-content/uploads/hummingbird-assets/ about an hour ago to xxx files right now, and the number is continuing to grow.

    We originally had this problem with Hummingbird 3.5.0 and disabled the plugin until we could investigate. But then Hummingbird 3.6.0 came out, we upgraded, and everything worked fine for over two weeks, until we encountered the problem again and posted here in the forums. So although everything is looking better right now, we’re going to wait until the end of the month before considering the issue resolved on our end. Feel free to close this forum post in the meantime, if you like.

    Thanks again for your time and work in taking a look at this for us and flagging FS_METHOD being set to ssh2 as an issue and suggesting that we reset Hummingbird Asset Optimization.

    Plugin Support Nithin – WPMU DEV Support

    (@wpmudevsupport11)

    Hi @markmont,

    Glad to hear it’s working fine, however, I noticed you have the GTranslate plugin, there might be a possibility that the issue might be correlated to the Gtranslate plugin.

    Maybe you could switch to “Manual” mode in Asset Optimizaion ue under Hummingbird > Asset Optimization page and check whether there are any assets related to GTranslate getting listed repeatedly.

    We have recently noticed issues regarding the mentioned plugin, so in case you happen to replicate the issue again, please do check whether the following snippet helps or not too:
    https://gist.github.com/wpmudev-sls/d9e5f8b1b6bcf724eec79c1ecb71826d

    The above can be added as a mu-plugin. Please check this link on how to implement the above code as a mu-plugins:
    https://wpmudev.com/docs/using-wordpress/installing-wordpress-plugins/#installing-mu-plugins

    Regards,

    Nithin

    Plugin Support Kris – WPMU DEV Support

    (@wpmudevsupport13)

    Hi @markmont

    We haven’t heard from you in a while, I’ll go and mark this thread as resolved. If you have any additional questions or require further help, please let us know!

    Kind Regards,
    Kris

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘PHP memory limit error’ is closed to new replies.