Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293458

Why Drupal 7 does not log exceeding the allowed memory limit?

$
0
0

Problem/Motivation

It is not possible to find out that some users can experience issues related with server memory limit while just monitoring drupal logs. Why Drupal 7 does not log exceeding the allowed memory limit?

Steps to reproduce

1) create in the Drupal`s root folder file 'memoryCheck.php' with contents:

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

error_reporting(-1);
$conf['error_level'] = 2;
ini_set('display_errors', TRUE);
ini_set('display_startup_errors', TRUE);

function exceedMemoryLimit() {
  $data = '';
  while(true) {
    $data .= str_repeat('#', PHP_INT_MAX);
  }
}

exceedMemoryLimit();

2) Open /memoryCheck.php throught browser
3) Open /admin/reports/dblog

Result: Not errors logged.

Proposed resolution

Log such errors inside _drupal_shutdown_function()


Viewing all articles
Browse latest Browse all 293458

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>