Problem/Motivation

I should be able to uninstall this module without errors.

Steps to reproduce

Install drupal 9.5.4

composer require drupal/content_sync

Add $content_directories['sync'] = __DIR__ . '/content/sync'; to settings.php

drush en content_sync

drush pmu content sync

Observe error:

 [error]  Error: APC must be enabled to use APCUIterator in APCUIterator->__construct() (line 270 of /app/web/core/lib/Drupal/Core/Cache/ApcuBackend.php) #0 /app/web/core/lib/Drupal/Core/Cache/ApcuBackend.php(270): APCUIterator->__construct('/^drupal\\.apcu_...', 4294967295, 100, 1)
#1 /app/web/core/lib/Drupal/Core/Cache/ApcuBackend.php(223): Drupal\Core\Cache\ApcuBackend->getIterator('/^drupal\\.apcu_...')
#2 /app/web/core/lib/Drupal/Core/Cache/ChainedFastBackend.php(271): Drupal\Core\Cache\ApcuBackend->removeBin()
#3 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(592): Drupal\Core\Cache\ChainedFastBackend->removeBin()
#4 /app/web/core/lib/Drupal/Core/Extension/ModuleInstaller.php(514): Drupal\Core\Extension\ModuleInstaller->removeCacheBins('content_sync')
#5 /app/web/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(91): Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#6 /app/vendor/drush/drush/src/Drupal/Commands/pm/PmCommands.php(195): Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array, true)
#7 [internal function]: Drush\Drupal\Commands\pm\PmCommands->uninstall(Array, Array)
#8 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(257): call_user_func_array(Array, Array)
#9 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(212): Consolidation\AnnotatedCommand\CommandProcessor->runCommandCallback(Array, Object(Consolidation\AnnotatedCommand\CommandData))
#10 /app/vendor/consolidation/annotated-command/src/CommandProcessor.php(176): Consolidation\AnnotatedCommand\CommandProcessor->validateRunAndAlter(Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#11 /app/vendor/consolidation/annotated-command/src/AnnotatedCommand.php(390): Consolidation\AnnotatedCommand\CommandProcessor->process(Object(Symfony\Component\Console\Output\ConsoleOutput), Array, Array, Object(Consolidation\AnnotatedCommand\CommandData))
#12 /app/vendor/symfony/console/Command/Command.php(255): Consolidation\AnnotatedCommand\AnnotatedCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#13 /app/vendor/symfony/console/Application.php(1039): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#14 /app/vendor/symfony/console/Application.php(275): Symfony\Component\Console\Application->doRunCommand(Object(Consolidation\AnnotatedCommand\AnnotatedCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#15 /app/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#16 /app/vendor/drush/drush/src/Runtime/Runtime.php(124): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /app/vendor/drush/drush/src/Runtime/Runtime.php(51): Drush\Runtime\Runtime->doRun(Array, Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /app/vendor/drush/drush/drush.php(77): Drush\Runtime\Runtime->run(Array)
#19 /app/vendor/drush/drush/drush(4): require('/app/vendor/dru...')
#20 /app/vendor/bin/drush(117): include('/app/vendor/dru...')
#21 {main}.

Comments

bwood created an issue. See original summary.

edmargomes’s picture

The same problem here with Drupal 9.5.3 and PHP 8.1

prashant.c’s picture

I could not reproduce it on 9.5.x, uninstall happened smoothly. Did you add this code global $content_directories; in your
settings.php file while enabling this module? It could be one reason which is causing the error.

tobias märz’s picture

I run into the same Problem.

PHP8.1

avpaderno’s picture

Version: 3.0.0-beta1 » 3.0.x-dev

This module does not require nor uses the APCu extension. It is sufficient to check with git grep -n --fixed-strings 'APCUIterator'.

That seems an error caused by Drupal core which has been set to use APCu as cache backend when the extension has been disabled.

pacproduct’s picture

We do face this issue too. Is there any known workaround?

Our env: Drupal 10.0.9 & content_sync 3.0.x-dev

As a side node, it seems like the uninstallation works fine when using the web interface. The issue seems to happen with drush pm:uninstall only.

pacproduct’s picture

Could it be related to www.drupal.org/project/drupal/issues/3230708 (Composer require/remove vendor code does not update autoloader (APCu cached))?

pobster’s picture

Just FYI here, by default (and intentionally), APCu isn't enabled for CLI - as it doesn't make sense to be there when using it. You're seeing this error because Drush is obviously CLI, so APCu is off/ not present. That's why it works fine in the web interface.

This is completely unrelated to the module - it's how you've set up your cache bins in your settings.php. I feel like this issue should be closed.

blanca.esqueda’s picture

Version: 3.0.x-dev » 4.0.x-dev
Status: Active » Closed (works as designed)