Welcome Guest, Not a member yet? Register   Sign In
Maximum call stack size exceeded in development enviroment
#1

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
Reply
#2

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)
Reply
#3

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

Thanks!
Reply
#4

with pleasure Smile
Reply
#5

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.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB