-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
less.js with strictMath enabled runs out of memory trying to compile Bootstrap #1725
Comments
I can confirm that in Windows too. I'm not sure what exactly happens but here's what I have already found so far:
Minimal imports to reproduce it:
|
Problem still persists after fixing all reported strictMath violations. |
OK, I think I found a minimal example to make the compiler to enter infinite loop with
|
Putting extra parens on all recursive calls in "mixins.less" (there're a lot) should help. |
Yes, that indeed fixes the problem, although it kinda sucks that |
@seven-phases-max Thanks for the help! |
…LESS strictMath <3 @seven-phases-max for helping to confirm & debug this X-Ref: less/less.js#1725
Doh! Now I see what is the problem with it:
So strictly speaking it turns out to be a "LESS infinite loop" not a "compiler infinite loop" (i.e. not really a compiler bug), but unlike more simple infinite loops which usually stop quite soon with "SyntaxError: Maximum call stack size exceeded" this one causes some significant slowdown with "Out of memory" in the end before it reaches "maximum call stack". Hmm, now I wonder what would be a way to fix that... Maybe the solution is somewhere around |
@seven-phases-max great work I agree that should error ( We could/should also have loop detection that has a maximum stack size, lower than the javascript one so we detect these loops and throw a nice error. |
@cvrebert will you do a pull to bootstrap with the strict math violations? a while ago I did one but they are not enforcing it - it would be nice if bootstrap worked with and without strict math. |
@lukeapage We've already fixed them in Bootstrap and are now using strictMath. |
…y with LESS strictMath <3 @seven-phases-max for helping to confirm & debug this X-Ref: less/less.js#1725
Closing as fixed in v2. |
…y with LESS strictMath <3 @seven-phases-max for helping to confirm & debug this X-Ref: less/less.js#1725
Versions:
With Bootstrap v3.0.3:
See also: twbs/bootstrap#11790 (comment)
The text was updated successfully, but these errors were encountered: