Problem/Motivation

Recently, CI has been continuously collapsing with messages like 'CI aborted' and 'apcu_store(): Unable to allocate memory for pool.'

We have info-issue about this problems #2926309: Random fail due to APCu not being able to allocate memory. But here we do a lot of research.

Research map

  • #3: many runs of InstallUninstallTest ('CI aborted').
  • #8, #25: memory scan.
  • #14: 1000 rest-xml tests ('CI aborted'), #22 usleep in rest-request() partially helps.
  • #31: index.php file writing (+lock), perhaps helps.
  • #35: shuffle test list improve speed of testing and perhaps helps.
  • #38: massive testing ImageStyleXmlBasicAuthTest ('CI aborted'). But works if change concurency from 31 to 4 (#41). Reducing concurency perhaps helps
  • #42: time track logs.
  • #50: special rest-test with creating nodes via POST ('CI aborted').
  • #53: special non-rest-test with creating nodes via POST ('CI aborted').
  • #54: massive fails, when BTB client with time limit.
  • #56, #57, #64: additional operation with writing file (lock regim) perhaps helps.

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#196 interdiff-195-196.txt1.71 KBAnonymous (not verified)
#196 compress-cache-data-1281408-10-2-mem-track.patch11.07 KBAnonymous (not verified)
#195 compress-cache-data-1281408-10-mem-track.patch9.36 KBAnonymous (not verified)
#194 build-47385.png60.54 KBAnonymous (not verified)
#193 2933866-2-remove-static-entity-cache-when-serialized-mem-track.patch7.83 KBAnonymous (not verified)
#193 2851529-53-DatabaseCacheTagsChecksum-mem-track.patch10.59 KBAnonymous (not verified)
#193 2848844-2-constraint-non-static-cache-mem-track.patch8.21 KBAnonymous (not verified)
#193 2783791-33-module-install-invalidate-render-cache-mem-track.patch7.9 KBAnonymous (not verified)
#193 2765271-6-rationalize-discovery-mem-track.patch7.52 KBAnonymous (not verified)
#193 2515054-4-apcu-leak-cookies-mem-track.patch11.15 KBAnonymous (not verified)
#193 2421479-33-files-chit-mem-track.patch29.79 KBAnonymous (not verified)
#193 2339487-31-permission-cache-mem-track.patch11.3 KBAnonymous (not verified)
#193 2250033-2-reset-cache-tags-mem-track.patch8.83 KBAnonymous (not verified)
#193 1596472-125-static-cache-on-cache-backends-mem-track.patch34.75 KBAnonymous (not verified)
#193 1199866-47-LRU-cache-mem-track.patch42 KBAnonymous (not verified)
#190 gc-apcu-mem-track.patch8.26 KBAnonymous (not verified)
#190 rest-and-checkForMetaRefresh.patch906 bytesAnonymous (not verified)
#190 first-100-tests-apcu_entries.patch1.46 KBAnonymous (not verified)
#190 first-100-apc-apache_info.patch1.61 KBAnonymous (not verified)
#187 2930022-151-trouble-maker+debug-backtrace-ignore-args-do-not-test.patch.txt5.51 KBtacituseu
#187 2930022-151-trouble-maker+2857437-revert-do-not-test.patch.txt2.56 KBtacituseu
#181 2930022-181-flush-mem-track.patch12.78 KBtacituseu
#180 2930022-179-flush-mem-track_.patch11.75 KBtacituseu
#179 2930022-179-flush-mem-track.patch11.75 KBtacituseu
#178 2930022-178-flush-mem-track.patch10.42 KBtacituseu
#177 2930022-177-flush-mem-track.patch11.3 KBtacituseu
#176 2930022-175-flush-mem-track-test-of-a-test-1.patch11.46 KBtacituseu
#175 2930022-175-flush-mem-track-test-of-a-test.patch11.44 KBtacituseu
#174 apcu_store-ttl-200s-phpunit-installer-2907728-53-mem-track.patch63.07 KBAnonymous (not verified)
#173 ttl200-without-install-43197.png45.76 KBAnonymous (not verified)
#172 apcu_store-ttl-200s-mem-track-without-installer.patch8.56 KBAnonymous (not verified)
#172 ttl-200s-43193-avail+entries.png33.09 KBAnonymous (not verified)
#172 ttl-10s-43192-avail+entries.png37.33 KBAnonymous (not verified)
#171 43187-avail+hits+misses+inserts+entries.png65.58 KBAnonymous (not verified)
#171 43187-avail.png38.18 KBAnonymous (not verified)
#171 apcu_store-ttl-200s-mem-track.patch8.42 KBAnonymous (not verified)
#171 apcu_store-ttl-10s-mem-track.patch8.42 KBAnonymous (not verified)
#170 apcu_store-ttl-30s-mem-track.patch8.42 KBAnonymous (not verified)
#168 expire-30s-mem-track.patch8.11 KBAnonymous (not verified)
#167 clear_cache3-mem-track.patch12.55 KBAnonymous (not verified)
#167 clear_cache2-mem-track.patch12.55 KBAnonymous (not verified)
#167 clear_cache1-mem-track.patch12.55 KBAnonymous (not verified)
#166 runs-without-slow-50s-tests-mem-track.patch16.25 KBAnonymous (not verified)
#166 runs-without-slow-100s-tests-mem-track.patch8.9 KBAnonymous (not verified)
#165 runs-without-slow-100s-tests-mem-track.patch8.89 KBAnonymous (not verified)
#165 runs-without-slow-50s-tests-mem-track.patch16.26 KBAnonymous (not verified)
#165 43132-update-index-mem-track.png81.51 KBAnonymous (not verified)
#162 2930022-mem-track-only-do-not-test.patch7.06 KBtacituseu
#161 2931883-vs-default.png24.93 KBAnonymous (not verified)
#159 post-158-unique-prefix-43053.png65.34 KBAnonymous (not verified)
#159 post-158-shared-prefix-43052.png55.26 KBAnonymous (not verified)
#159 post-150-unique-prefix-clear-all.png87.01 KBAnonymous (not verified)
#159 post-150-shared-prefix-clear-all.png83.95 KBAnonymous (not verified)
#158 unique-prefix-2704571-13-mem-track.patch13.28 KBAnonymous (not verified)
#158 share-prefix-2704571-13-mem-track.patch12.76 KBAnonymous (not verified)
#152 2930022-152-flush-mem-track.patch9.73 KBtacituseu
#151 2930022-151-flush-mem-track.patch8.84 KBtacituseu
#150 apcu-clear_by_test-unique-prefix-mem-track.patch11.34 KBAnonymous (not verified)
#150 apcu-clear_all-unique-prefix-mem-track.patch11.31 KBAnonymous (not verified)
#150 apcu_clear_all-share-prefix-mem-track.patch10.79 KBAnonymous (not verified)
#148 unique-prefix-clear_after_each_btb_test-mem-track.patch9.5 KBAnonymous (not verified)
#148 shared-prefix-clear_after_each_btb_test-mem-track.patch8.98 KBAnonymous (not verified)
#147 ResourceTestBase-unique-prefix.patch4.45 KBAnonymous (not verified)
#147 different-update-tests.png20.92 KBAnonymous (not verified)
#147 UpdatePathTestBaseFilledTest-same-vs-unique-prefix.png18.63 KBAnonymous (not verified)
#147 compare-with-unique-prefix-for-update-and-update_install.png24.21 KBAnonymous (not verified)
#147 id42601-avail.png40.79 KBAnonymous (not verified)
#146 2926309-51-update-insatller-unique_prefix.patch4.93 KBAnonymous (not verified)
#146 2926309-51-insatller-unique_prefix.patch4.5 KBAnonymous (not verified)
#146 x500-UpdatePathTestBaseTest-checkForMetaRefresh-scan-unique_prefix.patch17.06 KBAnonymous (not verified)
#139 x500-UpdatePathTestBaseTest-checkForMetaRefresh-scan.patch16.54 KBAnonymous (not verified)
#139 log-test80722149_testUpdateHookN-between-updateUrl-and-checkForMetaRefresh.txt46.77 KBAnonymous (not verified)
#2 x500_UserJsonAnonTest.patch560 bytesAnonymous (not verified)
#3 x400_InstallUninstallTest.patch524 bytesAnonymous (not verified)
#4 php_bug-75176.patch1.56 KBAnonymous (not verified)
#5 x200_InstallUninstallTest-apc_off.patch1.01 KBAnonymous (not verified)
#5 x200_InstallUninstallTest.patch524 bytesAnonymous (not verified)
#6 x200_InstallUninstallTest-phpunit.patch1.23 KBAnonymous (not verified)
#7 apcu_list_tests.patch2.1 KBAnonymous (not verified)
#8 2828559-86-8.5.x.patch5.96 KBtacituseu
#9 2828559-86-and-2208429-3-295.patch75.76 KBAnonymous (not verified)
#10 x200_MemoryTest.patch1.69 KBAnonymous (not verified)
#13 x1000_xml.patch663 bytesAnonymous (not verified)
#14 x1000_xml_tests.patch680 bytesAnonymous (not verified)
#22 x1000_xml_tests-delay.patch1.38 KBAnonymous (not verified)
#22 x100_InstallUninstallTest-simpletest-delay.patch1.12 KBAnonymous (not verified)
#24 2930022-23-InstallUninstallTest-index-x1.patch6.9 KBtacituseu
#25 2930022-25-all.patch6.52 KBtacituseu
#28 2930022-28-x100_InstallUninstallTest-phpunit.patch7.58 KBtacituseu
#29 index-with-apcu_sma_info.patch255 bytesAnonymous (not verified)
#31 index-with-log-lock-ex.patch353 bytestacituseu
#32 2930022-32-cache-max-rows.patch560 bytestacituseu
#33 2930022-32-cache-max-rows-100000.patch561 bytesAnonymous (not verified)
#33 index-with-log-lock-ex-with-usleep-500000.patch370 bytesAnonymous (not verified)
#33 x100_InstallUninstallTest-and-2704571-13.patch6.55 KBAnonymous (not verified)
#34 2930022-32-cache-max-rows-666.patch558 bytesAnonymous (not verified)
#35 shuffle_test_list.patch345 bytesAnonymous (not verified)
#37 x100_InstallUninstallTest-simpletest-with-1596472-125.patch28.2 KBAnonymous (not verified)
#38 x2000-one_rest_test.patch593 bytesAnonymous (not verified)
#39 2800873-xml_tests-request-count.patch1.52 KBAnonymous (not verified)
#39 x2000-one_rest_test-header-no-cache.patch969 bytesAnonymous (not verified)
#39 x2000-one_rest_test-apc-cache_by_default-off.patch901 bytesAnonymous (not verified)
#40 x1000-one_rest_test-apc-concurency-1.patch622 bytesAnonymous (not verified)
#40 x2000-one_rest_test-apc-max-cache-10000.patch1.13 KBAnonymous (not verified)
#42 834262-40472-1h24m-time-track-sorted.csv_.txt272.18 KBtacituseu
#42 834888-40783-0h47m-time-track-sorted.csv_.txt272.25 KBtacituseu
#43 2930022-43-no-InstallUninstallTest.patch540 bytestacituseu
#44 x2000-request-test-100.patch1.29 KBAnonymous (not verified)
#47 x1000-request-test-rest-payload-100.patch2.69 KBAnonymous (not verified)
#48 wtf.php_.txt1.65 KBAnonymous (not verified)
#48 stat.txt74.33 KBAnonymous (not verified)
#48 wtf.png4.07 KBAnonymous (not verified)
#49 x1000-request-test-rest-payload-GET-200.patch2.66 KBAnonymous (not verified)
#50 x1000-request-test-rest-payload-POST-200.patch2.62 KBAnonymous (not verified)
#51 disallow-rest-test-post.patch799 bytesAnonymous (not verified)
#53 x1000-request-test-payload-new-node-300.patch3.51 KBAnonymous (not verified)
#53 build_id-4530.png9.69 KBAnonymous (not verified)
#53 shuffle-build_id-40837.png10.04 KBAnonymous (not verified)
#53 wtf.php_.txt1.58 KBAnonymous (not verified)
#54 x470-request-test-payload-300-with-log.patch3.79 KBAnonymous (not verified)
#54 post-53-build_id-41017.png8.81 KBAnonymous (not verified)
#54 btb-client-sensitive-time.patch553 bytesAnonymous (not verified)
#55 x1000-request-test-rest-payload-POST-200-localhost.patch2.93 KBtacituseu
#56 x470-request-test-payload-300-with-log.patch3.8 KBAnonymous (not verified)
#57 magic-fix-rest-tests.patch1004 bytesAnonymous (not verified)
#59 less-magic-fix-rest-tests.patch971 bytestacituseu
#60 less-magic-fix-rest-tests.patch971 bytestacituseu
#62 less-magic-fix-rest-tests.patch999 bytestacituseu
#64 less-magic-fix-rest-tests_a_regim.patch999 bytesAnonymous (not verified)
#65 2930022-64.patch1.16 KBtacituseu
#67 2930022-67.patch1.16 KBtacituseu
#70 btb-client-sensitive-time-no-debug-output.patch956 bytestacituseu
#71 btb-client-no-debug-output.patch694 bytestacituseu
#73 apc-usage-track-1.patch6.94 KBtacituseu
#73 apc-usage-track-2.patch3.09 KBtacituseu
#74 apc-usage-track-2.1.patch3.28 KBtacituseu
#77 shuffle-lucky-middle-long.png26.06 KBAnonymous (not verified)
#77 wtf.php_.txt4.45 KBAnonymous (not verified)
#82 apc-usage-track-3.patch8.46 KBtacituseu
#84 2930022-53-x1000-300-request-with-lock-file.patch3.39 KBAnonymous (not verified)
#84 2930022-53-x1000-300-request-with-index-apcu_clear_cach.patch3.46 KBAnonymous (not verified)
#84 2930022-53-x1000-300-request-with-lock-and-write-file.patch3.47 KBAnonymous (not verified)
#84 2930022-53-x1000-request-test-payload-new-node-300-concurency-4.patch3.54 KBAnonymous (not verified)
#86 apc-usage-track-2.2.patch3.53 KBtacituseu
#87 84-charts.png31.61 KBAnonymous (not verified)
#87 index-apcu_clear_cache.patch206 bytesAnonymous (not verified)
#87 2930022-53-concurency-15.patch3.54 KBAnonymous (not verified)
#87 2930022-53-concurency-24.patch3.54 KBAnonymous (not verified)
#87 2930022-56-x1000.patch3.8 KBAnonymous (not verified)
#88 apc-usage-track-2.3.patch3.58 KBtacituseu
#89 apcu_clear_cache-vs-shuffle.png28.21 KBAnonymous (not verified)
#89 tearDown-apcu_clear_cache.patch589 bytesAnonymous (not verified)
#91 shuffle_and_apcu_clear_cache.patch551 bytesAnonymous (not verified)
#92 apcu_clear_cache_and_concurrency_35.patch670 bytestacituseu
#92 apcu_clear_cache_and_concurrency_48.patch670 bytestacituseu
#93 apc-usage-track-3.1.patch9.3 KBtacituseu
#94 apcu_clear_cache_and_concurrency_35.patch733 bytestacituseu
#94 apcu_clear_cache_and_concurrency_48.patch733 bytestacituseu
#97 completion-vs-apcu-free-40852.png66.91 KBtacituseu
#99 apc-usage-track-2.4.patch3.16 KBtacituseu
#100 apc-usage-track-2.4.1.patch3.2 KBtacituseu
#101 apc-usage-track-2.4.2.patch1.13 KBtacituseu
#102 apc-usage-track-2.4.3.patch1.85 KBtacituseu
#102 apc-usage-track-2.4.4.patch3.92 KBtacituseu
#105 apc-usage-track-2.4.5.patch3.92 KBtacituseu
#107 tearDown-bins-flush.patch941 bytestacituseu
#111 2272685-23-reroll.patch3.74 KBAnonymous (not verified)
#111 tearDown-iterator.patch595 bytesAnonymous (not verified)
#111 wtf-memory.php_.txt6.49 KBAnonymous (not verified)
#111 wtf-clince.php_.txt5.17 KBAnonymous (not verified)
#111 2930022-99-id-41605.png33.63 KBAnonymous (not verified)
#111 2930022-100-id-41623.png33.62 KBAnonymous (not verified)
#111 2930022-101-id-41628.png33.78 KBAnonymous (not verified)
#111 2930022-102-id-41640.png35.39 KBAnonymous (not verified)
#111 2930022-102-id-41641.png32.1 KBAnonymous (not verified)
#111 31-concurency-full-list.png38.38 KBAnonymous (not verified)
#111 31-concurency-rest-hal.png29.93 KBAnonymous (not verified)
#111 31-concurency-longer-than-100-seconds.png29.92 KBAnonymous (not verified)
#112 named-blocks-more-100-seconds.png92.16 KBAnonymous (not verified)
#113 2272685-23-reroll-2.patch4.03 KBAnonymous (not verified)
#113 tearDown-btb-simpletest-apcu-iterator.patch1.01 KBAnonymous (not verified)
#113 tearDown-btb-simpletest-apcu-clear_cache.patch942 bytesAnonymous (not verified)
#116 no-user-permissions-hash-mem-track.patch7.38 KBtacituseu
#116 tearDown-bins-flush-mem-track.patch7.62 KBtacituseu
#117 wtf-types.php_.txt7.77 KBAnonymous (not verified)
#117 41767-avail-hits-misses.png37.27 KBAnonymous (not verified)
#117 41767-avail-inserts-entries.png44.17 KBAnonymous (not verified)
#117 41767-avail-peaks-hits-misses-inserts-entries.png87.8 KBAnonymous (not verified)
#117 41767-avail-expunges.png28.68 KBAnonymous (not verified)
#117 41768-avail-hits-misses.png44.87 KBAnonymous (not verified)
#117 41768-avail-inserts-entries.png45.53 KBAnonymous (not verified)
#117 41768-avail-expunges.png30.27 KBAnonymous (not verified)
#117 41768-avail-peaks-hits-misses-inserts-entries.png85.36 KBAnonymous (not verified)
#118 tearDown-apcu-delete-site-prefix-mem-track.patch7.26 KBAnonymous (not verified)
#118 tearDown-mem-track-index-apcu_clear_cache.patch6.72 KBAnonymous (not verified)
#119 one-class-loader-for-all-mem-track.patch7.88 KBtacituseu
#120 one-class-loader-and-file-cache-for-all-mem-track.patch8.41 KBtacituseu
#121 41813-avail+hits+misses+inserts+entries.png51.54 KBAnonymous (not verified)
#121 41814-avail+hits+misses+inserts+entries.png75.78 KBAnonymous (not verified)
#121 41815-avail+hits+misses+inserts+entries.png46.2 KBAnonymous (not verified)
#121 41818-avail+hits+misses+inserts+entries.png39.3 KBAnonymous (not verified)
#123 2930022-120-ClassLoaderTest-changes.patch2.76 KBAnonymous (not verified)
#124 apcu-ensure-unique-prefix-false-mem-track.patch7.11 KBtacituseu
#126 2930022-124-prod.patch2.43 KBAnonymous (not verified)
#126 2930022-124-check-random-fail-in-update-tests-x1000.patch3.08 KBAnonymous (not verified)
#127 2930022-124-check-random-fail-in-all-update-tests-x1000.patch3.08 KBAnonymous (not verified)
#128 2930022-124-update-tests.png23.58 KBAnonymous (not verified)
#128 2930022-120-prod.patch3.23 KBAnonymous (not verified)
#128 2930022-120-check-random-fail-in-update-tests-x1000.patch3.88 KBAnonymous (not verified)
#128 2930022-120-check-random-fail-in-all-update-tests-x1000.patch3.88 KBAnonymous (not verified)
#129 2930022-120-real-UpdatePathTestBaseTest-x1000.patch1.94 KBAnonymous (not verified)
#129 2930022-120-real-update-tests-x1000.patch1.94 KBAnonymous (not verified)
#131 2930022-124-prod-mem-track.patch9.6 KBtacituseu
#132 2930022-126-UpdatePathTestBaseTest-880-mem-track.patch8.1 KBAnonymous (not verified)
#133 2930022-124-prod-mem-track.patch9.19 KBtacituseu
#134 41927-avail.png26.07 KBAnonymous (not verified)
#134 41927-peacks-update.png33.12 KBAnonymous (not verified)
#134 41927-concurency-lines-in-seconds.png96.6 KBAnonymous (not verified)
#136 x500-UpdatePathTestBaseTest-scan-by-methods.patch13.92 KBAnonymous (not verified)
#137 id41983-avail.png40 KBAnonymous (not verified)
#137 id41983-zoom-sector-12-30-minutes.png29.44 KBAnonymous (not verified)
#137 41983-statistics.txt33.93 KBAnonymous (not verified)
#137 wtf-uscan.php_.txt11.81 KBAnonymous (not verified)
#137 x500-UpdatePathTestBaseTest-scan-2.patch14.49 KBAnonymous (not verified)

