From dbc01628d1be794844dd4b6f3498f7ede523ef14 Mon Sep 17 00:00:00 2001 From: Nathaniel Catchpole Date: Mon, 13 Nov 2017 22:15:42 +0000 Subject: [PATCH] Issue #2921862 by alexpott, vaplas, tacituseu: Segfault on PHP5.5 and PostgreSQL --- core/tests/Drupal/Tests/BrowserTestBase.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 6ac72f30c35b..8a05444a4fa5 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -446,6 +446,15 @@ abstract class BrowserTestBase extends TestCase { * {@inheritdoc} */ protected function setUp() { + // Installing Drupal creates 1000s of objects. Garbage collection of these + // objects is expensive. This appears to be causing random segmentation + // faults in PHP 5.x due to https://bugs.php.net/bug.php?id=72286. Once + // Drupal is installed is rebuilt, garbage collection is re-enabled. + $disable_gc = version_compare(PHP_VERSION, '7', '<') && gc_enabled(); + if ($disable_gc) { + gc_collect_cycles(); + gc_disable(); + } parent::setUp(); $this->setupBaseUrl(); @@ -466,6 +475,11 @@ abstract class BrowserTestBase extends TestCase { // Set up the browser test output file. $this->initBrowserOutputFile(); + // If garbage collection was disabled prior to rebuilding container, + // re-enable it. + if ($disable_gc) { + gc_enable(); + } } /**