Comments (8)
Are the created classes really added? It seems like they are missing from the application.
from byte-buddy.
Are the created classes really added? It seems like they are missing from the application.
According to my code and config file, it should be added, can you tell me which class information is missing? Theoretically the tracing agent should be able to catch it, I didn't manually intervene because it must have loaded the relevant class when it started, so it should be traced.
from byte-buddy.
- I'm happy to assume this involves a bug on the GraalVM CE side, which I've opened oracle/graal#8396.
- Discuss two situations,
from byte-buddy.
- So you can actually see the real Error Log at https://github.com/linghengqian/experimental-class-define-support-v2312-test . This simply requires changing
configuration->agent->defaultMode
fromConditional
toStandard
. The way the ByteBuddy API is used in Apache Seata breaks the closed world assumption of GraalVM Native Image.
Failures (1):
JUnit Jupiter:SeataTest:assertShardingInSeataTransactions()
MethodSource [className = 'com.lingh.SeataTest', methodName = 'assertShardingInSeataTransactions', methodParameterTypes = '']
=> com.oracle.svm.core.jdk.UnsupportedFeatureError: Defining a class from new bytecodes at run time is not supported. Class io.seata.config.Configuration$io$seata$config$ConfigurationCache$proxy$ByteBuddy with hash 0d95147338eda0009d73dad94a7c7818120e44e6bdb18007c807001b7adba0fb was not provided during the image build. Please see BuildConfiguration.md.
org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:121)
org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:136)
[email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:280)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.access$300(ByteArrayClassLoader.java:56)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:686)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:638)
[email protected]/java.security.AccessController.executePrivileged(AccessController.java:129)
[email protected]/java.security.AccessController.doPrivileged(AccessController.java:400)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.doPrivileged(ByteArrayClassLoader.java)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.findClass(ByteArrayClassLoader.java:405)
[...]
Test run finished after 5560 ms
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 0 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 1 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 1 tests failed ]
from byte-buddy.
Byte Buddy tries to provide different defaults when it detects Graal: GraalImageCode
, but possibly those defaults are overridden. In this case you need to contact the library maintainers. Maybe you can initiate the Graal support explicitly, too.
from byte-buddy.
- Okey, I assumed this was the missing statement involved in https://gist.github.com/raphw/e0f6864ddcad69630d839c2eebaad818 , I opened linghengqian/experimental-class-define-support-v2312-test#1 to provide verification.
Args = -H:ClassInitialization=net.bytebuddy.ClassFileVersion:rerun \
-H:ClassInitialization=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.Invoker$Dispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.GraalImageCode:rerun \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$AbstractBase \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2 \
--initialize-at-build-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader
- This will bring another error log. According to experiments, adding additional
--initialize-at-build-time=net.bytebuddy.utility.OpenedClassReader
has no effect, but further breaks the build. What did I overlook? I assume I understand correctly JavaDoc for https://github.com/raphw/byte-buddy/blob/byte-buddy-1.14.12/byte-buddy-dep/src/main/java/net/bytebuddy/utility/GraalImageCode.java .
========================================================================================================================
GraalVM Native Image: Generating 'native-tests' (executable)...
========================================================================================================================
[1/8] Initializing... (7.1s @ 0.33GB)
Java version: 21.0.2+13, vendor version: GraalVM CE 21.0.2+13.1
Graal compiler: optimization level: b, target machine: x86-64-v3
C compiler: gcc (linux, x86_64, 11.4.0)
Garbage collector: Serial GC (max heap size: 80% of RAM)
2 user-specific feature(s):
- com.oracle.svm.thirdparty.gson.GsonFeature
- org.graalvm.junit.platform.JUnitPlatformFeature
------------------------------------------------------------------------------------------------------------------------
1 experimental option(s) unlocked:
- '-H:ClassInitialization' (alternative API option(s): --initialize-at-run-time=net.bytebuddy.ClassFileVersion:rerun, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.Invoker$Dispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.GraalImageCode:rerun, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$AbstractBase:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType:build_time, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2:build_time, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader:build_time, --initialize-at-run-time=net.bytebuddy.ClassFileVersion:rerun, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.Invoker$Dispatcher:rerun, --initialize-at-run-time=net.bytebuddy.utility.GraalImageCode:rerun, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$AbstractBase:build_time, --initialize-at-run-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType:build_time, --initialize-at-run-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2:build_time, --initialize-at-run-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2:build_time, --initialize-at-run-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader:build_time, --initialize-at-run-time=io.netty.handler.codec.compression.BrotliDecoder:run_time; origin(s): 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-classes/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/', 'META-INF/native-image/net.bytebuddy/byte-buddy/1.14.12/native-image.properties' in 'file:///home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/src/test/resources/')
------------------------------------------------------------------------------------------------------------------------
Build resources:
- 8.82GB of memory (45.1% of 19.54GB system memory, determined at start)
- 16 thread(s) (100.0% of 16 available processor(s), determined at start)
Skipped 221 predefined class(es) because the classpath already contains a class with the same name: io.seata.sqlparser.druid.polardbx.PolarDBXOperateRecognizerHolder, com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGSQLStatement, com.alibaba.druid.sql.dialect.phoenix.parser.PhoenixExprParser, com.alibaba.druid.sql.dialect.sqlserver.visitor.SQLServerASTVisitor, com.alibaba.druid.sql.ast.SQLPartitionByValue, com.alibaba.druid.sql.dialect.h2.visitor.H2ASTVisitor, com.alibaba.druid.sql.dialect.postgresql.ast.stmt.PGUpdateStatement, com.alibaba.druid.sql.dialect.postgresql.parser.PGLexer, com.alibaba.druid.sql.ast.SQLIndex, com.alibaba.druid.sql.ast.SQLDataType, ...
[junit-platform-native] Running in 'test listener' mode using files matching pattern [junit-platform-unique-ids*] found in folder [/home/linghengqian/TwinklingLiftWorks/git/public/experimental-class-define-support-v2312-test/target/test-ids] and its subfolders.
[2/8] Performing analysis... [*] (27.5s @ 2.47GB)
20,712 reachable types (87.6% of 23,656 total)
34,579 reachable fields (60.1% of 57,511 total)
105,293 reachable methods (58.9% of 178,652 total)
6,881 types, 1,852 fields, and 7,013 methods registered for reflection
Error: Classes that should be initialized at run time got initialized during image building:
net.bytebuddy.utility.OpenedClassReader was unintentionally initialized at build time. To see why net.bytebuddy.utility.OpenedClassReader got initialized use --trace-class-initialization=net.bytebuddy.utility.OpenedClassReader
To see how the classes got initialized, use --trace-class-initialization=net.bytebuddy.utility.OpenedClassReader
------------------------------------------------------------------------------------------------------------------------
3.8s (10.5% of total time) in 51 GCs | Peak RSS: 5.44GB | CPU load: 9.66
========================================================================================================================
Finished generating 'native-tests' in 35.1s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 48.480 s (Wall Clock)
[INFO] Finished at: 2024-02-19T22:19:35+08:00
[INFO] ------------------------------------------------------------------------
from byte-buddy.
Maybe it's another -H:ClassInitialization
that needs to be added? To be perfectly honest, I never fully understood what is going on with these options and just kept adding them until everything worked.
from byte-buddy.
- If you are talking about the buildArg of
-H:ClassInitialization=net.bytebuddy.utility.OpenedClassReader:rerun
, I continue at linghengqian/experimental-class-define-support-v2312-test#1 to verify.
Args = -H:ClassInitialization=net.bytebuddy.ClassFileVersion:rerun \
-H:ClassInitialization=net.bytebuddy.utility.dispatcher.JavaDispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.Invoker$Dispatcher:rerun \
-H:ClassInitialization=net.bytebuddy.utility.GraalImageCode:rerun \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$InDefinedShape$AbstractBase$ForLoadedExecutable \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$AbstractBase \
--initialize-at-build-time=net.bytebuddy.description.type.TypeDescription$ForLoadedType \
--initialize-at-build-time=net.bytebuddy.description.method.MethodDescription$ForLoadedMethod \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$1 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Argument$BindingMechanic$2 \
--initialize-at-build-time=net.bytebuddy.implementation.bind.annotation.Super$Instantiation$2 \
--initialize-at-build-time=net.bytebuddy.utility.dispatcher.JavaDispatcher$DynamicClassLoader \
-H:ClassInitialization=net.bytebuddy.utility.OpenedClassReader:rerun
- This goes back to the previous topic, https://github.com/apache/incubator-seata/blob/5a84c42ba2be0db11228c00162a964e4c9ca9ea8/config/seata-config-core/src/main/java/org/apache/seata/config/ConfigurationCache.java using the ByteBuddy API breaks the closed world assumption, and using
java.lang.reflect.Proxy
can temporarily avoid such problems.
Failures (1):
JUnit Jupiter:SeataTest:assertShardingInSeataTransactions()
MethodSource [className = 'com.lingh.SeataTest', methodName = 'assertShardingInSeataTransactions', methodParameterTypes = '']
=> com.oracle.svm.core.jdk.UnsupportedFeatureError: Defining a class from new bytecodes at run time is not supported. Class io.seata.config.Configuration$io$seata$config$ConfigurationCache$proxy$ByteBuddy with hash db8f83740bdb05f4253fbf0991a7136955934bc498167aebbe1869a3d170eb8f was not provided during the image build. Please see BuildConfiguration.md.
org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:121)
org.graalvm.nativeimage.builder/com.oracle.svm.core.hub.PredefinedClassesSupport.loadClass(PredefinedClassesSupport.java:136)
[email protected]/java.lang.ClassLoader.defineClass(ClassLoader.java:280)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.access$300(ByteArrayClassLoader.java:56)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:686)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader$ClassDefinitionAction.run(ByteArrayClassLoader.java:638)
[email protected]/java.security.AccessController.executePrivileged(AccessController.java:129)
[email protected]/java.security.AccessController.doPrivileged(AccessController.java:400)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.doPrivileged(ByteArrayClassLoader.java)
net.bytebuddy.dynamic.loading.ByteArrayClassLoader.findClass(ByteArrayClassLoader.java:405)
[...]
Test run finished after 6586 ms
[ 2 containers found ]
[ 0 containers skipped ]
[ 2 containers started ]
[ 0 containers aborted ]
[ 2 containers successful ]
[ 0 containers failed ]
[ 1 tests found ]
[ 0 tests skipped ]
[ 1 tests started ]
[ 0 tests aborted ]
[ 0 tests successful ]
[ 1 tests failed ]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 01:35 min (Wall Clock)
[INFO] Finished at: 2024-02-20T16:34:23+08:00
[INFO] ------------------------------------------------------------------------
from byte-buddy.
Related Issues (20)
- Setting value in constructor aliases collections HOT 5
- Is it possible to lazily instantiate AllArguments?
- install transformer takes too long time HOT 3
- Example that could be used in documentation HOT 6
- Issues attaching to Solaris Hotspot on Solaris 10 and 11. HOT 1
- How to generate multi-level generic code ? HOT 2
- java.lang.IllegalAccessError HOT 15
- InjectionStrategy.UsingUnsafe.OfFactory HOT 1
- java.lang.IncompatibleClassChangeError: Interface method reference: java.util.stream.Sink.begin(J)V HOT 1
- defineField not working well HOT 1
- JDK class enhancements HOT 3
- ByteBuddy is incompatible with CDS due to the Java 6 baseline HOT 4
- No JPMS module-info or Automatic-Module-Name in byte-buddy-dep HOT 2
- How to call method self when use Advice HOT 4
- "Set value cannot be assigned" when setting lambda to static field in type initializer HOT 4
- Publish blocking HOT 12
- Return value if matches condition or call original method HOT 5
- Is `@Advice.SuperCall` supported? How can I call `super.originalMethod()` inside my instrumenting code? HOT 1
- Side effects of bytebuddy rebasing to weaving process? HOT 2
- Can ByteBuddy provide a list of the JDK classes it makes use of? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from byte-buddy.