Comments

Anonymous’s picture

vaplas created an issue. See original summary.

Anonymous’s picture

Status: Active » Needs work
StatusFileSize
new560 bytes
Anonymous’s picture

StatusFileSize
new524 bytes
Anonymous’s picture

StatusFileSize
new1.56 KB
Anonymous’s picture

Anonymous’s picture

Title: Ignore: patch testing issue » Ignore: patch testing apcu
StatusFileSize
new1.23 KB

.

Anonymous’s picture

StatusFileSize
new2.1 KB
tacituseu’s picture

StatusFileSize
new5.96 KB

Checking memory usage.

Also, sidenote: tests on PHP 7 are a lot slower recently.
8.5.x-dev test with PHP 7 & MySQL 5.5
Sep 12: Took 45 min
Oct 12: Took 48 min
Nov 11: Took 49 min
Dec 12: Took 1 hr 11 min
8.5.x-dev test with PHP 5.5 & MySQL 5.5
Sep 12: Took 1 hr 7 min
Dec 12: Took 1 hr 18 min
PHP 7 is almost as slow as PHP 5.5 now o_O.

Anonymous’s picture

StatusFileSize
new75.76 KB

Checking memory usage with #2208429-295: Extension System, Part III: ExtensionList, ModuleExtensionList and ProfileExtensionList patch, where memory problems often manifest.

