@mattab opened this Issue on July 23rd 2018 Member

Use case

  • A core:archive process fails with exhausted memory errors.
  • We need to know what code path was active when the archiving failed.

Got

Example failure from cron:

Error: {"type":1,"message":"Allowed memory size of 8589934592 bytes exhausted (tried to allocate 20480 bytes)","file":"\/core\/DataTable\/Row.php","line":91}

Example failure with the define('PIWIK_PRINT_ERROR_BACKTRACE', true); in bootstrap.php

INFO [2018-07-23 15:51:47] 143396  SUMMARY OF ERRORS
INFO [2018-07-23 15:51:47] 143396  Error: Got invalid response from API request: ?module=API&method=API.get&idSite=8&period=year&date=last5&format=php&trigger=archivephp. Response was 'PHP Fatal error:  Allowed memory size of 8589934592 bytes exhausted (tried to allocate 20480 bytes) in /core/DataTable/Row.php on line 91 a:2:{s:6:"result";s:5:"error";s:7:"message";s:832:"The request requested too much data. To avoid this error, please try to reduce the filter limit. <a href='/0'>#0</a> [internal function]: Piwik\Plugins\Cloud\Controller-&gt;safemode(Array)
 <a href='/1'>#1</a> /core/FrontController.php(559): call_user_func_array(Array, Array)
 <a href='/2'>#2</a> /core/FrontController.php(137): Piwik\FrontController-&gt;doDispatch('Cloud', 'safemode', Array) 
<a href='/3'>#3</a> /core/FrontController.php(88): Piwik\FrontController-&gt;dispatch('CorePluginsAdmi...', 'safemode', Array) 
<a href='/4'>#4</a> /core/FrontController.php(229): Piwik\FrontController::generateSafeModeOutputFromError(Array) 
<a href='/5'>#5</a> [internal function]: Piwik\FrontController::triggerSafeModeWhenError() 
<a href='/6'>#6</a> {main}";}'
ERROR [2018-07-23 15:51:47] 143396  1 total errors during this script execution, please investigate and try and fix these errors.

Expected instead

when we set define('PIWIK_PRINT_ERROR_BACKTRACE', true); in bootstrap.php then we would expect somehow to see the original backtrace of the code path that failed, rather than the backtrace of the safe mode.

@diosmosis commented on August 1st 2018 Member

@mattab fatal errors don't leave a stack trace so this isn't do-able. Static variables, however, remain so we can build pieces of the stack traces by marking when certain methods start/complete. Will be doing that.

This Issue was closed on August 3rd 2018
Powered by GitHub Issue Mirror