Sometimes when building my project a java.lang.StackOverflowError is thrown. Most of the time the build works as expected. I’ve never seen this error when building without executing my Proguard task. Are there any rules or tricks that can be used to get Proguard to play nice with Gradle threads?
Some specifics about the project:
Atlassian Bamboo build server
jvmargs -Xms1g -Xmx2G
gradle.parallel = true
- What went wrong:
Execution failed for task ‘:proguard’.
java.lang.StackOverflowError (no error message)
I continued to increase the heap size and added the -Xss argument to increase stack size, and believe I have found a stable setup. I don’t know if there is a more elegant solution, but so far this appears to be the best option. I would still be interested in hearing other ideas.
Hi there Keith! Welcome to the Proguard community
Indeed, using -Xss to increase stack size is one of the first things I’d recommend when it comes to stack overflow errors. Some questions to understand the situation a bit better:
- Are you by any chance using Windows to process your code?
- Which version of Proguard are you using?
- Could you please post your Proguard rules so we can have a closer look?
- Do you know which step it fails in? Shrinking > Optimisation > Obfuscation > Preverification step? (For more info please check here)
I’ll do my best to answer what I can.
- The code is processed in a Linux VM
- Proguard 7.1.0
- I can’t post all the Proguard rules, but some of the more generic ones are below
- I do not know which step fails (I no longer have any of the logs from the failed builds)
-keepattributes *Annotation*, Signature, Exceptions, InnerClasses, SourceFile, LineNumberTable
Sorry for the late reply. Could you recreate a sample that reproduces the problem, and we’ll try it out on our side? It would be great if you could send us the full stack trace as well, so we can dive deeper into the issue?
Thanks! And happy holidays
Unfortunately I cannot. The problem appears to have been fixed by increasing the stack size, so my management considers the issue closed (no time to spend on a resolved issue). I also can’t start the build without pushing code to a specific branch, which would anger my devops team. My hands are tied. I do appreciate the help though, and Happy Holidays to you.