Skip to content
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

When building ballerinax/stripe package ClassTooLargeException stacktrace is printed into the console #6841

Closed
ayeshLK opened this issue Aug 7, 2024 · 1 comment · Fixed by ballerina-platform/module-ballerinax-stripe#11
Assignees
Labels
module/stripe Reason/Complex Issue occurred due to complex scenario. Type/Bug

Comments

@ayeshLK
Copy link
Member

ayeshLK commented Aug 7, 2024

Description:

$subject

When executing the gradle build for ballerinax/stripe [1] package ClassTooLargeException stacktrace is printed into the console. But, the build passes successfully. Following is the printed stacktrace:

java.lang.instrument.IllegalClassFormatException: Error while instrumenting ballerinax/stripe/2/types with JaCoCo 0.8.10.202304240956/8ea9668.
        at org.jacoco.agent.rt.internal_4a7f17c.CoverageTransformer.transform(CoverageTransformer.java:94)
        at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:244)
        at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
        at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:541)
        at java.base/java.lang.ClassLoader.defineClass1(Native Method)
        at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1012)
        at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:150)
        at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:524)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:427)
        at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:421)
        at java.base/java.security.AccessController.doPrivileged(AccessController.java:712)
        at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:420)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:587)
        at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:520)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&006211(stripe$1:41)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&006210(stripe$1:48)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00629(stripe$1:96)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00628(stripe$1:648)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00627(stripe$1:1275)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00626(stripe$1:1892)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00625(stripe$1:2509)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00624(stripe$1:3118)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00623(stripe$1:3787)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00622(stripe$1:4512)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00621(stripe$1:5286)
        at ballerinax.stripe.2.stripe$1.$gen$ballerinax&0047stripe&00582&00460&00460&0046&0060init&00620(stripe$1:6001)
        at ballerinax.stripe.2.$_init.$gen$&0046&0060init&0062(stripe:0)
        at ballerinax.stripe$test.2.$_init.$moduleInit(stripe)
        at ballerinax.stripe$test.2.$_init.$moduleExecute(stripe)
        at ballerinax.stripe$test.2.$_init.$lambda$$moduleExecute$(stripe)
        at io.ballerina.runtime.internal.scheduling.SchedulerItem.execute(SchedulerItem.java:54)
        at io.ballerina.runtime.internal.scheduling.Scheduler.run(Scheduler.java:320)
        at io.ballerina.runtime.internal.scheduling.Scheduler.runSafely(Scheduler.java:287)
        at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.io.IOException: Error while instrumenting ballerinax/stripe/2/types with JaCoCo 0.8.10.202304240956/8ea9668.
        at org.jacoco.agent.rt.internal_4a7f17c.core.instr.Instrumenter.instrumentError(Instrumenter.java:161)
        at org.jacoco.agent.rt.internal_4a7f17c.core.instr.Instrumenter.instrument(Instrumenter.java:111)
        at org.jacoco.agent.rt.internal_4a7f17c.CoverageTransformer.transform(CoverageTransformer.java:92)
        ... 33 more
Caused by: org.jacoco.agent.rt.internal_4a7f17c.asm.ClassTooLargeException: Class too large: ballerinax/stripe/2/types
        at org.jacoco.agent.rt.internal_4a7f17c.asm.ClassWriter.toByteArray(ClassWriter.java:621)
        at org.jacoco.agent.rt.internal_4a7f17c.core.instr.Instrumenter.instrument(Instrumenter.java:92)
        at org.jacoco.agent.rt.internal_4a7f17c.core.instr.Instrumenter.instrument(Instrumenter.java:109)
        ... 34 more
@warunalakshitha
Copy link
Contributor

This is due to large number of type definitions in types.bal file. JVM has a limitation for number strings and methods in one class file. Since each bal file with have separate class, too many code will result in class too large.

We can split the type definitions to two or more bal files to fix this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
module/stripe Reason/Complex Issue occurred due to complex scenario. Type/Bug
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants