Opened 22 months ago
Last modified 22 months ago
#55289 new defect (bug)
Large image fails to create a `scaled` version and subsizes
Reported by: |
|
Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 5.9.1 |
Component: | Media | Keywords: | |
Focuses: | Cc: |
Description
When uploading a large image into WordPress it fails to create the scaled
version, due to the usage of too many resources, because the -scaled
resized version can't be created, no additional subsize is created.
The resize fails with the following error message:
cache resources exhausted
Even with the resized failure, only the full-size image is uploaded and no additional image sizes are generated.
Steps to recreate the problem:
- Upload the provided image.
- Inspect the metadata of the image and observe no
-scaled
version was created and no subsizes was created either.
Observe how only the full image size is uploaded, no -scaled
version can't be found.
Problems
- As described before the full size image is uploaded and no
scaled
version is created. - When loading the media library the full image size is loaded due no subsizes were created.
- No subsizes are created for this image due to the resized image failing to be created.
Setup
Sharing the details of my current setup:
### wp-core ### version: 5.9.1 site_language: en_US user_language: en_US timezone: +00:00 permalink: /%year%/%monthnum%/%day%/%postname%/ https_status: true multisite: false user_registration: 0 blog_public: 1 default_comment_status: open environment_type: production user_count: 1 dotorg_communication: true ### wp-paths-sizes ### wordpress_path: /app wordpress_size: 152.90 MB (160327567 bytes) uploads_path: /app/wp-content/uploads uploads_size: 22.75 MB (23851112 bytes) themes_path: /app/wp-content/themes themes_size: 6.47 MB (6780262 bytes) plugins_path: /app/wp-content/plugins plugins_size: 208.42 MB (218539593 bytes) database_size: 3.96 MB (4149380 bytes) total_size: 394.49 MB (413647914 bytes) ### wp-active-theme ### name: Twenty Twenty-Two (twentytwentytwo) version: 1.0 (latest version: 1.1) author: the WordPress team author_website: https://wordpress.org/ parent_theme: none theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, block-templates, widgets-block-editor, wp-block-styles, editor-style theme_path: /app/wp-content/themes/twentytwentytwo auto_update: Disabled ### wp-themes-inactive (3) ### Twenty Nineteen: version: 2.2, author: the WordPress team, Auto-updates disabled Twenty Twenty: version: 1.9, author: the WordPress team, Auto-updates disabled Twenty Twenty-One: version: 1.5, author: the WordPress team, Auto-updates disabled ### wp-plugins-inactive (1) ### Performance Lab: version: 1.0.0-beta.1, author: WordPress Performance Group, Auto-updates disabled ### wp-media ### image_editor: WP_Image_Editor_Imagick imagick_module_version: 1691 imagemagick_version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org imagick_version: 3.7.0 file_uploads: File uploads is turned off post_max_size: 100M upload_max_filesize: 100M max_effective_size: 100 MB max_file_uploads: 20 imagick_limits: imagick::RESOURCETYPE_AREA: 122 MB imagick::RESOURCETYPE_DISK: 1073741824 imagick::RESOURCETYPE_FILE: 786432 imagick::RESOURCETYPE_MAP: 512 MB imagick::RESOURCETYPE_MEMORY: 256 MB imagick::RESOURCETYPE_THREAD: 1 imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, 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, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HEIC, 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, 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: bundled (2.1.0 compatible) gd_formats: GIF, JPEG, PNG, WebP, BMP ghostscript_version: 9.53.3 ### wp-server ### server_architecture: Linux 5.15.12-1-MANJARO x86_64 httpd_software: nginx/1.17.10 php_version: 7.4.28 64bit php_sapi: fpm-fcgi max_input_variables: 10000 time_limit: 3 memory_limit: 1G max_input_time: 900 upload_max_filesize: 100M php_post_max_size: 100M curl_version: 7.74.0 OpenSSL/1.1.1k suhosin: false imagick_availability: true pretty_permalinks: true ### wp-database ### extension: mysqli server_version: 10.3.27-MariaDB client_version: mysqlnd 7.4.28 max_allowed_packet: 33554432 max_connections: 151 ### wp-constants ### WP_HOME: undefined WP_SITEURL: undefined WP_CONTENT_DIR: /app/wp-content WP_PLUGIN_DIR: /app/wp-content/plugins WP_MEMORY_LIMIT: 40M WP_MAX_MEMORY_LIMIT: 1G WP_DEBUG: true WP_DEBUG_DISPLAY: true WP_DEBUG_LOG: true SCRIPT_DEBUG: false WP_CACHE: false CONCATENATE_SCRIPTS: undefined COMPRESS_SCRIPTS: undefined COMPRESS_CSS: undefined WP_ENVIRONMENT_TYPE: Undefined DB_CHARSET: utf8mb4 DB_COLLATE: undefined ### wp-filesystem ### wordpress: writable wp-content: writable uploads: writable plugins: writable themes: writable mu-plugins: writable
Attachments (2)
Change History (7)
#1
@
22 months ago
@mitogh thanks for raising this issue.
in my testing, when I uploaded a VERY large image, I got an error "{file} exceeds the maximum upload size for this site." when I tested with your image, I got a server error that at least suggested I try a smaller image: "The server cannot process the image. This can happen if the server is busy or does not have enough resources to complete the task. Uploading a smaller image may help. Suggested maximum size is 2560 pixels."
How would you propose improving this?
#2
@
22 months ago
@adamsilverstein interesting I was not able to face any of those errors and the image was uploaded, the problem was that the subsizes where not created, my current size limit is 100MB tho, in my setup Imagemagick is used to process the images.
Looking into more detail (specifically into the Imagemagick implementation) looks like the problem is because it creates a larger image 5 times larger actually than the uploaded image, which for larger images like the one from this issue consumes large portion of memory.
From my point of view, when a large image is uploaded or when the image is bigger than the threshold there's no real need/benefit in resampling as images are going to be created in smaller sizes instead.
I can explore a bit more for imagemagick, but just commenting that line of code makes the rest of the subsizes work as expected. Maybe some additional logic can be added in place to consider the scenario when the resampling is not required.
#3
follow-up:
↓ 4
@
22 months ago
Interesting! The comment there implies this makes resizing more efficient..
This was introduced in https://github.com/WordPress/wordpress-develop/commit/e2d2c45c6b7ed013139be7ab8f3833750684e28d maybe we can skip doing this when the original file is already so large? cc: @mikeschroder
#4
in reply to:
↑ 3
@
22 months ago
Replying to adamsilverstein:
Interesting! The comment there implies this makes resizing more efficient..
This was introduced in https://github.com/WordPress/wordpress-develop/commit/e2d2c45c6b7ed013139be7ab8f3833750684e28d maybe we can skip doing this when the original file is already so large? cc: @mikeschroder
Thanks for the ping! I can't remember why it would make it more efficient off the top of my head, unless maybe there was more multi-sampling going on if it's not set.
I'll look into this.
Media picture to test the failure