Anonymous’s picture

StatusFileSize
new1.69 KB

Judging by #8 logs, the largest spendthrift between non-JSB tests is AggregatorAdminTest. Peak occurs in testSettingsPage() here:

$this->container->get('module_installer')->uninstall(['aggregator_test']);
$this->resetAll();

Lets check special test on memory with similar operations.


Leader between JSB tests is FilterOptionsTest.
tacituseu’s picture

Re #10: not sure I follow, what I saw in #8 is that:
1. there's hardly any APCU mem usage (1MB)
2. PHPUnit reporting is inadequate (I think it needed test listener but I didn't finish it)
3. Top offenders are:
Drupal\field_ui\Tests\ManageFieldsTest 94371840 bytes
Drupal\user\Tests\UserPasswordResetTest 92274688 bytes
Drupal\system\Tests\Theme\ThemeTest 83886080 bytes
Drupal\views_ui\Tests\PreviewTest 81788928 bytes
Drupal\field\Tests\FormTest 77594624 bytes
Drupal\quickedit\Tests\QuickEditLoadingTest 75497472 bytes
Drupal\taxonomy\Tests\TermTest 75497472 bytes
Drupal\file\Tests\FileFieldWidgetTest 73400320 bytes
Drupal\menu_ui\Tests\MenuTest 73400320 bytes
Drupal\file\Tests\SaveUploadFormTest 71303168 bytes
so nothing excessive.

Looked over Commits for DrupalCI: Environments and around 23 Nov the php containers were updated, first failure is 26 Nov so this could be environment problem, also it had many updates today and yesterday.

Anonymous’s picture

@tacituseu, I immediately began to look at the archive, and did not find all the beauties of the patch 💎🙏

Anonymous’s picture

StatusFileSize
new663 bytes
Anonymous’s picture

StatusFileSize
new680 bytes
tacituseu’s picture

One more problem with #8, those errors are actually forwarded from X-Drupal-Assertion-* headers by Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware, so they aren't on the test side, those APCU stats cover only the php-cli side, hence low usage.
Edit: except InstallUninstallTest.

Anonymous’s picture

InstallUnistallTest also performs many requests via drupalPostForm(). So much that the simpletest works in two faster than phpunit. Perhaps due to pure cURL vs Mink and Guzzle.

#2930072-14: Module: Convert system functional tests to phpunit:

# 100 tests with concurrency = 31
simpletest: 25 min 49 sec   (1549 sec)
phpunit: 1 hour 1 min    (3601 sec)

Now massive rest test (#14), and massive InstallUnistallTest (#3) lead to 'CI aborted'

Interestingly, this happens even after the successful execution of all tests.

tacituseu’s picture

#3 and #14 aborted because: Build timed out (after 110 minutes). Marking the build as aborted., all AWS instances are spun down before 2 hour mark.

Anonymous’s picture

https://dispatcher.drupalci.org/job/drupal_patches/40701/consoleFull

  • 936/1000 tests were completed in an 1 hour.
  • Than 1 hour pause
  • Than 'Build timed out (after 110 minutes)'

Time between last test and time out:

13:11:46 Drupal\Tests\rest\Functional\EntityResource\View\ViewXmlAnon   2 passes                                      
14:16:41 Build timed out (after 110 minutes). Marking the build as aborted.

https://dispatcher.drupalci.org/job/drupal_patches/40699/console
  • 100/100 tests were completed in 25 min.
  • Than 1.5 hour pause
  • Attempting to connect to database server.
  • Database is active.
  • Than 'Build timed out (after 110 minutes)'

Time between last test and time out:

12:49:00 Drupal\system\Tests\Module\InstallUninstallTest              3207 passes                                      
12:49:00 
12:49:00 Test run duration: 25 min 49 sec
12:49:00 
12:49:00 Attempting to connect to database server.
12:49:00 Database is active.
14:11:38 Build timed out (after 110 minutes). Marking the build as aborted.
tacituseu’s picture

@vaplas: ok, now i get it, didn't notice that earlier because I'm used to looking at the "View as plain text" version of the log, which doesn't contain the timestamps (as the colored one is sometimes mangled), weird indeed.

Anonymous’s picture

Maybe I will bring turbidity following information, but nevertheless voiced its:

  • REST-tests uses Guzzle client and 'CI aborted'
  • simpletest-InstallUninstallTest uses cURL and 'CI aborted'
  • phpunit-InstallUninstallTest uses Mink client and works stability (or just slower, and this is useful for stability) (#2930072-14)

I also remembered an interesting puzzle #2863626-61: Convert web tests to browser tests for image module. TL;DR:
When running tests for CI somewhere there is an additional reading of the output stream. Although this does not happen when running tests locally.
As result, we get green tests via $response->getBody()->getContents() locally, but not on CI.
For CI we need seek to start of stream, like (string) $response->getBody().

tacituseu’s picture

@vaplas: not sure if you've read it already, but there's also interesting info about recent changes here #2857788-9: Patch the testbot to start both chrome in webdriver mode and phantomjs in non webdriver mode, especially point 2.

Anonymous’s picture

#21: @tacituseu, it's too clever for me, sorry)


Checking how the delay before requests can improve or worsen the situation.
Anonymous’s picture

Hm..

Did not help with InstallUninstallTest (perhaps one delay in drupalPostFrom is not enough).
But it helped for rest-tests with 'CI aborted'. But not with 'apcu memory'.

One more observation:

  • the first rest-tests is very fast:
    (2 min 23 sec between two series):
    20:06:46 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    .....
    20:09:09 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    

    (2 min 46 sec):

    20:09:09 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    .....
    20:11:55 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    
  • then slower
    (4 min 42 sec):
    20:11:55 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    .....
    20:16:37 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes 
    

    (3 min 53 sec):

    20:16:37 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes 
    .....
    20:19:30 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    
  • and slower:
    (6 min 50 sec)
    20:19:30 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    .....
    20:26:20 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes 
    

    (5 min 42 sec)

    20:26:20 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes 
    .....
    20:42:02 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes 
    
  • the last tests finally slow down:
    (18 min 23 sec)
    20:42:02 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes 
    .....
    21:01:25 Drupal\Tests\rest\Functional\EntityResource\Action\ActionXml   2 passes
    

This is somewhat similar to the problem with the limited size of hash tables. Where the more keys, the more collisions, the more time on paste next key.

Maybe this is what happens to the apcu? And increasing the time delay between requests allows to start the garbage collector, or the mechanism for optimize table-cache size?

tacituseu’s picture

Edit: one run of InstallUninstallTest eats ~6MB of APCU cache.

tacituseu’s picture

StatusFileSize
new6.52 KB

Edit: Most memory used to serve a page ~100MB, most APCU cache used per test is 1965MB (leaves 35MB free).

Anonymous’s picture

#25: No-JS tests run duration: 28 min 59 sec! @tacituseu, your patch is the most original way to great increase the speed of tests that I have seen!)

tacituseu’s picture

@vaplas: That would be just bizzare, maybe it's just the result of @Mixologic and @Mile23 tuning things in the background. But otherwise 47 min test run time is close to what I'd expect from PHP 7.

tacituseu’s picture

Anonymous’s picture

StatusFileSize
new255 bytes

https://dispatcher.drupalci.org/job/drupal_patches/40784/
No-JS tests run duration still: 50 min 14 sec.
However, this was launched later than #25.

Out of curiosity, is it enough just to call apcu_sma_info, or need some kind of protracted operation, like I/O?

tacituseu’s picture

If there's anything to this, my wild guess would be that lock in index.php somehow helps with ?cache trashing?:
file_put_contents($logfile, date('YmdHis') . ';I;' . memory_get_peak_usage(TRUE) . ';' . $apcuinfo . PHP_EOL, FILE_APPEND | LOCK_EX);

tacituseu’s picture

StatusFileSize
new353 bytes

Tests #30

tacituseu’s picture

StatusFileSize
new560 bytes
Anonymous’s picture

This is not fair: 1 my patch (#29) is fail, all 3 tacituseu's patches are passes.


It's strange that the restart of #25 is slower (although faster than the average):

https://dispatcher.drupalci.org/job/drupal_patches/40781/console
Test run duration: 51 min 31 sec

https://dispatcher.drupalci.org/job/drupal_patches/40783/console
#25/1: Test run duration: 28 min 59 sec

https://dispatcher.drupalci.org/job/drupal_patches/40784/console
Test run duration: 50 min 14 sec

https://dispatcher.drupalci.org/job/drupal_patches/40793/console
#25/2: Test run duration: 41 min 26 sec


Looks like ideas with lock (#31) and cache (#32) have sense. Let's check with additional delay/limit.

+ check patch from #2704571: Add an APCu classloader with a single entry.

Anonymous’s picture

StatusFileSize
new558 bytes
Anonymous’s picture

StatusFileSize
new345 bytes

Edit: Random Order vs Random Fail. Take the popcorn)

If the uniform distribution of rest-tests helps, then the #2910883: Move all entity type REST tests to the providing modules becomes quite important like workaround.

tacituseu’s picture

#35: good one, fight random with random, somehow makes perfect sense ;D.

Anonymous’s picture

Yep)

#1596472: Replace hard coded static cache of entities with cache backends one more issue that can help with checking the cache max limit.

Anonymous’s picture

StatusFileSize
new593 bytes
Anonymous’s picture

Anonymous’s picture

Anonymous’s picture

tacituseu’s picture

StatusFileSize
new272.18 KB
new272.25 KB

Processed test durations attached.
In fast run (#25) Drupal\system\Tests\Module\InstallUninstallTest takes 10 minutes, in the slow one (#8) it lingers for 47 minutes and there's plenty of slow Drupal\Tests\rest\Functional\* tests (they are at least 10x slower vs fast run).

Edit: hiding not intentional (cross-post) ;)

tacituseu’s picture

StatusFileSize
new540 bytes
Anonymous’s picture

StatusFileSize
new1.29 KB

2017-11-24 11:36 commited #2800873: Add XML GET REST test coverage, work around XML encoder quirks. Per #39 it means + 141 test (2672 requests).

2017-11-24 13:54 the first know problem with apcu memory https://www.drupal.org/pift-ci-job/819166.

#8: The runtime of tests became slower, with the increase in the number of rest-tests.

Checking the rest tests also shows that the first tests pass quickly, and the last tests very slowly. And sometimes the CI just gets stuck.


#39:
  • header no-cache - not help
  • apc cache by_default off - not help

#40:

  • concurency 1 - perhaps help
  • max cache 10000 - not help

#41:
special test - bad patch :(
force exception (trying refresh something) - not help
4 concurency - perhaps help


So, with a decrease concurency, a large set of rest tests is more stable.

Anonymous’s picture

#31: index.php with lock operations also helps, by #30?
#35: Shuffle tests also helps, perhaps because rest-tests do not go one by one.

tacituseu’s picture

Re #45: I think with #25 it just was lucky first-run, so not much hope for #30, #31.
It does look to me like you're right about #2800873: Add XML GET REST test coverage, work around XML encoder quirks, removing Drupal\system\Tests\Module\InstallUninstallTest in #43 didn't make them faster.

Anonymous’s picture

StatusFileSize
new2.69 KB

And since the rest tests have been working for a very long time, the error hardly lies in them. Most likely they just became a good catalyst when a too long continuous series of rest tests was formed.

#44: it seems just a lot of requests are not enough (or I did it wrong). Let's check with a little payload like creating a node via rest.


#41: with concurency = 4 the 1000 runs green, but with concurency = 31 was 'CI aborted' after 558 runs (#38). Hm.. 558 = 31 * 18
Anonymous’s picture

StatusFileSize
new1.65 KB
new74.33 KB
new4.07 KB

The graph shows the speed of slowing down the tests. And the fracture comes quite sharply. o_O
wtf4

Anonymous’s picture

Many rest-tests without post-method (😢). So we can focus on GET. And also the data format (json response is much shorter than html, which can shorten the transmission time).

Anonymous’s picture

POST? Edit: Yes, it is.

Anonymous’s picture

StatusFileSize
new799 bytes

Edit: Perhaps after disallow PATCH/DELETE the effect will increase, but this can be simply because the tests themselves are shortened after it.

Anonymous’s picture

Well. What can this accumulate between tests, which results in a sharp decline in performance after a certain number of tests?

And why is the reduction of concurency possible to solve this leak (it just gives more time to refresh something?)

Anonymous’s picture

Let's check pure requests on creating node instances.
Also bit improve wtf.php graphics generator (now full c/p from https://dispatcher.drupalci.org/job/drupal_patches/40983/consoleFull). This is still not very convenient and ugly, but bit better.

Typical CI testing: https://dispatcher.drupalci.org/job/php7_mysql5.5/4530/consoleFull
build_id-4530

Shuffle CI testing: https://dispatcher.drupalci.org/job/drupal_patches/40837/consoleFull
shuffle-build_id-40837

Anonymous’s picture

Yep! Rest tests are not to blame! (and I never doubted it 😁)

Pure requests on creating node lead to the same result in #53:
post-53-build_id-41017.png

I also remembered that we already had problems with long-time requests: #2866056: ResourceTestBase should not have a timeout. We switched to the BTB client, where it without time limit (for convenience of debugging). But it seems it has helped not only to debug, but also concealed the leak.

tacituseu’s picture

@vaplas: very interesting :)

Trying #50 forced to use localhost for requests.

Edit: also noticed that something is going on with the CI servers, plenty of jobs missing, some have "No tests found" now (https://www.drupal.org/pift-ci-job/835800).

Anonymous’s picture

@tacituseu, :)

#54: incorrect count nodes (2 node for me, instead of 300 for Mr. Bot), sorry.

Edit: Oh 😱 470 in the patch name, but 465 in the real! But 465 is up to the tipping point. I counted 470 before sending the patch, but corrected only the name. My super bad (((

Anonymous’s picture

StatusFileSize
new1004 bytes

o_O. 2 (#54) or 300 (#56) for Mr. Bot is practically indifferent. Apparently because of the magic fixation from @tacituseu with a locking write file.

Edit: I'm very sorry, see Edit in prev post.

tacituseu’s picture

Even if there isn't anything wrong with #2800873: Add XML GET REST test coverage, work around XML encoder quirks itself, it does look like it is responsible for current state of things (as mentioned in #47). I don't hang around REST and test conversion issues so can't really be of much help, if it would 'ring bells' to anyone what might be behind it, I'd expect it would be @Wim Leers.

Re #57: trying more test runs for them.

tacituseu’s picture

StatusFileSize
new971 bytes

Also 'Less magic' version ;)

tacituseu’s picture

StatusFileSize
new971 bytes

Now also with less manual patch editing bugs ;)

Anonymous’s picture

#58: @tacituseu, absolutely agree! It's silly not to ask for help from @Wim Leers, especially in such a topic as REST. I sent him a request to help in one of rest-issues.


But perhaps we are trying to combat the problem at the wrong pitch. Even if we did not have a single rest-test, why the number of tests in #53 affects their speed of execution? Are they not idempotence? If for the first attempt the test is performed in 2 seconds, then why does it take up to > 20 minutes after 500 attemps?
tacituseu’s picture

StatusFileSize
new999 bytes

Forgot to release the lock...

Anonymous’s picture

Title: Ignore: patch testing apcu » Testing fails 'CI aborted' and 'apcu memory'
Issue summary: View changes

Updated title and IS

Anonymous’s picture

StatusFileSize
new999 bytes

#62 handmade semaphore - nice idea! Bit fix (r+ / a+)

tacituseu’s picture

StatusFileSize
new1.16 KB

Having hard time re-inventing this wheel, might as well use proper one ;)

Edit: yeah, based it on what Symfony did, but botched it somehow, this one uses the proper component.

tacituseu’s picture

17:46:23 Error: Status 500 trying to pull repository drupalci/php-7.0-apache: "<html><body><h1>500 Server Error</h1>\nAn internal server error occured.\n</body></html>\n\n"

Edit:
Also this tweet from @drupal_infra.

tacituseu’s picture

StatusFileSize
new1.16 KB

Aaaaany time now... ;)
Edit: No symfony/filesystem in core...

tacituseu’s picture

wtf.php'ed results from #64 and it helps a little, but shuffle still wins.

tacituseu’s picture

tacituseu’s picture

Issue summary: View changes
StatusFileSize
new956 bytes

Patch from #54 + disabled debug output handler.

tacituseu’s picture

StatusFileSize
new694 bytes
tacituseu’s picture

Issue summary: View changes
tacituseu’s picture

StatusFileSize
new6.94 KB
new3.09 KB

Edit: apc-usage-track-1.patch: by forcing deleting of expired entries from APCU cache in ApcuBackend it manages to end the tests without filling it up (500MB free at the end), the one fail is just from ApcuBackendTest not expecting this behaviour.

Also, from Drupal\Core\Cache\ApcuBackend:

     // Expiration is handled by our own prepareItem(), not APCu.
    apcu_store($this->getApcuKey($cid), $cache); 
  public function garbageCollection() {
    // APCu performs garbage collection automatically.
  }

I don't think APCU cache works the way ApcuBackend assumes, ApcuBackend doesn't set $ttl

from http://php.net/manual/en/function.apcu-store.php

	ttl
Time To Live; store var in the cache for ttl seconds. After the ttl has passed, the stored variable will be expunged from the cache (on the next request). If no ttl is supplied (or if the ttl is 0), the value will persist until it is removed from the cache manually, or otherwise fails to exist in the cache (clear, restart, etc.).

so it just fills up
Edit: data analysis/graphing failure :(

tacituseu’s picture

StatusFileSize
new3.28 KB
dagmar’s picture

I'm not sure if this helps, but while working on #2339235: Remove taxonomy hard dependency on node module I just saw a similar situation with an EntityResource. I created #2931027: TermJsonCookieTest is failing locally but TermXmlCookieTest works

tacituseu’s picture

StatusFileSize
new3.53 KB

Edit: Trying to get an overview of what lurks in the cache, as the usage stats script seems to be compute intensive (aborted bad run in #73) I'm firing it only for the first occurrence, but in order to get it I need to catch a bad run.

Anonymous’s picture

StatusFileSize
new26.06 KB
new4.45 KB

While @tacituseu carries out clever heuristic research (👍), I'm playing with wtf-charts. The new version allows to more clearly compare the time ranges of several builds (just specify them in the query args like ?ids=40837+40783+41253+41223).

Here's an example of chart with 'shuffle', '#25/1 lucky builds', + two others from #73.
shuffle-lucky-middle-long.png
So, all except 'random sort' have a straight line on the rest-tests range (long or short). Something is definitely overflowing due to requests.


#75: The problem with testing TermJsonCookieTest is shown only via run-tests.sh? If yes, it is very interesting. However, we have never received an random fail here due to 'No route found that matches' like in your case.

Can you check
php vendor/bin/phpunit -c core core/modules/rest/tests/src/Functional/EntityResource/Term
or
php vendor/bin/phpunit -c core core/modules/rest/tests/src/Functional/EntityResource/Term/TermJsonCookieTest
I cann't reproduce fail with TermJsonCookieTest localy.

Perhaps something with firewall or antivirus or server settings?

tacituseu’s picture

@vaplas: that's one way to call it ;) but I think something does not like it, trying to add tests to #76 I keep getting:

403 - Access denied

Unfortunately, you don’t have permission to enter this area of the site.

...so I'll wind my heuristic'ing down for a bit ;D

dagmar’s picture

Amazing work here, I will try to add some comments from another point of view based on other tickets related to APCU.

#1281408: Add a compressing serializer decorator Mention that:

I did some tests on my local machine and it turns out that it is also faster for almost every size of cache data

But also needs profiling. Maybe this issue can help to determine if the use of compressed caches is improving testing speed.

Then, #2765271: Rationalize use of the 'discovery' cache bin, since it's stored in the limited size APCu by default

Gzipping data effectively saves 80% size with minimal CPU cost. We use this compressed backend in redis successfully for quite some months. See

And finally #2832450: Multilingual config cached in "config" cache bin; quickly reaches APCu memory limits

Are some of the resources tests running with different languages?

Mixologic’s picture

Heyo, testbot maintainer here.

Feel free to hit me up anytime y'all want to work on a real testbot too. I can put your ssh key on one, and we can set the timeout to however long we need to do any analysis.

And yes, the testbots are now configured to use a network, but really that means that instead of http://localhost, there is just an entry inside of /etc/hosts for the container pointing at 127.0.0.1, so in essence, it'd still using localhost.

Re #55

some have "No tests found"

Thats me doing branch test cleanups. Any passing tests that had a newer, passing build on dispatcher had its build removed. HOwever, it wasnt supposed to cause core to re-fetch those tests, which caused those to not be able to find the result set. I'll have to see why those are re-fetching, and restore them, but assume they are just passing branch tests.

The other thing that has changed recently is that we're now on a different underlying hardware instance (c4.8xl's, and we used to be on cc2.8xls) - which means we have 36 cpus instead of 32.

tacituseu’s picture

@Mixologic:
1. if there are 4 more cores, wouldn't it make sense to raise concurrency to 35 ?
2. how to get logs out of an aborted run, the 'Build Artifacts' are somewhat scarce for them (e.g. https://www.drupal.org/pift-ci-job/837848 from #73).
3. any idea what might have caused #78 (had Internet issues at the time so possibly IP changed, but don't see how that could be the cause) ?

tacituseu’s picture

StatusFileSize
new8.46 KB

Trying to find out what is responsible for flushes.
Edit: incomplete patch, needs work, also there are more players to this, might even be some rogue apcu_clear_cache().

Mixologic’s picture

Re #81

1. It might, but I've tried running the testbots on a machine with considerably more cores, and after a certain point, cpu stops being the limiting factor, and there is some other resource blocking. I've been intending to upgrade the kernel on the testbots in order to fire up some eBPF tracing to get us some observability and see if I can make some adjustments. It might be that apache config is the bottleneck, or disk iops, or the db.
2. Theres not a lot we can do to get more build artifacts, other than setting up a special environment that doesnt time out. when jenkins kills the build, it kills it before anything finishes gathering artifacts.
3. I cant really understand how you're getting an http response code in #78 at all? does the file_put_contents resolve to a url or something?

Anonymous’s picture

Sorry, I fell out of this fight a little. Thanks to @dagmar and @Mixologic for additional assumptions and feedback! And, of course, thanks to @tacituseu for his relentless struggle with it!

I want to test #53 a bit more intensively (sorry for this retrospective noise).
Why? Because #56 was not only passed, but it also has incredible acceleration if compare with #53. However, this did not happen in #64, where we realized the supposed cause of acceleration. This is a bit strange.


Edit:
  • apcu_clear_cache shows excellent speed
  • concurency = 4 works more stable and speedy than 31
  • lock the file and lock with write are identical in work, and do not speed up, although they more stable and prevent slaughter, than pure testing.

84-charts.png

tacituseu’s picture

Re #83
Thanks for the info.
3. I mean, when I click Add test / retest trying to add another run I'm redirected to https://www.drupal.org/403 o_O.

Edit: thinking about it, it could just be messed up node_access table entry on d.o.

tacituseu’s picture

StatusFileSize
new3.53 KB

re-upload of #76
Edit: I think trying to catch it when the apcu_store is already failing is too late, most likely at the same time another request is emptying it.
Also should be apcu_cache_info() instead of apc_cache_info() in original script.

Anonymous’s picture

Edited after the results:
It seems we have a new champion in speed!
apcu_clear_cache-vs-shuffle


The second launch was with PHP 5.5 (so it's 1.5 slower). Apparently @snehi decided to joke us ;) (although perhaps this is really a useful test, I just did not immediately notice the version of the PHP and a bit confused by the contrast in speed)
#56 performance was due to my stupid mistake. I indicated the wrong number runs in the patch, and it was performed before breaking point. So the slow speed 'file lock' in #84 now perfectly correlates with the other research about it.
15 and 24 concurency already stuck.
tacituseu’s picture

StatusFileSize
new3.58 KB

Re #84: nice, too bad apc.entries_hint is PHP_INI_SYSTEM only

Edit: too slow, other request flushed cache before it started gathering statistics, so the one caught is right after the flush.

Anonymous’s picture

StatusFileSize
new28.21 KB
new589 bytes

#88: woot! I applied this frontal clean cache under the influence of your analysis 💎. Are we close to catching this beast by the tail?)


Also I made a diabolically unfortunate mistake in #56 (see the updated Edit). Very sory :(
tacituseu’s picture

Re #88: maybe with shuffle+apcu_clear_cache it will go under 15min ;)
Looks like you called it in #23 :).

Anonymous’s picture

StatusFileSize
new551 bytes

#90: xD

tacituseu’s picture

Perhaps this will do it ?
Edit: botched it again...

tacituseu’s picture

StatusFileSize
new9.3 KB

Edit: still not able to catch the APCu cache flusher, it might mean it is outside of \Drupal.

tacituseu’s picture

StatusFileSize
new733 bytes
new733 bytes

Edit: no luck, concurrency 35 variant same as 31, 48 variant slower.

Mixologic’s picture

So, this is revealing of something which may be related to apcu in general. It's supposed to *speed things up*, and for a while, we didnt have it at all on the php7 environments, because it didnt exist.

https://www.drupal.org/project/drupalci_environments/issues/2847419

When I added it, we lost about 5 minutes per test.

Adding apcu_cache_clear() at the end of a browser test is *not* just clearing out that tests cache. Its dumping the entire cache, including whatever it is we've got cached for the other 31 processes running elsewhere.

Im guessing that whats going on here is that we're getting heavy apcu fragmentation, we're dumping the whole thing randomly as well:
https://medium.com/@davidtstrauss/avoiding-the-pitfalls-of-apcu-4aa9de00...

I might fire up a server and just completely disable apcu to see what the timing is like.

tacituseu’s picture

Re #95: patch in #93 is trying to catch
the code path of flushing mechanism, but I'm still missing something, the Drupal\Core\Cache\ApcuBackend itself tries to play nice with others:

   * APCu is a memory cache, shared across all server processes. To prevent
   * cache item clashes with other applications/installations, every cache item
   * is prefixed with a unique string for this site. Therefore, functions like
   * apcu_clear_cache() cannot be used, and instead, a list of all cache items
   * belonging to this application need to be retrieved through this method
   * instead. 

There is apcu_clear_cache in Doctrine\Common\Cache\ApcuCache (doFlush()), that's why in #82 I mentioned it might be unexpected/done outside of Drupal cache backend (see the apcu-free-over-testrun-40852.png graph).
I also expect plotting @vaplas'es graph with APCu free over time one will show that the flat spots/slowdowns are when the cache is full (my LibreOffice is having issues with the dataset size though ;)).

Then there are also
Drupal\Component\FileCache\ApcuFileCacheBackend, Symfony\Component\ClassLoader\ApcClassLoader that seem to have no concept of flushing.

tacituseu’s picture

StatusFileSize
new66.91 KB

Here's the chart made from reduced set (5K out of 44K), reason I had problems with graphing might be because some test are running in different timezone and I didn't use UTC (duh!), charts overlaid by hand in graphics editor, so it might have slight offset, but it correlates well enough ;).

/files/issues/completion-vs-apcu-free-40852.png

Mixologic’s picture

I just re-ran the current test suite with apcu completely disabled (well, I hacked all the checks looking for apcu_fetch to look for Xapcu_fetch), and we yielded:

Test run duration: 22 min 10 sec

APCu is not helping the tests run faster.

tacituseu’s picture

StatusFileSize
new3.16 KB

This will try to gather stats every 5 minutes, instead of hoping for bad run and luck catching (#88 was too slow, other request cleared it when it was trying to gather stats).

Edit: running into php memory limit... but even with barely anything in it (15M) there was 15K entries.

tacituseu’s picture

StatusFileSize
new3.2 KB

Trying simpler version.

Edit: still exhausting memory, but even at only 253.77MB used there are 250K entries !

20171221105042-0800;D;Free: 1736.04MB
Entries: 250974
Total user: 253.77MB

133623k - drupal.class_loader
42022k - drupal.file_cache
84216k - drupal.apcu_backend
tacituseu’s picture

StatusFileSize
new1.13 KB

Trying to get it raw.

Edit: this won't work, logs would be GB in size.

tacituseu’s picture

StatusFileSize
new1.85 KB
new3.92 KB

Edit:
apc-usage-track-2.4.3.patch: won't work same reason as #101
apc-usage-track-2.4.4.patch: still not enough memory

Mixologic’s picture

Just tried a test run with 8gb of apcu, php7, sqlite.

Test run duration: 54 min 34 sec

tacituseu’s picture

@Mixologic: try changing apc.entries_hint (to ??? 1-2 millions ???).

tacituseu’s picture

StatusFileSize
new3.92 KB

Edit: 4GB does the trick ;)

20171221230010+0000;D;4096M;Free: 278.4MB
Entries: 1659684
Total user: 1658.57MB

883892k - drupal.class_loader
276535k - drupal.file_cache
537951k - drupal.apcu_backend

A lot of 1K bootstrap:user_permissions_hash:authenticated,ayl5fozd style entries. Leads to Drupal\Core\Session\PermissionsHashGenerator::generate().

Mixologic’s picture

Very interesting. with apc.entries_hint = 4500000: Test run duration: 22 min 36 sec

Edit: also with apc.shm_size = 8000M

tacituseu’s picture

StatusFileSize
new941 bytes

Modified patch from #89.

tacituseu’s picture

@Mixologic: noticed some things poking around:
1. SQLite testruns are only so quick because they don't actually run anything for --types "PHPUnit-FunctionalJavascript" part (see HEAD https://dispatcher.drupalci.org/job/php7_sqlite3.8/5258/)
2. there's relatively new error in apache-error.log:
sh: 1: -t: not found
possibly this ?
3. there's another one in test.apache.error.log
[Thu Dec 21 11:51:33.170639 2017] [:error] [pid 27182] [client 172.18.0.3:33143] PHP Warning: POST Content-Length of 8392099 bytes exceeds the limit of 8388608 bytes in Unknown on line 0, referer: http://php-apache-jenkins-php7-mysql5-5-4554/subdirectory/node/add/article

Re #106: @vaplas'es hunch from #23 100% confirmed, good he stuck to it in spite of my sidetracking :D

Mixologic’s picture

Im skipping the FunctionalJavascript tests on purpose. they run one at a time, and dont do a whole lot to apc anyhow. But interesting that there must be some kind of bug with my recent deploys for sqlite and functionaljavascript tests, so the speed Im reporting is purely the first run of tests, and just run-tests.sh, not the whole build.

2. Thats definitely something trying to send mail. Seen that before.
3. Im not sure what would be posting 84mb articles as a test. does that always happen, or just sometimes?

I tried another test with setting the apc.ttl = 300 to keep the cache evicting on a regular basis, but also keep the shm_size down to 2000M + apc.entries_hint = 1500000

The entries did hover between 900,000 and 1,200,000, fragmentation was at 100% and the tests took Test run duration: 25 min 45 sec

So, Im not totally sure what the best option here is. We definitely want to hint the apc entries, but we also need to clear those out. I dont know enough about the cache bin key system to know whether or not adding another step at the test cleanup phase to iterate over all the cache keys set during a test and evicting them manually will save us any time, or how quick that'd be.

But regardless, we know that we either need to do something to keep memory usage down, or we need to bump up the apc.shm_size to something massive (6-8gb) to never have errors/issues.

Im very tempted to say this is a critical bug in the APC Cache Backend, and that it should properly handle an apc_store() that fails (if it can)

Mixologic’s picture

Just for more confirmation, setting the shm_size to something small, like 200M, took 2 hrs, 36 min to run, and had 15531 exceptions for 'unable to allocate memory for pool'.

So too small creates memory errors, but big enough to hold everything becomes so unwieldy that test time doubles.

Perhaps the best thing really is to set the ttl, unless we have a way to clear out *just* a single tests cached entries.

Anonymous’s picture

#97: Сool graphs. I also tried to draw up it, and this further confirmed it (wtf-memory). But I think I'm late with this :) So just leave a souvenir.
#99:
2930022-99-id-41605.png
#100
2930022-100-id-41623.png
#102/1
2930022-102-id-41640.png
#102/2

I also tried to play with threads (but this is not accurate, because the distribution is done based on the logic of the free threads, not the flow number data). See wtf-clines. And graphs (based on #25/4):
All tests:
31-concurency-full-list.png
Only rest and hal:
31-concurency-rest-hal.png
Only tests that performed more than 100 seconds:
31-concurency-longer-than-100-seconds.png
To be honest, I do not see any benefit from this graph, just for beauty 🎨

#109: Perhaps #2272685: Incorrect handling of invalid cache items in apcu backend fixed this APC bug?

Anonymous’s picture

StatusFileSize
new92.16 KB

(if someone intersing the graph with concurency lines)

-    $data .= "['Concurency $id', '', '$tooltip', new Date($date_start), new Date($date_end)],\n";
-    $data .= "['Concurency $id', '$short_name', '$tooltip', new Date($date_start), new Date($date_end)],\n";

named-blocks-more-100-seconds.png
Filters in the end of function getInfo(). Also more info when hover on block.

Anonymous’s picture

Anonymous’s picture

Oh, I overlooked the #105 research! 🚀
#108: I just sat on this point because of the limit of my knowledge in other areas;) Technically, I was not so sure of anything and just gave out ideas. I'm glad you could get to that in real. 💎

tacituseu’s picture

Re #109:
1. yes, I meant daily testing, not the speeds reported here
3. article is ~8MB in size, just 3.5K over the limit, will try to track that down

Re #110:
selective cleaning should be possible for ApcuBackend, not so sure about ApcuFileCacheBackend and ApcClassLoader, apc.ttl set to default (0) is bad indeed, went over the issues that touched ApcuBackend to see what the intention was but didn't find much besides #2581395: Incorrect expiration in APCUBackend that removed $ttl parameter from apcu_store() calls.

Re #111:
Thanks for proper charts and the script, mine was a bit of a pain, LibreOffice kept crashing or taking forever just to resize/change something even with one data series, so just painted it over your chart ;), also need to start using gmdate() to get consistent timestamps in mem-index.log. #2272685: Incorrect handling of invalid cache items in apcu backend might be a step in the right direction indeed.

tacituseu’s picture

More memory tracking.
Edit: makes no difference but confirmed 'expunges' are responsible for flushes.

Anonymous’s picture

More data - more images!)

41767

  • avail-hits-misses
    41767-avail-hits-misses.png
  • avail-inserts-entries
    41767-avail-inserts-entries.png
  • avail-expunges
    41767-avail-expunges.png
  • avail-peaks-hits-misses-inserts-entries
    41767-avail-peaks-hits-misses-inserts-entries.png

41768

  • avail-hits-misses
    41768-avail-hits-misses.png
  • avail-inserts-entries
    41768-avail-inserts-entries.png
  • avail-expunges
    41768-avail-expunges.png
  • avail-peaks-hits-misses-inserts-entries
    41768-avail-peaks-hits-misses-inserts-entries.png
Anonymous’s picture

tacituseu’s picture

StatusFileSize
new7.88 KB

Re #117: Thanks for the charts :)

Patch trying to limit the main polluter (ApcClassLoader).
Edit: much better... needs more work though
under 1M entries per test-run

tacituseu’s picture

Same for ApcuFileCacheBackend.
Edit: better still. under 300K entries per testrun.

Anonymous’s picture

@tacituseu, be careful, please! A couple more of these patches, and the time for all the tests will be -1 second. This can cause conflict not only between physical laws, but also with my charts (because they are based on the fact, that the time of first test is less than the last test). 😱

Charts:

BTB::tearDown() apcu_delete(new \APCUIterator('/^' . $this->databasePrefix)) # not works
41813-avail+hits+misses+inserts+entries.png


index.php:: apcu_clear_cache()

41814-avail+hits+misses+inserts+entries.png


DrupalKerner::initializeSettings prefix magic
41815-avail+hits+misses+inserts+entries.png
DrupalKerner::initializeSettings + setConfiguration prefix magic
41818-avail+hits+misses+inserts+entries.png
tacituseu’s picture

@vaplas: Thanks :D, aaaalmost there, there might be some problems with this approach judging by the test failures, might get faster yet with proper hinting in environments, and increasing cache size to 2,5GB.

Anonymous’s picture

StatusFileSize
new2.76 KB

Yep, in secret from everyone, I hoped that solving this problem would lead to a solution for #2906317: Random fail due to problems with database too) But looks like not.

Attempt to clean up the failures in ClassLoaderTest.

tacituseu’s picture

Mixologic’s picture

wow wow wow. This is awesome work.

Anonymous’s picture

Well, @tacituseu noted that this settings were removed due to random fail in Update tests (#2749955: Random fails in UpdatePathTestBase tests). Let's check how they behave now. Also, looks like the shared prefix is not suitable for testing ClassLoaderTest. Apparently for such tests we need to leave a unique prefix.

The patches uses #124, although it seems #120 faster.
Perhaps we can also change getApcuPrefix() using #120 approach. (Maybe even in a separate issue, but now just quick workaround to eliminate a strong subsidence in testruns).

Anonymous’s picture

oops, an incorrect mask for *Update* tests.

Anonymous’s picture

Hm.. "update* tests" while work without random fail. By my typo with filter Update* tests showed strange subsidence when spinning only one test (#126). Perhaps an increased number of collisions or fragmentation.
2930022-124-update-tests.png


Checking the same patches, but with #120.
Anonymous’s picture

tacituseu’s picture

Re #126: #124 is equivalent to #120, while trying to make those bins reusable I noticed that this was just re-inventing it. Random fail in UpdatePathTestBase tests was caused by garbage collector bug (#2828559: UpdatePathTestBase tests randomly failing).

tacituseu’s picture

StatusFileSize
new9.6 KB

Just to be sure, patch from #126 with logging.

Edit: yup, speed and entries-wise same as #120 and #124 but less hack'y and without the failure, still would like to see how it fares on environments with proper hinting but it's pretty much up to the maintainers what to do now.

Anonymous’s picture

#128oh, apcu is a dangerous thing, it should be kept away from children.

#130: @tacituseu, thanks for the correction as always!

#131:

+++ b/sites/default/default.settings.php
@@ -785,3 +785,6 @@
+$settings['apcu_ensure_unique_prefix'] = FALSE;

remained cheat :)

Also logging UpdatePathTestBaseTest tests from #126.

tacituseu’s picture

StatusFileSize
new9.19 KB

Re #132: Thanks for correction :D, applied wrong patch (apcu-ensure-unique-prefix-false-mem-track.patch) on top of yours, no idea how I managed to do that (/facepalm).

Re #128: some of the bins (especially drupal.apcu_backend) are required to be per-instance (that's why I only touched drupal.class_loader and drupal.file_cache).
Drupal\Core\Cache\ApcuBackendFactory does:

  public function __construct($root, $site_path, CacheTagsChecksumInterface $checksum_provider) {
    $this->sitePrefix = Settings::getApcuPrefix('apcu_backend', $root, $site_path);
    ...
  }

hence the failures.

Edit: 2930022-124-prod-mem-track.patch: around 400K cache entries and slightly lower hits/misses ratio (93).

Anonymous’s picture

StatusFileSize
new26.07 KB
new33.12 KB
new96.6 KB

#132: It seems, when configuring apcu prefix via prepareSettings(), it does not works for UpdatePathTestBaseTest (or does not work well enough). But this is strange, because UpdatePathTestBase call this method:

  public function installDrupal() {
    $this->initUserSession();
    $this->prepareSettings(); # HERE!
    $this->doInstall();
    $this->initSettings();

    $request = Request::createFromGlobals();
    $container = $this->initKernel($request);
    $this->initConfig($container);
  }

There may be something else with the installation or update process?


Unfortunately, mem-track for update.php does not collect as much information as index.php (peaks analysis did not reveal any oddities).
But you can see how apcu memory quickly ends and then starts again.
41927-avail.png
Perhaps it also makes sense to pay attention to /core/rebuild.php (it seems there is also work with apcu)?
tacituseu’s picture

Checked for /core/rebuild.php in #93, looks like it isn't tested/used during testrun (log).

Anonymous’s picture

#93/#135 wow, really! It was one of the periods, when I did not keep up with your research :) 🏎️


#134: Perhaps the tests for updates are simply themselves heavy, and therefore reduce memory faster. But a couple of additional scans can not hurt. (Surely, most apcu heavy process is doInstall() and runUpdates(). But how much? And what if something suddenly appears due to concurency.)

Edit:
Well, if I did not get it wrong, the most apcu memory loss occurs during installation (this is not a surprise).
id41983-avail.png
But the delays is not there. They occur in UpdatePathTestBase::runUpdates(). Between

$this->drupalGet($this->updateUrl);
...
$this->checkForMetaRefresh(); # included

Here is the zoomed size of this period.
id41983-zoom-sector-12-30-minutes.png
See also 41983-statistics.txt with full times between these methods. TL;DR:

# Examples of long timeout (seconds)
test34689737/testUpdateHookN: 4069
test29188852/testDatabaseLoaded: 4067
...
# Examples of short timeout (seconds)
test38381948/testDatabaseLoaded: 21
test35310684/testUpdateHookN: 13
Anonymous’s picture

Data for the previous post (will be updated soon).
Edit:

UpdatePathTestBase::runUpdates():
$this->checkForMetaRefresh();
here is a method in which the freeze occurs! (if the calculations are correct, of course).

tacituseu’s picture

@vaplas: not sure, but it could be because updates are run via Batch API and $this->checkForMetaRefresh(); just waits for batch to finish.
Edit: still 4069 is quite a bit too long.

Anonymous’s picture

#138: @tacituseu, great points!


1. Looks like checkForMetaRefresh() is a really over-patient method, and it can give way to many other methods (including the same checkForMetaRefresh() methods from other tests). (proof log calls between updateUrl and checkForMetaRefresh of the most prolonged test from #136
2.

still 4069 is quite a bit too long.

Fair enought) Unfortunately, this is not a time collapse, In a new method of statistics, I subtracted one date from another, without converting to timestamp
(/facepalm).

The real data:
#136:

Seconds time between 'updateUrl' and 'checkForMetaRefresh'

test80722149/testUpdateHookN: 677
test89821582/testUpdateHookN: 648
test87334145/testUpdateHookN: 636
...

#137 (it has more short periods):

Seconds time between 'updateUrl' and 'checkForMetaRefresh'

test34799778/testUpdateHookN: 332
test26284507/testUpdateHookN: 332
test22762560/testUpdateHookN: 332

And more accurate (exactly around the checkForMetaRefresh)

Seconds time between 'after Apply pending updates' and 'checkForMetaRefresh'

test22762560/testUpdateHookN: 331
test34799778/testUpdateHookN: 331
test26284507/testUpdateHookN: 329
Anonymous’s picture

Looks like checkForMetaRefresh() is a really over-patient method, and it can give way to many other methods (including the same checkForMetaRefresh() methods from other tests).

Just for interest, I counted how many other checkForMetaRefresh() methods, while test80722149/testUpdateHookN was frozen. Answer:30 (+1 himself). Also exactly 30 new tests were started (+1 himself).

In other words, the test test80722149/testUpdateHookN was completed only after 30 others checkForMetaRefresh() calls had accumulated in the queue. Wow.

Edit: Okay, this is what @tacituseu said in #138. Now I can more clearly imagine why all 31 concurency were stretched. They're just all waiting until the free Batch. Which may freeze in anticipation of the one X test. And this X test could hang because of problems with the apcu memory (collisions or fragmentation).

Anonymous’s picture

#139: Wow, Batch creates some kind of insanity. 11 Mb log (vs 2 Mb in #137).
interdiff between 137/139:

+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
+++ b/core/tests/Drupal/Tests/BrowserTestBase.php
@@ -1317,16 +1317,33 @@ protected function getTestMethodCaller() {
    *   Either the new page content or FALSE.
    */
   protected function checkForMetaRefresh() {
+    $this->log('checkForMetaRefresh start');
     $refresh = $this->cssSelect('meta[http-equiv="Refresh"], meta[http-equiv="refresh"]');
     if (!empty($refresh) && (!isset($this->maximumMetaRefreshCount) || $this->metaRefreshCount < $this->maximumMetaRefreshCount)) {
       // Parse the content attribute of the meta tag for the format:
       // "[delay]: URL=[page_to_redirect_to]".
       if (preg_match('/\d+;\s*URL=(?<url>.*)/i', $refresh[0]->getAttribute('content'), $match)) {
+        $this->log('checkForMetaRefresh after getAttribute()');
         $this->metaRefreshCount++;
-        return $this->drupalGet($this->getAbsoluteUrl(Html::decodeEntities($match['url'])));
+        $result = $this->drupalGet($this->getAbsoluteUrl(Html::decodeEntities($match['url'])));;
+        $this->log('checkForMetaRefresh return result');
+        return $result;
       }
     }
+    $this->log('checkForMetaRefresh return FALSE');
     return FALSE;
   }

The slowest test: test37230327/testUpdateHookN:
  1. checkForMetaRefresh() was called 62 times:
  2. first: 20171227160913;test37230327/testUpdateHookN: checkForMetaRefresh start;...
  3. last : 20171227162220;test37230327/testUpdateHookN: checkForMetaRefresh start;...
  4. time between first/last: 13 minutes 7 seconds.

The fastest test: test53660275/testUpdateHookN

  1. checkForMetaRefresh() was called 16 times:
  2. first: 20171227154818;test53660275/testUpdateHookN: checkForMetaRefresh start;...
  3. last : 20171227154841;test53660275/testUpdateHookN: checkForMetaRefresh start;...
  4. time between first/last: 23 seconds.
wim leers’s picture

I don't know how to help here, except say … WOW, impressive research! 😲👏

Anonymous’s picture

@Wim Leers, thanks for the response and inspirational words!

#128-#141: additional research of Update test. Perhaps we can find here something of value. Perhaps not. Unfortunately, I do not know @tacituseu's plan. But it seems to me, that no one is against to commit #2926309-41: Random fail due to APCu not being able to allocate memory (at least like hotfix). Because now issues fail very often, and it's not pleasant.

tacituseu’s picture

@vaplas: For me the failure part is pretty much figured out now, the fix is already implemented so it is just about re-enabling it, I'm all for leaving APC enabled on test runners (even if it doesn't make much difference in speed there as everything is running from RAM anyway - it is important on live sites, so stress testing it is valuable), so +1 for #2926309-43: Random fail due to APCu not being able to allocate memory.
Before doing more tuning I'd like to see apc.entries_hint increased in environments (as a follow-up to #2926309: Random fail due to APCu not being able to allocate memory), to make sure we're not dealing with the same bottleneck.
I would also like to see some hook_requirements follow-up to warn users if their apc.entries_hint is set too low, but that might be tricky, would need to figure out how much standard install is using, to at least recommend something within the order of magnitude.

Anonymous’s picture

@tacituseu, thanks for the detailed explanation. I thought so, because in fact #2926309-43 this is actually your proposal) But in such difficult things for me, I decided not to take risks with statements from your person)

Anonymous’s picture

#2926309-60: Random fail due to APCu not being able to allocate memory shows, that *Update* test work better with unique apcu prefix, when multirun 1 tests:
UpdatePathTestBaseFilledTest-same-vs-unique-prefix.png

However with different update tests we haven't so terrible delays:
different-update-tests.png

And with all tests we have practically no difference with or without unique prefix for update tests (and for update+install tests too):
compare-with-unique-prefix-for-update-and-update_install.png


x500-UpdatePathTestBaseTest-scan with unique prefix also gives the better result:
  • The slowest test: test47315487/testUpdateHookN (54 seconds)
  • The fastest test: test97493138/testUpdateHookN (15 seconds)

Chart available memory:
id42601-avail.png

My main assumption of the advantage of the unique prefix when testing 1 test with many runs: this is just the best avoidance of collisions.

Anonymous’s picture

Anonymous’s picture

tacituseu’s picture

@vaplas: there's one tiny problem with those tearDown() tests... ;)
Edit: also need to add more data to update.php as you noted in #134.

Anonymous’s picture

@tacituseu: ))) 🙏. Thank you, and thank @alexpott! Indeed #148 absolutely no apcu effect :(

So, let's check 2934002-6.1 from @catch.

Edit:
with unique prefix and apcu_clear_all:
post-150-unique-prefix-clear-all.png


with shared prefix and apcu_clear_all:
post-150-shared-prefix-clear-all.png
with unique prefix and clear by test: stuck after 34 tests (???)
tacituseu’s picture

StatusFileSize
new8.84 KB

Edit: oops, that won't work nicely after #2926309: Random fail due to APCu not being able to allocate memory ;)
Edit: buggy/nasty patch DO NOT add retests.

tacituseu’s picture

StatusFileSize
new9.73 KB

Edit: buggy/nasty patch DO NOT add retests.

Anonymous’s picture

Very interesting! But it seems #151 filled the entire disk, and now running again. Can we somehow stop it?

tacituseu’s picture

Cancellation requested, can't do much more.

Mixologic’s picture

Yes, whatever extra logging you're trying to do in #151 stuffed about 36GB into mysql. There's an issue with the testbots where if you do this, the disk fills up but the testrunner doesnt know to pull itself out of the rotation, and then it flushes the rest of the queue with broken tests.

Please, please, do not do this.

tacituseu’s picture

@Mixologic: Sorry about that, it wasn't extra logging, just the amount of errors/browser_output generated by flushes not just flushing after their own test but also for all the others running.
Edit: actually there was a bug in added file flush.php, it calls Cache::getBins() which depends on Drupal::getContainer(), which isn't available yet.

Mixologic’s picture

ah. I think I actually got the disk space issue resolved as a result of this. Seems like jenkins wasnt respecting the default "out of space dont use this node" settings, and now that I bumped them higher it shouldnt affect other tests. Carry on.

Anonymous’s picture

#157: Mixologic 💎💎💎 Cool improvement!


Let's check #2704571-13: Add an APCu classloader with a single entry on the rate of available memory decrease.


#150: Hm, apcu-clear_by_test-unique stuck after 34 test. Perhaps this partial cleaning significantly increased fragmentation. Or APCUIterator somewhere loops when used for delete. Or I, as always, screwed up.

Edit:
with unique prefix and spec APCu classloader:
post-158-unique-prefix-43053.png


with shared prefix and spec APCu classloader:
post-158-shared-prefix-43052.png
Anonymous’s picture

Charts for #150 and #158.

Hm.. The economy of available memory is not detected. Although locally, it reduced the number of apcu entries even with a shared prefix x5 times. Bit strange to me.

#2926309-66: Random fail due to APCu not being able to allocate memory

I bumped the apc.entries_hint to 500,000 to give it a better subdivision, and bumped the memory to 3GB to see if I could avoid an overflow.

Perhaps in the overflow there is no big trouble. In some of our tests, memory was full many times, and everything worked (example, last chart in #146) Edit: I'm lol. Last chart from #146 hasn't overflow memory (minimal memory on the right scale far from zero)

Anonymous’s picture

Looks like DrupalCI without free space again?( (https://dispatcher.drupalci.org/view/D8%20Core%20Patches/job/drupal_patc...)
Edit1:
Perhaps after:

Also I came across a very interesting issue from @Chi: #2828706: ExceptionLoggingSubscriber should not log HTTP 4XX errors using PHP logger channel.

The execution time of the no-js tests with patch is 19 min 2 sec.

Can this cause sagging? By the way, in rest/hal tests, access without permissions is pretty much tested too.

Edit2: Or #2931883-12: Unneeded always_populate_raw_post_data requirements check while on CLI. Test run duration: 18 min 59 sec.

Anonymous’s picture

StatusFileSize
new24.93 KB

https://www.drupal.org/pift-ci-job/849945 vs https://www.drupal.org/pift-ci-job/852382
2931883-vs-default.png
REST tests run twice as fast o_O! HAL tests without changes.
Edit: simply because the tests became two times less: 146 (8.4.x) vs 305 (8.5.x). Why i'm so lol(((

tacituseu’s picture

StatusFileSize
new7.06 KB

Re #159: Looks like #146 charted cli-side APCu usage. Attaching latest mem-tracker.
Re #160: This is weird, don't remember high-error runs (2-3K) causing this issue before.
As for #2828706: ExceptionLoggingSubscriber should not log HTTP 4XX errors using PHP logger channel it ran on 8.4.x, which takes as long even without the patch.

Anonymous’s picture

@tacituseu you absolutely right as always! I'm overlooked versions (8.4 vs 8.5).

tacituseu’s picture

It also looks like the expunges now happen at much lower usage (still 540MB available vs 34MB it used to be), so it must be terribly fragmented.

Anonymous’s picture

Quick combine mem-index + mem-update (+undefined instead of prev value on count-tests line):
43132-update-index-mem-track.png
At first glance, only the statistics on peaks have changed.

Checking mem-track without slow-tests.

Anonymous’s picture

StatusFileSize
new8.9 KB
new16.25 KB

Unsuccessful theft #43 :)

Anonymous’s picture

Patches with #152 via controller.

#164: sounds very logical.

#166: while nothing suspicious detected. The profit in resources related with diff tests.

Anonymous’s picture

StatusFileSize
new8.11 KB
tacituseu’s picture

@vaplas: I doubt #168 will work, as there is effectively no garbage collection in ApcuBackend, try adding $ttl argument to apcu_store() to get desired effect.

Also possibly only 'apcu_backend' bins needs flushing for reasons mentioned in #133.

Anonymous’s picture

StatusFileSize
new8.42 KB

@tacituseu++! It really works) Min available apcu memory > 1 970 000 00!
43187-avail.png
with other metrics
43187-avail+hits+misses+inserts+entries.png

Anonymous’s picture

Edit:

TTL 10 seconds

  • Max entries: ~67969
  • Min avail: ~2 000 881 000

ttl-10s-43192-avail+entries.png

TTL 200 seconds

  • Max entries: ~120261
  • Min avail: ~1 722 322 000

ttl-200s-43193-avail+entries.png

Anonymous’s picture

Edit:
#171: Yes. Jump of entries count near 8 minute due to *Installer* tests.

TTL 200 seconds (without installers tests):

  • Max entries: ~80101
  • Min avail: 1 747 580 000

ttl200-without-install-43197.png

Anonymous’s picture

StatusFileSize
new45.76 KB

Based on the results, I can assume next:

  • 'apcu_store(): Unable to allocate memory for pool.' - it is due to apcu memory.
  • the best way to clear expire apcu entries - it is via apcu settings.

Well.

Anonymous’s picture

Edit: same data like with simpletest.

tacituseu’s picture

tacituseu’s picture

it moved ;)

tacituseu’s picture

StatusFileSize
new11.3 KB

Looks safe ;) Funny thing is the deleteAll() iterator seems to match nothing ;?

tacituseu’s picture

StatusFileSize
new10.42 KB

Edit: ugh... right... about that tearDown().. )) ;)

