cms icon indicating copy to clipboard operation
cms copied to clipboard

[4.x]: Problem indexing assets

Open BenParizek opened this issue 8 months ago • 4 comments

What happened?

Description

Errors are thrown when indexing assets.

I'm having a hard time determining what's working and what's not. Most of the indexing seems to run fine but the number of assets in a given volume in the db, the UI, and the bucket in S3 and I'm never presented the typical Craft modal to clean up files that aren't found.

Steps to reproduce

  1. Running into this on 3 sites on Craft 5.7.4, 4.15.2, and 4.15.3

Expected behavior

Assets index and present a list of things not found.

Actual behavior

Asset index runs through most of the assets then fails reporting There was a problem indexing assets and

[web.ERROR] [Error] Error: Attempt to increment/decrement property "processedEntries" on null in /var/www/html/vendor/craftcms/cms/src/services/AssetIndexer.php:874
Stack trace:

Craft CMS version

5.7.4, 4.15.2, and 4.15.3

PHP version

8.2

Operating system and version

No response

Database type and version

MySQL

Image driver and version

imgix and gd

Installed plugins and versions

  • Various.

BenParizek avatar May 08 '25 14:05 BenParizek

Hi, thanks for getting in touch! Any chance you could share a full stack trace for this one? Do you see a “The assetindexdata table is empty; Can’t proceed with indexing.” warning somewhere in the logs when this occurs?

i-just avatar May 09 '25 09:05 i-just

I have this same error in Craft Version 5.7.5 when indexing assets.

2025-05-13 14:51:06 [web.ERROR] [Error] Attempt to increment/decrement property "processedEntries" on null {"trace":[
"#0 /../vendor/craftcms/cms/src/services/AssetIndexer.php(356): craft\\services\\AssetIndexer->incrementProcessedEntryCount()",
"#1 /../vendor/craftcms/cms/src/controllers/AssetIndexesController.php(152): craft\\services\\AssetIndexer->processIndexSession()",
"#2 [internal function]: craft\\controllers\\AssetIndexesController->actionProcessIndexingSession()",
"#3 /../vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()","#4 /../vendor/yiisoft/yii2/base/Controller.php(178): yii\\base\\InlineAction->runWithParams()",
"#5 /../vendor/yiisoft/yii2/base/Module.php(552): yii\\base\\Controller->runAction()",
"#6 /../vendor/craftcms/cms/src/web/Application.php(361): yii\\base\\Module->runAction()",
"#7 /../vendor/craftcms/cms/src/web/Application.php(660): craft\\web\\Application->runAction()",
"#8 /../vendor/craftcms/cms/src/web/Application.php(323): craft\\web\\Application->_processActionRequest()",
"#9 /../vendor/yiisoft/yii2/base/Application.php(384): craft\\web\\Application->handleRequest()",
"#10 /../web/index.php(12): yii\\base\\Application->run()"
,"#11 {main}"
],"memory":6504712,"exception":"[object] (Error(code: 0): Attempt to increment/decrement property \"processedEntries\" on null at /../vendor/craftcms/cms/src/services/AssetIndexer.php:874)"}

Odd situation when indexing assets, the plugin internetztube\elementRelations creates roughly 16k "Resave Single Element Relation" jobs in the queue for just 1k images. I don't know if this was always the case but maybe it might be related?!

denisyilmaz avatar May 13 '25 12:05 denisyilmaz

@i-just i checked my logs and i can see the 2025-05-13 14:51:05 [web.WARNING] [application] The assetindexdata table is empty; Can’t proceed with indexing. {"memory":4817168} warning you mentioned.

denisyilmaz avatar May 13 '25 12:05 denisyilmaz

Thanks for the stack trace and looking through the logs, @denisyilmaz. What’s the filesystem type used by the volume you’re indexing when this happens (Local, AWS S3, etc)? Does it happen every time or occasionally?

i-just avatar May 13 '25 14:05 i-just

Craft 4.16.0 and 5.8.0 are out with a fix for that.

brandonkelly avatar Jul 01 '25 18:07 brandonkelly