CodeIgniter Forums
Maximum call stack size exceeded in development enviroment - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28)
+--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30)
+--- Thread: Maximum call stack size exceeded in development enviroment (/showthread.php?tid=78083)



Maximum call stack size exceeded in development enviroment - Hexes - 11-26-2020

Hello,

I am playing around with CI4, I have a very simple page that doesn't have any JS on it.

But if change the environment to development I start getting these errors:

[Image: Screenshot-2020-11-26-at-23-42-04.png]

[Image: Screenshot-2020-11-26-at-23-42-15.png]


I tried removing the catch and emptying the writable folder. 

It's so annoying, page is only 5 lines of HTML code and no JS, where is the problem?

Regards


RE: Maximum call stack size exceeded in development enviroment - neoneeco - 11-26-2020

I had the same problem not long ago, it was because of the structure of my page.

How is it built, in terms of its includes? Do you use section inclusion as follows: 

PHP Code:
<? = $ this-> extend ('default')?>

<? = $ this-> section ('content')?>
    <h1> Hello World! </h1>
<? = $ this-> endSection ()?>

(but it may not be that at all)


RE: Maximum call stack size exceeded in development enviroment - Hexes - 11-26-2020

Yes, you are right, found the issue. It's because of the structure.

Thanks!


RE: Maximum call stack size exceeded in development enviroment - neoneeco - 11-26-2020

with pleasure Smile


RE: Maximum call stack size exceeded in development enviroment - larryhems - 11-02-2021

This error is almost always means you have a problem with recursion in JavaScript code, as there isn't any other way in JavaScript to consume lots of stack. Sometimes calling a recursive function over and over again, causes the browser to send you Maximum call stack size exceeded error message as the memory that can be allocated for your use is not unlimited.

How to fix

Wrap your recursive function call into a -
  • setTimeout
  • setImmediate or
  • process.nextTick

Also, you can localize the issue by setting a breakpoint on RangeError type of exception , and then adjust the code appropriately. Moreover, you can managed to find the point that was causing the error by check the error details in the Chrome dev toolbar console , this will give you the functions in the call stack, and guide you towards the recursion that's causing the error.