Setup
- Solr version: 9.10.1
- Drupal Core version: 10.6.13
- Search API version: 1.41
- Search API Solr version: 4.3.11
- Configured Solr Connector: Standard
Issue
During batch indexing, ~30000 node to index, batch size 10, after few steps I got a fatal error: "Call to undefined method Drupal\search_api\Entity\Index::isIndexingEmptyIndex()"
The trace:
#0 .../www/modules/contrib/search_api/src/Entity/Server.php(462): Drupal\search_api_solr\Plugin\search_api\backend\SearchApiSolrBackend->deleteItems(Object(Drupal\search_api\Entity\Index), Array)
#1 .../www/modules/contrib/search_api/src/Entity/Index.php(1199): Drupal\search_api\Entity\Server->deleteItems(Object(Drupal\search_api\Entity\Index), Array)
#2 .../www/modules/contrib/search_api/src/Entity/Index.php(1133): Drupal\search_api\Entity\Index->indexSpecificItems(Array)
#3 .../www/modules/contrib/search_api/src/Utility/IndexingBatchHelper.php(149): Drupal\search_api\Entity\Index->indexItems(10)
#4 .../www/core/includes/batch.inc(296): Drupal\search_api\Utility\IndexingBatchHelper->process(Object(Drupal\search_api\Entity\Index), 10, -1, -1, Array)
#5 .../www/core/includes/batch.inc(138): _batch_process()
#6 .../www/core/includes/batch.inc(95): _batch_do()
#7 .../www/core/modules/system/src/Controller/BatchController.php(52): _batch_page(Object(Symfony\Component\HttpFoundation\Request))
#8 [internal function]: Drupal\system\Controller\BatchController->batchPage(Object(Symfony\Component\HttpFoundation\Request))
#9 .../www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(123): call_user_func_array(Array, Array)
#10 .../www/core/lib/Drupal/Core/Render/Renderer.php(637): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#11 .../www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(121): Drupal\Core\Render\Renderer->executeInRenderContext(Object(Drupal\Core\Render\RenderContext), Object(Closure))
#12 .../www/core/lib/Drupal/Core/EventSubscriber/EarlyRenderingControllerWrapperSubscriber.php(97): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->wrapControllerExecutionInRenderContext(Array, Array)
#13 .../vendor/symfony/http-kernel/HttpKernel.php(181): Drupal\Core\EventSubscriber\EarlyRenderingControllerWrapperSubscriber->Drupal\Core\EventSubscriber\{closure}()
#14 .../vendor/symfony/http-kernel/HttpKernel.php(76): Symfony\Component\HttpKernel\HttpKernel->handleRaw(Object(Symfony\Component\HttpFoundation\Request), 1)
#15 .../www/core/lib/Drupal/Core/StackMiddleware/Session.php(53): Symfony\Component\HttpKernel\HttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#16 .../www/core/lib/Drupal/Core/StackMiddleware/KernelPreHandle.php(48): Drupal\Core\StackMiddleware\Session->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#17 .../www/core/lib/Drupal/Core/StackMiddleware/ContentLength.php(28): Drupal\Core\StackMiddleware\KernelPreHandle->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#18 .../vendor/asm89/stack-cors/src/Cors.php(53): Drupal\Core\StackMiddleware\ContentLength->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#19 .../www/core/lib/Drupal/Core/StackMiddleware/ReverseProxyMiddleware.php(48): Asm89\Stack\Cors->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#20 .../www/core/lib/Drupal/Core/StackMiddleware/NegotiationMiddleware.php(51): Drupal\Core\StackMiddleware\ReverseProxyMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#21 .../www/core/lib/Drupal/Core/StackMiddleware/AjaxPageState.php(36): Drupal\Core\StackMiddleware\NegotiationMiddleware->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#22 .../www/core/lib/Drupal/Core/StackMiddleware/StackedHttpKernel.php(51): Drupal\Core\StackMiddleware\AjaxPageState->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#23 .../www/core/lib/Drupal/Core/DrupalKernel.php(741): Drupal\Core\StackMiddleware\StackedHttpKernel->handle(Object(Symfony\Component\HttpFoundation\Request), 1, true)
#24 .../www/index.php(19): Drupal\Core\DrupalKernel->handle(Object(Symfony\Component\HttpFoundation\Request))
#25 {main}
When i downgrade SearchAPISolr to the previous version to 4.3.10 this problem does not appears.
This error happens with redis cache backend, DB Cache backend, and disabled cache (dev mode) if i'm using the version 4.3.11. I cannot determine after how many batch steps this happens.
There is an other issue #3481375: Call to undefined method Drupal\search_api\Entity\Index::isIndexingEmptyIndex() which reports the same problem, but there was no resolution there.
Issue fork search_api_solr-3611601
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
reloxo95 commentedComment #3
reloxo95 commentedI know this is not a fix but you can re-index all your data:
On /src/Plugin/search_api/backend/SearchApiSolrBackend.php, line 1528:
This is not a fix, Is just quick "by-pass" to avoid this error.
Comment #4
mkalkbrennerLike in the other issue, it must be caused by your environment or the way how you deploy code. The method was already part of 4.3.10.
This is the code that "adds" the method:
Comment #5
rex.barkdoll commentedI wanted to report that we're seeing similar issues.
Also, reloxo95's suggestion for commenting out that if statement around line 1528 did allow me to bypass the issue and reindex my site.
Comment #6
marco.pagliarulo commentedChanged the title to reflect better the actual issue.
Version 4.3.11 moved the hooks to the class hooks, which are supported since Drupal 11.1
Drupal 10.1+ and Drupal 11.1 require the procedural hooks in place with the attribute LegacyHook that is missing in your implementation.
As result every hooks is not executed on D10 and D11.0
Comment #8
marco.pagliarulo commentedMR created, please review ASAP and create a urgent release.
Comment #9
klemendev commentedI can confirm this is happening and is breaking the website. We need to rollback for now
Comment #10
caspervoogt commentedI just ran into this and rolled back to 4.3.10 as well, which solved it.
Comment #12
mkalkbrennerAll these backward compatibility handling is crazy. Since this project doesn't have sponsors anymore, I can't take care of all of that anymore.
I will create an intermediate 4.3.12 release and then drop Drupal 10 support.
Comment #13
mkalkbrennerhttps://www.drupal.org/project/search_api_solr/releases/4.3.12
Thanks for your help!
4.3.12 will be the last release that supports Drupal versions before 11.3.
Comment #15
klemendev commentedThank you for fixing this!
Comment #16
marco.pagliarulo commentedThanks for the quick merge and release
Comment #17
jennypanighetti commentedI'm still getting this error, even after upgrading to 4.3.12. I may have to roll back too.Apparently I just needed to run drush cr multiple times... no idea why, but it works okay now....