Problem/Motivation
This may not actually be an issue with search_api itself, but I thought it was worth logging, as I couldn't find any related issues elsewhere.
Steps to reproduce
1. enable xdebug
2. run drush search-api-index
drush search-api-index
[success] Found 22461 items to index for Acquia Search Solr Index. Indexing all items.
[success] Indexing a maximum number of 22461 items (50 items per batch run) for the index 'Acquia Search Solr Index'.
> [notice] Successfully indexed 50 items on Acquia Search Solr Index.
> [notice] Successfully indexed 100 items on Acquia Search Solr Index.
> Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames in /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php on line 551 #0 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php(551): strtr(' ', Array)
> #1 /var/www/app/docroot/core/lib/Drupal/Component/Utility/HtmlSerializerRules.php(27): Masterminds\HTML5\Serializer\OutputRules->escape(' ', false)
> #2 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php(499): Drupal\Component\Utility\HtmlSerializerRules->escape(' ', false)
> #3 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php(270): Masterminds\HTML5\Serializer\OutputRules->enc(' ')
> #4 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(96): Masterminds\HTML5\Serializer\OutputRules->text(Object(DOMText))
> #5 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(122): Masterminds\HTML5\Serializer\Traverser->node(Object(DOMText))
> #6 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php(241): Masterminds\HTML5\Serializer\Traverser->children(Object(DOMNodeList))
> #7 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(93): Masterminds\HTML5\Serializer\OutputRules->element(Object(DOMElement))
> #8 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(122): Masterminds\HTML5\Serializer\Traverser->node(Object(DOMElement))
> #9 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php(241): Masterminds\HTML5\Serializer\Traverser->children(Object(DOMNodeList))
> #10 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(93): Masterminds\HTML5\Serializer\OutputRules->element(Object(DOMElement))
> #11 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(122): Masterminds\HTML5\Serializer\Traverser->node(Object(DOMElement))
// stack trace continues looping between these 3 functions
> #225 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php(241): Masterminds\HTML5\Serializer\Traverser->children(Object(DOMNodeList))
> #226 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(93): Masterminds\HTML5\Serializer\OutputRules->element(Object(DOMElement))
> #227 /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/Traverser.php(77): Masterminds\HTML5\Serializer\Traverser->node(Object(DOMElement))
> #228 /var/www/app/docroot/core/lib/Drupal/Component/Utility/Html.php(319): Masterminds\HTML5\Serializer\Traverser->walk()
> #229 /var/www/app/docroot/modules/contrib/search_api/src/Plugin/search_api/processor/HtmlFilter.php(249): Drupal\Component\Utility\Html::serialize(Object(DOMDocument))
> #230 /var/www/app/docroot/modules/contrib/search_api/src/Plugin/search_api/processor/HtmlFilter.php(202): Drupal\search_api\Plugin\search_api\processor\HtmlFilter->handleAttributes(' <p> <span> <...')
> #231 /var/www/app/docroot/modules/contrib/search_api/src/Processor/FieldsProcessorPluginBase.php(363): Drupal\search_api\Plugin\search_api\processor\HtmlFilter->processFieldValue('<p><span><span>...', 'text')
> #232 /var/www/app/docroot/modules/contrib/search_api/src/Plugin/search_api/processor/HtmlFilter.php(183): Drupal\search_api\Processor\FieldsProcessorPluginBase->processField(Object(Drupal\search_api\Item\Field))
> #233 /var/www/app/docroot/modules/contrib/search_api/src/Processor/FieldsProcessorPluginBase.php(296): Drupal\search_api\Plugin\search_api\processor\HtmlFilter->processField(Object(Drupal\search_api\Item\Field))
> #234 /var/www/app/docroot/modules/contrib/search_api/src/Entity/Index.php(657): Drupal\search_api\Processor\FieldsProcessorPluginBase->preprocessIndexItems(Array)
> #235 /var/www/app/docroot/modules/contrib/search_api/src/Entity/Index.php(978): Drupal\search_api\Entity\Index->preprocessIndexItems(Array)
> #236 /var/www/app/docroot/modules/contrib/search_api/src/Entity/Index.php(930): Drupal\search_api\Entity\Index->indexSpecificItems(Array)
> #237 /var/www/app/docroot/modules/contrib/search_api/src/IndexBatchHelper.php(154): Drupal\search_api\Entity\Index->indexItems(50)
> #238 /var/www/app/vendor/drush/drush/includes/batch.inc(257): Drupal\search_api\IndexBatchHelper::process(Object(Drupal\search_api\Entity\Index), 50, 22461, Array)
> #239 /var/www/app/vendor/drush/drush/includes/batch.inc(204): _drush_batch_worker()
> #240 /var/www/app/vendor/drush/drush/includes/batch.inc(75): _drush_batch_command('9494')
> #241 /var/www/app/vendor/drush/drush/src/Commands/core/BatchCommands.php(25): drush_batch_command('9494')
> #242 [internal function]: Drush\Commands\core\BatchCommands->process('9494', Array)
> #243 /var/www/app/vendor/consolidation/annotated-command/src/CommandProcessor.php(276): call_user_func_array(Array, Array)
> #244 /var/www/app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #245 /var/www/app/vendor/consolidation/annotated-command/src/CommandProcessor.php(175): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #246 /var/www/app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(387): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
> #247 /var/www/app/vendor/symfony/console/Command/Command.php(326): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #248 /var/www/app/vendor/symfony/console/Application.php(1096): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #249 /var/www/app/vendor/symfony/console/Application.php(324): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #250 /var/www/app/vendor/symfony/console/Application.php(175): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #251 /var/www/app/vendor/drush/drush/src/Runtime/Runtime.php(110): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
> #252 /var/www/app/vendor/drush/drush/src/Runtime/Runtime.php(40): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
> #253 /var/www/app/vendor/drush/drush/drush.php(139): Drush\Runtime\Runtime->run(Array)
> #254 /var/www/app/vendor/drush/drush/drush(4): require('/var/www/app/ve...')
> #255 /var/www/app/vendor/bin/drush(119): include('/var/www/app/ve...')
> #256 {main}
> [warning] Drush command terminated abnormally.
In ProcessBase.php line 171:
Unable to decode output into JSON: Syntax error
Error: Xdebug has detected a possible infinite loop, and aborted your script with a stack depth of '256' frames in strtr() (line 551 of /var/www/app/vendor/masterminds/html5/src/HTML5/Serializer/OutputRules.php).
This doesn't occur when indexing via the UI, and it seems to happen for some specific content items, so possibly something specific to the output format of those items. Will debug further when I get a chance