alibaba / transmittable-thread-local

📌 a missing Java std lib(simple & 0-dependency) for framework/middleware, provide an enhanced InheritableThreadLocal that transmits values between threads even using thread pooling components.
https://github.com/alibaba/transmittable-thread-local
Apache License 2.0
7.31k stars 1.66k forks source link

TTL 的 java agent 模式与dragonwell 的 eagerappcds有冲突 #642

Open wangshiyu13 opened 3 weeks ago

wangshiyu13 commented 3 weeks ago

eagerappcds 在 trace 阶段正常,replay 阶段会出现Bootstrap loader class path中期望的 jar 顺序与实际顺序不一致的情况。

java -server -javaagent:/transmittable-thread-local-2.13.0-SNAPSHOT.jar -XX:-OmitStackTraceInFastThrow -XX:+TraceClassPaths -Xquickstart:path=/root/alibaba.quickstart.sharedcache  -Xquickstart:verbose -Dzeusrpc-appkey=moqipobing.wanba.report -Dwb.appname=report -Dserver.port=80 -XX:+UnlockExperimentalVMOptions -XX:+UseCGroupMemoryLimitForHeap -Dmicroserver.host=0.0.0.0 -Dmicroserver.port=80 -Dlog4j.log.dir=80 -Dmicroserver.maxThreads=400 -Dmicroserver.minThreads=50 -Dmicroserver.queueCapacity=12000 -Dmicroserver.queueGrowBy=100 -Dfastjson.parser.safeMode=true -Dwb.env=develop -jar /tmp/test.jar
[classpath: /tmp/test.jar]
cache path is set from -Xquickstart:path=/root/alibaba.quickstart.sharedcache
Running as replayer
[Bootstrap loader class path=/jw/dragonwell-8.18.19/jre/lib/resources.jar:/jw/dragonwell-8.18.19/jre/lib/rt.jar:/jw/dragonwell-8.18.19/jre/lib/sunrsasign.jar:/jw/dragonwell-8.18.19/jre/lib/jsse.jar:/jw/dragonwell-8.18.19/jre/lib/jce.jar:/jw/dragonwell-8.18.19/jre/lib/charsets.jar:/jw/dragonwell-8.18.19/jre/lib/jfr.jar:/jw/dragonwell-8.18.19/jre/classes:/jw/dragonwell-8.18.19/jre/lib/amd64/serverless/serverless-adapter.jar:/transmittable-thread-local-2.13.0-SNAPSHOT.jar]
[type=BOOT Expecting -Dsun.boot.class.path=/jw/dragonwell-8.18.19/jre/lib/resources.jar:/jw/dragonwell-8.18.19/jre/lib/rt.jar:/jw/dragonwell-8.18.19/jre/lib/sunrsasign.jar:/jw/dragonwell-8.18.19/jre/lib/jsse.jar:/jw/dragonwell-8.18.19/jre/lib/jce.jar:/jw/dragonwell-8.18.19/jre/lib/charsets.jar:/jw/dragonwell-8.18.19/jre/lib/jfr.jar:/jw/dragonwell-8.18.19/jre/classes:/jw/dragonwell-8.18.19/jre/lib/amd64/serverless/serverless-adapter.jar]
[BOOT classpath mismatch, actual: -Dsun.boot.class.path=/jw/dragonwell-8.18.19/jre/lib/resources.jar:/jw/dragonwell-8.18.19/jre/lib/rt.jar:/jw/dragonwell-8.18.19/jre/lib/sunrsasign.jar:/jw/dragonwell-8.18.19/jre/lib/jsse.jar:/jw/dragonwell-8.18.19/jre/lib/jce.jar:/jw/dragonwell-8.18.19/jre/lib/charsets.jar:/jw/dragonwell-8.18.19/jre/lib/jfr.jar:/jw/dragonwell-8.18.19/jre/classes:/jw/dragonwell-8.18.19/jre/lib/amd64/serverless/serverless-adapter.jar:/transmittable-thread-local-2.13.0-SNAPSHOT.jar]
An error has occurred while processing the shared archive file.
shared class paths mismatch (hint: enable -XX:+TraceClassPaths to diagnose the failure)
Error occurred during initialization of VM
Unable to use shared archive.
oldratlee commented 3 weeks ago

@wangshiyu13 会不会加其它Java Agent(自动加bootclasspath)也有这个问题?

显式加上-Xbootclasspath/a:path/to/transmittable-thread-local-2.x.y.jar试试

wangshiyu13 commented 3 weeks ago

@wangshiyu13 会不会加其它java agent(会自动加bootclasspath)也有这个问题?

显式加上-Xbootclasspath/a:path/to/transmittable-thread-local-2.x.y.jar试试

测试过 otel 或者 skywalking 的 agent 没有冲突 显式加上 bootclasspath 会出现加载两次的问题,最后一样会报classpath mismatch

oldratlee commented 2 weeks ago

@wangshiyu13


推荐提供成一个单独的工程(GitHub repo)。这样可以: