YUICompressor crash - stackoverflow error

I often get what seems to be a stackoverflow error ;-) from YUICompressor. Below is the first part of a thousand lines of errors that occur when trying to compress a CSS stylesheet with a size of 24074 bytes (rather than "Caused by java.lang.StackOverflowError about 8 lines down):

iMac1:src jas$ min ../style2.min.css style2.css Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21) Caused by: java.lang.StackOverflowError at java.lang.Character.codePointAt(Character.java:2335) at java.util.regex.Pattern$CharProperty.match(Pattern.java:3344) at java.util.regex.Pattern$Branch.match(Pattern.java:4114) 

... (plus another 1021 error lines)

Errors usually occur after adding a couple of lines to a compressed file. Css is great, and works great in uncompressed format. I do not see a specific template for selector types added to the file that cause errors. In this case, adding the following selector to a previously compressed file resulted in errors:

 #thisisatest { margin-left:87px; } 

I am wondering if there is a java flag to increase the stack, which may help. Or, if this is not a problem, what is it?

EDIT:

When I sent this question, it became clear to me that I had to check the java command to see if there was a parameter for increasing the stack. It turns out that this is -Xssn, where "n" is a parameter indicating the size of the stack. Its default value is 512k. So I tried 1024k, but it still led to a stackoverflow. However, trying 2048k works, and I think this might be the solution.

+4
source share
1 answer

As stated in my edition, the solution was to add parameters to the java command. Under the concept was the error line on the 5th line "at", as shown below:

 at com.yahoo.platform.yui.compressor.Bootstrap.main(Bootstrap.java:21) Caused by: java.lang.StackOverflowError 

Seeing that the problem was "StackOverlowError" ;-), it was suggested to try increasing the stack size. The default value is 512k. My first attempt at 1024k did not work. However, increasing it to 2048k really worked, and I had no additional problems.

+6
source

Source: https://habr.com/ru/post/1390591/


All Articles