[Kohana] Exceptions after idle for a while

Discussion for various published PHP frameworks, including Zend Framework, CodeIgniter, Kohana, CakePHP, Yii, Symfony, and others.

Moderator: General Moderators

Post Reply
alanlee
Forum Newbie
Posts: 2
Joined: Wed Feb 12, 2014 9:30 am

[Kohana] Exceptions after idle for a while

Post 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.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: [Kohana] Exceptions after idle for a while

Post 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).
alanlee
Forum Newbie
Posts: 2
Joined: Wed Feb 12, 2014 9:30 am

Re: [Kohana] Exceptions after idle for a while

Post 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.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: [Kohana] Exceptions after idle for a while

Post 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)
Post Reply