tacituseu’s picture

StatusFileSize
new11.75 KB
tacituseu’s picture

StatusFileSize
new11.75 KB
tacituseu’s picture

StatusFileSize
new12.78 KB

Just trying to figure something out, ignore this series (starting from #175).

Mixologic’s picture

Im really sad about #160 . I really hate how jenkins functions sometimes. It's got such lackadaisical checking for constraints. It only polls the nodes on a loose schedule and gathers stats about the disk at that time. And the "can it run a job" test only checks what the disk was at the last time it polled, instead of senisbly polling again to determine status. grr...

tacituseu’s picture

@Mixologic: I wonder if those aborted dailies on 8.4.x for PHP 7.2 & MySQL 5.5 CI aren't contributing to that, a lot of errors in each one of them (caused by lack of backport of #2853503: Remove all assert('string') calls from Drupal core because deprecated in PHP 7.2).

Mixologic’s picture

They dont seem to be, or at least, if those are filling the disk, then jenkins is properly removing those nodes from the rotation, as there should be one every day, and there hasnt been a queue flushing event for about five days now.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

tacituseu’s picture

@Mixologic: Re #2342699-121: SqlContentEntityStorage tries to update identity/serial values by default. Just a hunch, but I suspect it might have something to do with #1158322: Add backtrace to all errors, #2857437: pass raw backtrace to loggers for errors, not just exceptions and #2870194: Ensure that process-isolated tests can use Symfony's PHPunit bridge to catch usages of deprecated code, the second and third one would be around the right timeframe.
Printing debug_backtrace() output tends to be prone to recursions in arguments if not handled properly, the way I'd try to test for that would by combining revert of those with one of the 2K+ error count buggy patches, or by replacing the calls in core\includes\errors.inc with debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS); instead of the revert.

tacituseu’s picture

Simpler two of the test patches mentioned in #186 attached, rolled against 8.5.x, attached as txt to prevent another event (so they could run in more controlled environment ;).

Mixologic’s picture

Im deploying new PHP containers today, and with that is a newer version of APCu (5.1.9) that has some bugfixes.

Additionally I have added a new vhost to the containers such that if you want to access the apc.php page from within tests, you can hit http://localhost/apc/apc.php and it will respond with the graphs etc I had earlier. I think there's a way to save that data as an artifact, but I dont remember off the top of my head what the best way to do that is.

In addition to the apc.php page, I've also added the apache server-status page as well (http://localhost/server-status) for apache worker information.

Mixologic’s picture

Almost forgot to mention: APCu is now 3000M, and num_entries hint is 500000.

Anonymous’s picture

#188: It sounds very tasty, thank you!

I'll try to try it + few of other experiments.

Mixologic’s picture

+++ b/core/apcu_saver.php
@@ -0,0 +1,15 @@
+  $logfile = 'sites/default/files/simpletest/apc-php_' . date("Y-m-d-h-i-s") . '.log';
...
+  $logfile = 'sites/default/files/simpletest/server-status_' . date("Y-m-d-h-i-s") . '.log';

Might want to name those .html files since thats what you'll get back.

Mixologic’s picture

These artifacts would then be renderable by jenkins: https://dispatcher.drupalci.org/job/drupal_patches/47125/artifact/jenkin...

Anonymous’s picture

@Mixologic, thanks for hints! I'll take your advice, but first I want to improve my script so that it can use the data from your api.


I also played a little with the new xdebug 2.6 (gc statistics).
Here is an example of gc statistics for ActionJsonAnonTest::testGet() (but while I do not know how to use it)
:
Collected | Efficiency% | Duration | Memory Before | Memory After | Reduction% | Function
----------+-------------+----------+---------------+--------------+------------+---------
        0 |      0.00 % |  0.00 ms |      18149936 |     18149936 |     0.00 % | Composer\Autoload\ClassLoader::addPsr4
    15236 |    152.36 % |  0.00 ms |      28987072 |     26957616 |     7.00 % | Doctrine\Common\Annotations\DocLexer::moveNext
    16512 |    165.12 % |  0.00 ms |      34559648 |     32374432 |     6.32 % | Symfony\Component\DependencyInjection\Definition::setArguments
     2733 |     27.33 % |  0.00 ms |      37666624 |     37321056 |     0.92 % | Drupal\Core\DependencyInjection\YamlFileLoader::resolveServices
     1478 |     14.78 % |  0.00 ms |      43114360 |     42905376 |     0.48 % | Drupal\Component\EventDispatcher\ContainerAwareEventDispatcher::dispatch
    18577 |    185.77 % |  0.00 ms |      47411768 |     44929328 |     5.24 % | Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph::connect
    19691 |    196.91 % |  0.00 ms |      47307288 |     44655872 |     5.60 % | Symfony\Component\DependencyInjection\Compiler\ResolveChildDefinitionsPass::processValue
    19143 |    191.43 % |  0.00 ms |      46914856 |     44380688 |     5.40 % | Symfony\Component\DependencyInjection\Definition::addTag
    19721 |    197.21 % |  0.00 ms |      47451432 |     44819728 |     5.55 % | Symfony\Component\Routing\RouteCompiler::computeRegexp
    37893 |    378.93 % |  0.00 ms |      50863944 |     45822736 |     9.91 % | Symfony\Component\DependencyInjection\Compiler\CheckDefinitionValidityPass::process
      352 |      3.52 % |  0.00 ms |      49070472 |     49025448 |     0.09 % | Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph::connect
     5011 |     50.11 % |  0.00 ms |      51755912 |     49464408 |     4.43 % | Symfony\Component\DependencyInjection\Compiler\CheckCircularReferencesPass::checkOutEdges
     4745 |     47.45 % |  0.00 ms |      51877632 |     49599232 |     4.39 % | Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph::createNode
     4716 |     47.16 % |  0.00 ms |      52078976 |     49797296 |     4.38 % | Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph::connect
     4621 |     46.21 % |  0.00 ms |      52346624 |     50046512 |     4.39 % | Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph::connect
     4926 |     49.26 % |  0.00 ms |      52569600 |     50184800 |     4.54 % | Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph::connect
     4626 |     46.26 % |  0.00 ms |      51977432 |     49627032 |     4.52 % | Symfony\Component\DependencyInjection\Compiler\ServiceReferenceGraph::createNode

Also accidentally discovered a wild bug in https://dispatcher.drupalci.org/job/drupal_patches/47168/consoleFull:
07:23:40 - 07:23:41: 288 tests by 2 seconds :)
Another couple of experiments)
However, it is obvious that we must set a non-zero ttl in php.ini. This is what @Mixologic pointed out in #109, #110. And @tacituseu in #73, #115, #2926309-33/34, and @mpdonadio in 2926309-32. And in my charts show profit from set ttl, too (#170, #171, #172).

At least, to change ttl until we can reduce the number of cached entities.

Anonymous’s picture

StatusFileSize
new60.54 KB

Some negative results, sagging and fluctuations deserve a separate study. But the undisputed champion in reducing the cost of memory and number of entries is #2765271-6: Rationalize use of the 'discovery' cache bin, since it's stored in the limited size APCu by default.

  • min memory: 2'358'352'824 (x2 better than others)
  • max entries: 311633 (on 60k better than others)

Winner photo:
build-47385.png


However, the run time is 2 minutes worse than HEAD.
*Installer* tests still champions in entries/memory costs.
Anonymous’s picture

Anonymous’s picture

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

cilefen’s picture

Status: Needs work » Postponed (maintainer needs more info)

This is a support request that has patches. Is it actually a bug report or a task? It hasn't been touched in four years. Is this even still an issue for anyone?

cilefen’s picture

Status: Postponed (maintainer needs more info) » Closed (outdated)

It seems not.