Running attachments update never finishes
-
We have over 13K not offloaded media and just over 10K offloaded. The settings can not be updated with the message “Settings Locked — You can’t change any of your settings until the “Attachments” update has completed.”
I am seeing the possibly related message in the PHP error logs. We are running WP Offload Media Lite version 3.2.5 on PHP 8.1 with latest WordPress 6.4.2.
[21-Dec-2023 15:31:55 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /opt/bitnami/www/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade-file-sizes.php:153 Stack trace: #0 /opt/bitnami/www/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade.php(347): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade_File_Sizes->upgrade_item() #1 /opt/bitnami/www/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade.php(305): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade->upgrade_blog() #2 /opt/bitnami/www/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade.php(291): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade->run_upgrade() #3 /opt/bitnami/www/wp-includes/class-wp-hook.php(324): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade->do_upgrade() #4 /opt/bitnami/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #5 /opt/bitnami/www/wp-includes/plugin.php(565): WP_Hook->do_action() #6 /opt/bitnami/www/wp-cron.php(191): do_action_ref_array() #7 /opt/bitnami/www/wp-includes/cron.php(904): require_once('...') #8 /opt/bitnami/www/wp-includes/cron.php(1028): spawn_cron() #9 /opt/bitnami/www/wp-includes/class-wp-hook.php(324): _wp_cron() #10 /opt/bitnami/www/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters() #11 /opt/bitnami/www/wp-includes/plugin.php(517): WP_Hook->do_action() #12 /opt/bitnami/www/wp-settings.php(665): do_action() #13 /opt/bitnami/www/wp-config.php(108): require_once('...') #14 /opt/bitnami/www/wp-load.php(50): require_once('...') #15 /opt/bitnami/www/wp-blog-header.php(13): require_once('...') #16 /opt/bitnami/www/index.php(17): require('...') #17 {main} thrown in /opt/bitnami/www/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade-file-sizes.php on line 153
Everything is working otherwise with offloads happening as expected.
-
Hi there!
WP Offload Media Support Team here, thanks for reaching out with your query we would be happy to assist!
This seems to be the first time we encountered that error. The latest versions of the plugin supports PHP 8.1 and I also have the latest version of WordPress on my test site and I’m not encountering any errors.
Would you mind trying to reinstall the plugin first and see if that helps?
If the issue persists, would you mind ensuring that the loopback request test is passing in the “Tools” => “Site Health” WordPress admin page.
For troubleshooting tips, please see our Background Processes doc.
I was never able to get this resolved and trying again now after an upgrade to PHP 8.2 and doing an uninstall and reinstall of the plugin on our staging server. I see the cron job and if I run now, still seeing the same PHP Fatal error as originally posted. Everything in the background processes doc checks out okay and I did increase the time limit. The error is seen very quickly in the logs when i try to run the as3cf_cron_update_file_sizes cron job and the settings still show Settings Locked due to the Running Attachments Update. So, I decided to debug myself and found the offset referenced in the error is for
$meta['filesize']
. I added anerror_log
statement to show the ID in question, here is the complete snippet used:// Update the main file size for the attachment
$meta = get_post_meta( $item->ID, '_wp_attachment_metadata', true );
error_log( "S3 ISSUE: " . $item->ID . " - " . print_r($meta, true) );
$meta['filesize'] = $main_file_size;The last line above is where the fatal error happens. The error log showed me ID 2686 with the
$meta
array empty. I did a query of all postmeta for the ID and there is no_wp_attachment_metadata
for this record. The record is from 2015, the file does exists in Amazon S3 in the location of the_wp_attached_file
meta value. There could be more records like this with this one being the first hit causing the fatal error since 2015 was when the database was first created with data migrated from an old Ruby website. What could be a possible solution?UPDATE: I found a post suggesting the wp cli command below to regenerate thumbnails. I tried on our staging server after a good backup.
wp media regenerate --only-missing
It found over 20000 records, not all being regenerated with the above option for –only-missing. It skipped several but mostly regenerating…
<snip>
175/20146 Regenerated thumbnails for "Radford" (ID 215671).
176/20146 Regenerated thumbnails for "Firefly Dog Park Sadness 43033" (ID 215669).
177/20146 Regenerated thumbnails for "Screen Shot 2022 01 02 At 11.31.11 AM" (ID 215661).
178/20146 Regenerated thumbnails for "Screenshot 2024 03 07 At 1.33.49?PM" (ID 215659).
179/20146 Regenerated thumbnails for "032224 FB Event Cover Resized" (ID 215653).
180/20146 Regenerated thumbnails for "032224 FB Event Cover 1920×1005 Rev2" (ID 215652).
181/20146 Regenerated thumbnails for "HW2024 Website Cover Image11 1" (ID 215649).
182/20146 Regenerated thumbnails for "First Call Spring Break Flyer 3 22 2024" (ID 215648).
183/20146 Regenerated thumbnails for "DSCN4892" (ID 215645).
184/20146 Regenerated thumbnails for "Karen Holbrook" (ID 215644).After 184/20146, it hit this fatal error:
PHP Fatal error: Uncaught Error: Failed opening required '/var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Exception/ConnectException.php' (include_path='/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/core:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/core:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/archive_tar:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/console_getopt:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/pear-core-minimal/src:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/pear_exception:.:/usr/share/php') in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php:8
Stack trace: 0 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(251): DeliciousBrains\WP_Offload_Media\Providers\Storage\AWS_Provider->DeliciousBrains\WP_Offload_Media\Aws3{closure}() 1 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(184): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler{closure}() 2 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(247): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->createResource() 3 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(49): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->createStream() 4 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/Proxy.php(46): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->__invoke() 5 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/PrepareBodyMiddleware.php(31): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\Proxy::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler{closure}() 6 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Middleware.php(30): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\PrepareBodyMiddleware->__invoke() 7 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/RedirectMiddleware.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Middleware::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp{closure}() 8 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Middleware.php(58): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\RedirectMiddleware->__invoke() 9 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/HandlerStack.php(67): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Middleware::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp{closure}() 10 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Client.php(281): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\HandlerStack->__invoke() 11 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Client.php(94): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Client->transfer() 12 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/Handler/GuzzleV6/GuzzleHandler.php(36): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Client->sendAsync() 13 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/WrappedHttpHandler.php(75): DeliciousBrains\WP_Offload_Media\Aws3\Aws\Handler\GuzzleV6\GuzzleHandler->__invoke() 14 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/ClientSideMonitoring/AbstractMonitoringMiddleware.php(102): DeliciousBrains\WP_Offload_Media\Aws3\Aws\WrappedHttpHandler->__invoke() 15 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/PermanentRedirectMiddleware.php(40): DeliciousBrains\WP_Offload_Media\Aws3\Aws\ClientSideMonitoring\AbstractMonitoringMiddleware->__invoke() 16 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/PutObjectUrlMiddleware.php(38): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\PermanentRedirectMiddleware->__invoke() 17 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/Middleware.php(109): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\PutObjectUrlMiddleware->__invoke() 18 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/FulfilledPromise.php(39): DeliciousBrains\WP_Offload_Media\Aws3\Aws\Middleware::DeliciousBrains\WP_Offload_Media\Aws3\Aws{closure}() 19 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/TaskQueue.php(47): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\FulfilledPromise::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise{closure}() 20 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(209): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\TaskQueue->run() 21 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(191): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitFn() 22 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(228): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 23 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(193): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitList() 24 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 25 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Coroutine.php(63): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->wait() 26 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(209): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Coroutine->DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise{closure}() 27 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(191): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitFn() 28 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 29 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Coroutine.php(89): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->wait() 30 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/AwsClientTrait.php(43): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Coroutine->wait() 31 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(568): DeliciousBrains\WP_Offload_Media\Aws3\Aws\MultiRegionClient->execute() 32 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(134): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->openReadStream() 33 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(750): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3{closure}() 34 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(131): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->boolCall() 35 [internal function]: DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->stream_open() 36 /var/www/staging/wp-includes/media.php(5510): getimagesize() 37 /var/www/staging/wp-admin/includes/image.php(103): wp_getimagesize() 38 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/integrations/media-library.php(191): wp_get_missing_image_subsizes() 39 /var/www/staging/wp-includes/class-wp-hook.php(324): DeliciousBrains\WP_Offload_Media\Integrations\Media_Library->wp_update_attachment_metadata() 40 /var/www/staging/wp-includes/plugin.php(205): WP_Hook->apply_filters() 41 /var/www/staging/wp-includes/post.php(6579): apply_filters() 42 phar:///usr/local/bin/wp/vendor/wp-cli/media-command/src/Media_Command.php(657): wp_update_attachment_metadata() 43 phar:///usr/local/bin/wp/vendor/wp-cli/media-command/src/Media_Command.php(162): Media_Command->process_regeneration() 44 [internal function]: Media_Command->regenerate() 45 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func() 46 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}() 47 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func() 48 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke() 49 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(464): WP_CLI\Runner->run_command() 50 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1295): WP_CLI\Runner->run_command_and_exit() 51 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start() 52 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process() 53 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap() 54 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('…') 55 /usr/local/bin/wp(4): include('…') 56 {main} thrown in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php on line 8
Fatal error: Uncaught Error: Failed opening required '/var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Exception/ConnectException.php' (include_path='/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/core:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/core:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/archive_tar:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/console_getopt:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/pear-core-minimal/src:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/pear_exception:.:/usr/share/php') in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php:8
Stack trace: 0 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(251): DeliciousBrains\WP_Offload_Media\Providers\Storage\AWS_Provider->DeliciousBrains\WP_Offload_Media\Aws3{closure}() 1 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(184): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler{closure}() 2 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(247): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->createResource() 3 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/StreamHandler.php(49): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->createStream() 4 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Handler/Proxy.php(46): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\StreamHandler->__invoke() 5 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/PrepareBodyMiddleware.php(31): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler\Proxy::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Handler{closure}() 6 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Middleware.php(30): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\PrepareBodyMiddleware->__invoke() 7 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/RedirectMiddleware.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Middleware::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp{closure}() 8 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Middleware.php(58): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\RedirectMiddleware->__invoke() 9 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/HandlerStack.php(67): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Middleware::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp{closure}() 10 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Client.php(281): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\HandlerStack->__invoke() 11 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Client.php(94): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Client->transfer() 12 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/Handler/GuzzleV6/GuzzleHandler.php(36): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Client->sendAsync() 13 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/WrappedHttpHandler.php(75): DeliciousBrains\WP_Offload_Media\Aws3\Aws\Handler\GuzzleV6\GuzzleHandler->__invoke() 14 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/ClientSideMonitoring/AbstractMonitoringMiddleware.php(102): DeliciousBrains\WP_Offload_Media\Aws3\Aws\WrappedHttpHandler->__invoke() 15 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/PermanentRedirectMiddleware.php(40): DeliciousBrains\WP_Offload_Media\Aws3\Aws\ClientSideMonitoring\AbstractMonitoringMiddleware->__invoke() 16 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/PutObjectUrlMiddleware.php(38): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\PermanentRedirectMiddleware->__invoke() 17 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/Middleware.php(109): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\PutObjectUrlMiddleware->__invoke() 18 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/FulfilledPromise.php(39): DeliciousBrains\WP_Offload_Media\Aws3\Aws\Middleware::DeliciousBrains\WP_Offload_Media\Aws3\Aws{closure}() 19 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/TaskQueue.php(47): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\FulfilledPromise::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise{closure}() 20 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(209): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\TaskQueue->run() 21 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(191): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitFn() 22 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(228): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 23 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(193): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitList() 24 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 25 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Coroutine.php(63): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->wait() 26 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(209): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Coroutine->DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise{closure}() 27 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(191): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitFn() 28 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 29 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Coroutine.php(89): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->wait() 30 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/AwsClientTrait.php(43): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Coroutine->wait() 31 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(568): DeliciousBrains\WP_Offload_Media\Aws3\Aws\MultiRegionClient->execute() 32 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(134): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->openReadStream() 33 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(750): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3{closure}() 34 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/StreamWrapper.php(131): DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->boolCall() 35 [internal function]: DeliciousBrains\WP_Offload_Media\Aws3\Aws\S3\StreamWrapper->stream_open() 36 /var/www/staging/wp-includes/media.php(5510): getimagesize() 37 /var/www/staging/wp-admin/includes/image.php(103): wp_getimagesize() 38 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/integrations/media-library.php(191): wp_get_missing_image_subsizes() 39 /var/www/staging/wp-includes/class-wp-hook.php(324): DeliciousBrains\WP_Offload_Media\Integrations\Media_Library->wp_update_attachment_metadata() 40 /var/www/staging/wp-includes/plugin.php(205): WP_Hook->apply_filters() 41 /var/www/staging/wp-includes/post.php(6579): apply_filters() 42 phar:///usr/local/bin/wp/vendor/wp-cli/media-command/src/Media_Command.php(657): wp_update_attachment_metadata() 43 phar:///usr/local/bin/wp/vendor/wp-cli/media-command/src/Media_Command.php(162): Media_Command->process_regeneration() 44 [internal function]: Media_Command->regenerate() 45 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func() 46 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}() 47 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func() 48 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke() 49 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(464): WP_CLI\Runner->run_command() 50 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1295): WP_CLI\Runner->run_command_and_exit() 51 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start() 52 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process() 53 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap() 54 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('…') 55 /usr/local/bin/wp(4): include('…') 56 {main} thrown in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php on line 8
Error: There has been a critical error on this website.Learn more about troubleshooting WordPress. There has been a critical error on this website.Hi @wmnf ,
Are there any warning messages before the fatal error? It could give us more clues about the issue.
Also could you check for us the postmeta record with ID 215643 (I think that’s the next image in the regeneration process)? Is the _wp_attached_file a full URL or a relative path to the image?
Hmm, I see a little different results now running the wp cli regenerate command. Perhaps it is doing in a different order this time. The first warning I see is due to a corrupt JPEG data after item 182/20146:
PHP Warning: getimagesize(): Corrupt JPEG data: 3119 extraneous bytes before marker in /var/www/staging/wp-includes/media.php on line 5510
Warning: getimagesize(): Corrupt JPEG data: 3119 extraneous bytes before marker in /var/www/staging/wp-includes/media.php on line 5510Then I see some warnings pertaining to one file with
Failed to open stream: Too many open files
after item 185:PHP Warning: exif_imagetype(/var/www/staging/wp-content/uploads/2024/03/Rachel-Lynn.jpeg): Failed to open stream: Too many open files in /var/www/staging/wp-includes/functions.php on line 3312
Warning: exif_imagetype(/var/www/staging/wp-content/uploads/2024/03/Rachel-Lynn.jpeg): Failed to open stream: Too many open files in /var/www/staging/wp-includes/functions.php on line 3312
PHP Warning: file_get_contents(/var/www/staging/wp-content/uploads/2024/03/Rachel-Lynn.jpeg): Failed to open stream: Too many open files in /var/www/staging/wp-includes/functions.php on line 3334
Warning: file_get_contents(/var/www/staging/wp-content/uploads/2024/03/Rachel-Lynn.jpeg): Failed to open stream: Too many open files in /var/www/staging/wp-includes/functions.php on line 3334
PHP Warning: finfo_file(/var/www/staging/wp-content/uploads/2024/03/Rachel-Lynn.jpeg): Failed to open stream: Too many open files in /var/www/staging/wp-includes/functions.php on line 3149
Warning: finfo_file(/var/www/staging/wp-content/uploads/2024/03/Rachel-Lynn.jpeg): Failed to open stream: Too many open files in /var/www/staging/wp-includes/functions.php on line 3149
AS3CF: Mime type "" is not allowed (Media Library Item with id 215640)
186/20146 Regenerated thumbnails for "Rachel Lynn" (ID 215640).The first warning related to the plugin comes directly after followed by a couple of fatal errors where the process stops:
PHP Warning: require(/var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/Exception/S3Exception.php): Failed to open stream: Too many open files in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php on line 8
Warning: require(/var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/Exception/S3Exception.php): Failed to open stream: Too many open files in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php on line 8
PHP Fatal error: Uncaught Error: Failed opening required '/var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/S3/Exception/S3Exception.php' (include_path='/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/core:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki:/var/www/staging/wp-content/themes/wmnf/vendor/kirki-framework/kirki/core:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/archive_tar:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/console_getopt:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/pear-core-minimal/src:/var/www/staging/wp-content/plugins/backwpup/vendor/pear/pear_exception:.:/usr/share/php') in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php:8
Stack trace: 0 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/WrappedHttpHandler.php(140): DeliciousBrains\WP_Offload_Media\Providers\Storage\AWS_Provider->DeliciousBrains\WP_Offload_Media\Aws3{closure}() 1 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/WrappedHttpHandler.php(79): DeliciousBrains\WP_Offload_Media\Aws3\Aws\WrappedHttpHandler->parseError() 2 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(174): DeliciousBrains\WP_Offload_Media\Aws3\Aws\WrappedHttpHandler->DeliciousBrains\WP_Offload_Media\Aws3\Aws{closure}() 3 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(143): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise::callHandler() 4 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/RejectedPromise.php(40): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise{closure}() 5 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/TaskQueue.php(47): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\RejectedPromise::DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise{closure}() 6 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(198): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\TaskQueue->run() 7 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(228): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 8 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(193): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitList() 9 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(228): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 10 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(193): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitList() 11 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 12 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Coroutine.php(63): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->wait() 13 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(209): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Coroutine->DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise{closure}() 14 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(191): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->invokeWaitFn() 15 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Promise.php(55): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->waitIfPending() 16 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/GuzzleHttp/Promise/Coroutine.php(89): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Promise->wait() 17 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/AwsClientTrait.php(43): DeliciousBrains\WP_Offload_Media\Aws3\GuzzleHttp\Promise\Coroutine->wait() 18 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/Aws/AwsClientTrait.php(63): DeliciousBrains\WP_Offload_Media\Aws3\Aws\MultiRegionClient->execute() 19 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/providers/storage/aws-provider.php(638): DeliciousBrains\WP_Offload_Media\Aws3\Aws\MultiRegionClient->__call() 20 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/items/download-handler.php(162): DeliciousBrains\WP_Offload_Media\Providers\Storage\AWS_Provider->get_object() 21 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/items/download-handler.php(94): DeliciousBrains\WP_Offload_Media\Items\Download_Handler->download_object() 22 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/items/item-handler.php(142): DeliciousBrains\WP_Offload_Media\Items\Download_Handler->handle_item() 23 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/as3cf-plugin-compatibility.php(605): DeliciousBrains\WP_Offload_Media\Items\Item_Handler->handle() 24 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/as3cf-plugin-compatibility.php(153): AS3CF_Plugin_Compatibility->copy_provider_file_to_server() 25 /var/www/staging/wp-includes/class-wp-hook.php(324): AS3CF_Plugin_Compatibility->legacy_copy_back_to_local() 26 /var/www/staging/wp-includes/plugin.php(205): WP_Hook->apply_filters() 27 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/integrations/media-library.php(936): apply_filters() 28 /var/www/staging/wp-includes/class-wp-hook.php(324): DeliciousBrains\WP_Offload_Media\Integrations\Media_Library->get_attached_file() 29 /var/www/staging/wp-includes/plugin.php(205): WP_Hook->apply_filters() 30 /var/www/staging/wp-includes/post.php(841): apply_filters() 31 /var/www/staging/wp-includes/post.php(6745): get_attached_file() 32 /var/www/staging/wp-includes/post.php(6798): wp_attachment_is() 33 /var/www/staging/wp-includes/post.php(8051): wp_attachment_is_image() 34 phar:///usr/local/bin/wp/vendor/wp-cli/media-command/src/Media_Command.php(1243): wp_get_original_image_path() 35 phar:///usr/local/bin/wp/vendor/wp-cli/media-command/src/Media_Command.php(600): Media_Command->get_attached_file() 36 phar:///usr/local/bin/wp/vendor/wp-cli/media-command/src/Media_Command.php(162): Media_Command->process_regeneration() 37 [internal function]: Media_Command->regenerate() 38 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(100): call_user_func() 39 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher{closure}() 40 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(497): call_user_func() 41 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(441): WP_CLI\Dispatcher\Subcommand->invoke() 42 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(464): WP_CLI\Runner->run_command() 43 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1295): WP_CLI\Runner->run_command_and_exit() 44 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/LaunchRunner.php(28): WP_CLI\Runner->start() 45 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/bootstrap.php(83): WP_CLI\Bootstrap\LaunchRunner->process() 46 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/wp-cli.php(32): WP_CLI\bootstrap() 47 phar:///usr/local/bin/wp/php/boot-phar.php(20): include('…') 48 /usr/local/bin/wp(4): include('…') 49 {main}
thrown in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/vendor/Aws3/aws-autoloader.php on line 8Perhaps I could make some adjustments to PHP or the server to allow more files? If that is the cause, I appreciate any guidance.
Hi @wmnf ,
Is the site by chance on shared hosting? ‘Too many open files’ usually indicates that the server has run out of resources. This is mostly going to be an issue during the initial offload when our plugin tries to offload a lot of image files in a short time span.
One thing you can do is contact your hosting provider for help with the error.
Another thing you can try is downloading and installing our Tweaks plugin.
Then uncomment the block of code in the “pre_upload_attachment” function that references shared hosting (the one with the gc_collect_cycles() function).
… making sure to comment out the other example in that function that stops video files from being offloaded.
Then uncomment the “add_filter” call in the “__construct()” function that enables the “as3cf_pre_upload_attachment” filter.
Let us know how it goes for you.
We are not using shared hosting, it’s our own Linode VPS. Should I still try the things you mentioned? I won’t get a chance to try until the end of next week.
Hi @wmnf ,
Yes, please try the Tweaks plugin if possible. It does sound like your hitting some server limits. We’re not too familiar with Linode VPS. Are you running Apache 2 or nginx 1.4+? We only officially support those servers.
https://deliciousbrains.com/wp-offload-media/pricing/#requirements
You may also contact your hosting provider for help with the “Too Many Files Open” issue.
Linode is an Akamai service. Basically a Linux VPS. We are running Apache2 with PHP 8.2. I’ll give the tweaks a try. Thanks
Okay, thanks for bearing with me. I’ve installed the tweak plugin and commented and only enabled the add_filter for as3cf_pre_upload_attachment. This is what I see in the error log when running the attachments update:
[13-Jun-2024 13:55:51 UTC] PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade-file-sizes.php:154
Stack trace:
#0 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade.php(347): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade_File_Sizes->upgrade_item()
#1 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade.php(305): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade->upgrade_blog()
#2 /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade.php(291): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade->run_upgrade()
#3 /var/www/staging/wp-includes/class-wp-hook.php(324): DeliciousBrains\WP_Offload_Media\Upgrades\Upgrade->do_upgrade()
#4 /var/www/staging/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#5 /var/www/staging/wp-includes/plugin.php(565): WP_Hook->do_action()
#6 /var/www/staging/wp-cron.php(191): do_action_ref_array()
#7 {main}
thrown in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade-file-sizes.php on line 154A query tells me the post ID file for 2685 is an attachment of course with a path that is incorrect. I found the pdf document attachment in another S3 folder. Instead of being
2015/06/wmnf_audit_2013.pdf
it is found at2015/07/wmnf_audit_2013.pdf
. I went as far as manually updating the_wp_attached_file
andamazonS3_info
meta with the correct path and still received the fatal error. When I look in the Media Library I find two instances of the same document at each of the locations previously mentioned. I permanently delete both to troubleshoot and it moves on to the next ID 2687 with the same fatal error. I remove both instances again and it hits ID 2688 and same for 2689. All of these attachments are PDF from 2015. Even though there are two instances, they are in different locations and open without a problem. I”m assuming they just got uploaded twice a month apart. But why would they throwing this fatal error?I decided to try and do a bit more investigating on the issue and expanded my query to tell me all the next 20 attachments in the database. The next 10 or so by ID were also existing PDF, DOC or TXT files. I permanently deleted all those until I had only images in the group of records, then the attachments began making progress. While it was originally stuck on 50%, it climbsed to more than 60% when I started seeing these messages in the logs:
[14-Jun-2024 15:53:39 UTC] AS3CF: Total file size for the attachment is 0: 17737
[14-Jun-2024 15:53:40 UTC] AS3CF: Total file size for the attachment is 0: 17738
[14-Jun-2024 15:53:41 UTC] AS3CF: Total file size for the attachment is 0: 17745
[14-Jun-2024 15:53:41 UTC] AS3CF: Total file size for the attachment is 0: 17746
[14-Jun-2024 15:53:41 UTC] AS3CF: Total file size for the attachment is 0: 17753
[14-Jun-2024 15:53:42 UTC] AS3CF: Total file size for the attachment is 0: 17754
[14-Jun-2024 15:53:42 UTC] AS3CF: Total file size for the attachment is 0: 17759
[14-Jun-2024 15:53:42 UTC] AS3CF: Total file size for the attachment is 0: 17760After several of these messages, the running attachments process in the admin settings stopped showing this error:
Error Updating Attachments?— We ran into some errors attempting to update the attachments for all your Media Library items that have been offloaded. Please check your error log for details. (#2)?Try To Run It Again
I checked a few of the IDs and they are all non-existent from 2015, and all Drafts (not published). We had issues with our initial migration of an old Ruby site on MySQL where we imported posts to WordPress in 2015. These attachments belong to posts that are actually as old as 2007 were imported. The issue was a lot of the attachments did not import and we left anything older than 2 years unpublished for that reason. The posts remain as Drafts as our newsroom staff will sometimes find related posts to a current topic and publish to share. Is there any way to skipped such posts, perhaps ignore non-existent attachments or Drafts?
Hi @wmnf ,
Thanks for those detailed information. The error:
PHP Fatal error: Uncaught TypeError: Cannot access offset of type string on string in /var/www/staging/wp-content/plugins/amazon-s3-and-cloudfront/classes/upgrades/upgrade-file-sizes.php:154
… seem to be happening because of the “_wp_attachment_metadata” postmeta record. I’m guessing the value of the record in the database is a string instead of a serialized array?
Let us get back to you about upgrading only items that are published and not drafts. I’m not sure if this is possible, but let me confirm it with our dev team.
If you need a timely response, we recommend purchasing our Pro version. WP Offload Media Pro comes with a year of email support.
We offer a 100% No-Risk 60-Day Money Back Guarantee. If for any reason you are not happy with our product or service, simply let us know within 60 days of your purchase and we’ll refund 100% of your money. No questions asked.
https://deliciousbrains.com/wp-offload-media/pricing/#guarantee
Thanks for your response. I was able to get our staging server completely worked out by deleting the records by ID from wp_posts and wp_postmeta where I saw in the logs as noted. This is actually cleaning up bad data in the db anyway I hope, all the records stemmed from 2015 and 2016 and the attachments still on S3 as needed.
However, I am now trying to do the same on our production server and receiving an error immediately upon running the attachments update with no PHP error messages in the error log. I have the tweaks plugin activated and DEBUG set to true. I see other deprecated messages or warnings from other plugins, but nothing related when I click “Try To Run It Again” in the error message shown below. Again, the message comes back immediately with no error logged. What could prevent this process from running? I am contemplating a reinstall of the plugin. I don’t believe it is a conflict with another plugin as we have same plugins on the staging server where I was able to complete the process. I do see related queries in mysql.
Error Updating Attachments?— We ran into some errors attempting to update the attachments for all your Media Library items that have been offloaded. Please check your error log for details. (#2)?Try To Run It Again
To see what ID the process was working on, I added the following to line 154 in the
upgrade-file-sizes.php
file of your plugin. This produced an error log entry for every record in the staging server, but doesn’t produce anything in the error logs on our production server:error_log("S3-ISSUE: " . $item->ID);
.Yes, we have been using your plugin for sometime and considering a license for support. However, we have many items and are a non-profit with a tight budget. I am trying to get approval for our upcoming 2025 budget starting in October. Do you have any discounts for 501(c)3 non-profit organzations?
Hi @wmnf,
We’ve asked for assistance on this from our dev team and they mentioned that it looks like all the deletes that have been performed to clean up the attachments might be confusing the current upgrade routine’s session data.
They recommended that the best thing to do is deactivate WP Offload Media Lite, delete the options table record with option_name = “
as3cf_update_file_sizes_session
“, and then reactivate WP Offload Media Lite so that it can cleanly run the file sizes upgrade routine on the current attachment data.As per the non-profit discount – Yes, we offer a 20% discount to non-profit organizations that have tax exempt status. You need to provide proof of your organization’s tax-exempt status with current tax documents from its country of residence.
However, we currently have an on-going new customer offer where you can save up to 40% on your first year. More info on our pricing page here.
Please note that discounts can not be combined. Since the new customer offer is currently the better deal, we would suggest taking advantage of the new customer offer for the first year. The new customer discount is automatically applied when you purchase via our pricing page.
The new customer offer is only applicable on the first year so after the first year, please reach out to us before the renewal date so we can provide you with a 20% non-profit discount that you can use on your upcoming renewal.
- You must be logged in to reply to this topic.