Page 1 of 1

[Kohana] Exceptions after idle for a while

Posted: Wed Feb 12, 2014 10:00 am
by alanlee
I am working on a site built using Kohana 3.2.0.
It basically works fine. But occasionally, after I entered the site, remain idle for a while and then refresh the browser, one of the following errors will appear.

(1)
Maximum function nesting level of '100' reached, aborting
(2)
ErrorException [ 8 ]: Undefined property: Model_User::$id ~ APPPATH/views/en/template/topnav.php

The interesting thing is that, when these errors appear, the site will automatically comes back to normal after a while and refresh the browser again.
Hence I believe the errors are not due to the application code's problem.

Anyone has a hint? Thanks in advance.

Re: [Kohana] Exceptions after idle for a while

Posted: Wed Feb 12, 2014 10:31 am
by Weirdan
Install xdebug (http://xdebug.org/docs/install), it will give you stack traces for fatal errors (like these: http://xdebug.org/docs/stack_trace). Looking at stack traces you'll get the idea what gets executed that deeply (my guess is unbounded recursion).

Re: [Kohana] Exceptions after idle for a while

Posted: Mon Feb 17, 2014 10:17 pm
by alanlee
I have installed xdebug.
I try to catch the 'Maximum function nesting level' error and output the stack trace, but I cannot catch the error or exception.

The way I test it is like:

Code: Select all

   function my_error_handler() { ... } set_error_handler( 'my_error_handler' );
   function my_exception_handler() { ... } set_exception_handler( 'my_exception_handler' );
   function my_fatal_handler() { ... } register_shutdown_function( 'my_fatal_handler' );

   // try infinite recursion
   function xxx($i) { xxx($i) }
   xxx(1);
When I load the page, the browser just shows a blank page. I tried to log to file in the handlers, but seems none of them is called.

Re: [Kohana] Exceptions after idle for a while

Posted: Tue Feb 18, 2014 2:38 am
by Weirdan
With xdebug you don't need to do anything fancy (like setting handlers). It displays stack traces by default. Just make sure you do not suppress the logging (error_reporting && display_errors)