Problem/Motivation

CI Builds (example: https://git.drupalcode.org/project/drupal/-/jobs/6080555) are failing on docroot/core/modules/system/tests/src/Functional/System/StatusTest.php:

Status (Drupal\Tests\system\Functional\System\Status)
     ✘ Status page
       ┐
       ├ Failed asserting that true is false.
       │
       │ /builds/project/drupal/core/modules/system/tests/src/Functional/System/StatusTest.php:207
       ┴
     ✔ Error element count
     ✔ Warning element count
    
    FAILURES!
    Tests: 3, Assertions: 46, Failures: 1, PHPUnit Deprecations: 8.

Browser output shows that the failure is coming from a warning generated on APCu size:

Enabled (2.93 GB)
Depending on your configuration, Drupal can run with a 2.93 GB APCu limit. However, a 32 MB APCu limit (the default) or above is recommended, especially if your site uses additional custom or contributed modules.

This does not make much sense, since 2.93 GB is clearly much larger than 32 MB.

Relevant code is in Drupal\system\Install\Requirements\SystemRequirements:

       $memory_info = apcu_sma_info(TRUE);
        $apcu_actual_size = ByteSizeMarkup::create($memory_info['seg_size'] * $memory_info['num_seg']);
        $apcu_recommended_size = '32 MB';
        $requirements['php_apcu_enabled']['value'] = t('Enabled (@size)', ['@size' => $apcu_actual_size]);
        if (Bytes::toNumber(ini_get('apc.shm_size')) * ini_get('apc.shm_segments') < Bytes::toNumber($apcu_recommended_size)) {
          $requirements['php_apcu_enabled']['severity'] = RequirementSeverity::Warning;
          $requirements['php_apcu_enabled']['description'] = t('Depending on your configuration, Drupal can run with a @apcu_size APCu limit. However, a @apcu_default_size APCu limit (the default) or above is recommended, especially if your site uses additional custom or contributed modules.', [
            '@apcu_size' => $apcu_actual_size,
            '@apcu_default_size' => $apcu_recommended_size,
          ]);
        }

This was last changed in #3466399: APCu requirement for 32M is checking wrong value.

Steps to reproduce

Proposed resolution

Stopgap: skip the assertions on APCu stats in core/modules/system/tests/src/Functional/System/StatusTest.php. This has already been committed.

Next steps: address that apc.shm_segments ini settings has been removed in APCu/5.1.25, making the computed value 0 because of multiplication by an empy value. Use a fallback value of 1 and restore the test.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3539331

Command icon 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

godotislate created an issue. See original summary.

nicxvan’s picture

Investigation here: https://drupal.slack.com/archives/C079NQPQUEN/p1754057444000909 that links to the original discussion in htmx where I found this.

dww’s picture

Misplaced parens?

Bytes::toNumber(ini_get('apc.shm_size')) * ini_get('apc.shm_segments')

Don’t we want:

Bytes::toNumber(ini_get('apc.shm_size') * ini_get('apc.shm_segments'))

?

dww’s picture

Assigned: Unassigned » dww

Opening an MR to try that

dww’s picture

Assigned: dww » Unassigned

Bah, sorry. I hadn't looked at the ini_get() docs about apc settings. apc.shm_size indeed can come back as "32 MB" and friends, which is what we want to convert to a number before we multiply it by the number of segments.

godotislate’s picture

It might be good to print what ini_get('apc.shm_size') and ini_get('apc.shm_segments') actually are now in the build env, and whether something isn't converting those values right in Bytes::toNumber.

godotislate’s picture

@catch also suggested in slack that maybe we disable Status test for now to get builds working, then reinstate after finding the root cause.

dww’s picture

Status: Active » Needs review

Initial MR to skip the test for now.

godotislate’s picture

Status: Needs review » Reviewed & tested by the community

Let's do this and unblock some builds.

godotislate’s picture

Opened MR to check what the APC values were per #6, and it looks like ini_get('apc.shm_segments') might be empty, which would certainly be a problem.
https://git.drupalcode.org/issue/drupal-3539331/-/jobs/6083955

godotislate’s picture

  • catch committed 35fd22b0 on 10.5.x
    Issue #3539331 by dww, godotislate, nicxvan: Incorrect warning for...

  • catch committed 366cd752 on 10.6.x
    Issue #3539331 by dww, godotislate, nicxvan: Incorrect warning for...

  • catch committed 2ec67456 on 11.2.x
    Issue #3539331 by dww, godotislate, nicxvan: Incorrect warning for...

  • catch committed ebc2081b on 11.x
    Issue #3539331 by dww, godotislate, nicxvan: Incorrect warning for...
catch’s picture

Status: Reviewed & tested by the community » Needs work

Committed/pushed to 11.x and cherry-picked to 11.2.x, 10.6.x and 10.5.x, thanks!

Don't usually like multiple commits from a single issue but given skipping the test is an emergency stop-gap let's leave this open and continue here maybe?

godotislate’s picture

Status: Needs work » Needs review

OK, used a ternary to set fallback multiplier of 1 if ini_get('apc.shm_segments') is empty. This passes tests in MR 12895.

dww’s picture

Hah, bit of duplicated effort, since I had started down that same road.

However, it's not just ini_get('apc.shm_segments') that can be empty. So, too, can apcu_sma_info(TRUE)['num_seg']. So I moved the fallback check into a local var, and use that everywhere we check this, either directly or via apcu_sma_info().

dww changed the visibility of the branch 3539331-fix-apcu-status-check to hidden.

nicxvan’s picture

Priority: Critical » Major

Probably not critical anymore.

godotislate’s picture

Issue summary: View changes
Issue tags: +Needs Review Queue Initiative
andypost’s picture

FYI I did upgrade of APCu to 5.1.26 for DrupalCI https://pecl.php.net/package/APCu/5.1.25

The apc.shm_segments ini option has been removed. Multiple SHM segments are no longer
supported. (They were already not supported when using mmap, which is the default mode of
operation)

andypost’s picture

godotislate’s picture

Since #3538854: APCu requirement for 32MB always displays since APCu 5.1.25 was filed first, I guess we could close this one as fixed (with the stopgap) and copy the open MR here over there. Or close that one as a duplicate.

dww’s picture

Title: Incorrect warning for system requirements for APCu memory » Skip failing test with incorrect warning for system requirements about APCu memory
Priority: Major » Critical
Status: Needs review » Fixed

Agreed with #29. It'll be cleaner for the Git history, too. I opened an MR over there with the latest code from here. Restoring the original (critical) scope and marking fixed.

Thanks,
-Derek

dww’s picture

Issue tags: +Bug Smash Initiative

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.