Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault (core dumped) 8.1.11 #2725

Closed
lucasconstantino opened this issue Apr 26, 2017 · 5 comments
Closed

Segmentation fault (core dumped) 8.1.11 #2725

lucasconstantino opened this issue Apr 26, 2017 · 5 comments

Comments

@lucasconstantino
Copy link

I'm experiencing a Segmentation fault (core dumped) error when executing drush cr, using drush version 8.1.11 with Drupal 8 on php 5.6.27-0+deb8u1.

I've tracked down the issue to a - recently added - user cache clearing.

/**
 * Rebuild a Drupal 8 site.
 *
 * This is a transpose of core/rebuild.php. Additionally
 * it also clears drush cache and drupal render cache.
 */
function drush_cache_rebuild() {
  if (!drush_get_option('cache-clear', TRUE)) {
    drush_log(dt("Skipping cache-clear operation due to --cache-clear=0 option."), LogLevel::OK);
    return TRUE;
  }
  chdir(DRUPAL_ROOT);

  // Clear the APC cache to ensure APC class loader is reset.
  if (function_exists('apc_fetch')) {
    apc_clear_cache('user');
  }
  // Clear user cache for all major platforms.
  $user_caches = [
    'apcu_clear_cache',
    'wincache_ucache_clear',
    'xcache_clear_cache',
  ];
  array_map('call_user_func', array_filter($user_caches, 'is_callable'));

  $autoloader = drush_drupal_load_autoloader(DRUPAL_ROOT);
  require_once DRUSH_DRUPAL_CORE . '/includes/utility.inc';

  $request = Request::createFromGlobals();
  // Ensure that the HTTP method is set, which does not happen with Request::createFromGlobals().
  $request->setMethod('GET');
  // Manually resemble early bootstrap of DrupalKernel::boot().
  require_once DRUSH_DRUPAL_CORE . '/includes/bootstrap.inc';
  DrupalKernel::bootEnvironment();
  // Avoid 'Only variables should be passed by reference'
  $root  = DRUPAL_ROOT;
  $site_path = DrupalKernel::findSitePath($request);
  Settings::initialize($root, $site_path, $autoloader);

  // Use our error handler since _drupal_log_error() depends on an unavailable theme system (ugh).
  set_error_handler('drush_error_handler');

  // drupal_rebuild() calls drupal_flush_all_caches() itself, so we don't do it manually.
  drupal_rebuild($autoloader, $request);
  drush_log(dt('Cache rebuild complete.'), LogLevel::OK);

  // As this command replaces `drush cache-clear all` for Drupal 8 users, clear
  // the Drush cache as well, for consistency with that behavior.
  drush_cache_clear_drush();
}

The problem happen on this line:

array_map('call_user_func', array_filter($user_caches, 'is_callable'));

Aparently this can be solved by removing the use of array_map as such:

  foreach (array_filter($user_caches, 'is_callable') as $cache) {
    call_user_func($cache);
  }
@weitzman
Copy link
Member

Please open a PR. Note that we already test on PHP 5.6 so it would be good to understand when this happens.

@FlorentTorregrosa
Copy link
Contributor

Hello,

I have the same problem and I fixed it by commenting the line "apcu_clear_cache'," if it can help.

@FlorentTorregrosa
Copy link
Contributor

Pull request created.

@Spurlos
Copy link

Spurlos commented May 25, 2017

Drush v8.1.10 also affected, patch from PR solved the issue.

@weitzman
Copy link
Member

weitzman commented Jun 5, 2017

Lets discuss in the PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants