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

JDK17 ArthasAgent.attach Api Provider sun.tools.attach.LinuxAttachProvider not found #2513

Closed
1 task done
lindzh opened this issue May 10, 2023 · 2 comments
Closed
1 task done
Labels
bug Something isn't working
Milestone

Comments

@lindzh
Copy link

lindzh commented May 10, 2023

  • 我已经在 issues 里搜索,没有重复的issue。

环境信息

  • Arthas 版本: byte-buddy-agent-1.6.11.jar. arthas-agent-attach-3.6.7.jar
  • 操作系统版本: SMP Debian 4.9.30-2+deb9u2 (2017-06-26) x86_64 GNU/Linux
  • 目标进程的JVM版本: openjdk version "17.0.2" 2022-01-18

重现问题的步骤

  1. 参考文档 https://arthas.aliyun.com/doc/spring-boot-starter.html#%E6%9F%A5%E7%9C%8B-endpoint-%E4%BF%A1%E6%81%AF 使用 非 spring boot 应用使用方式
  2. arthas 版本替换 3.6.7
  3. 按照如下 api 方式调用 attach
        HashMap<String, String> configMap = new HashMap<String, String>();
        configMap.put("arthas.appName", "demo");
        configMap.put("arthas.tunnelServer", "ws://127.0.0.1:7777/ws");
        ArthasAgent.attach(configMap);

期望的结果

ArthasAgent.attach 成功

实际运行的结果

attach api 异常信息

java.lang.IllegalStateException: java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@74a86f55
	at com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:131) ~[arthas-agent-attach-3.6.7.jar:3.6.7]
	at com.taobao.arthas.agent.attach.ArthasAgent.attach(ArthasAgent.java:66) ~[arthas-agent-attach-3.6.7.jar:3.6.7]
Caused by: java.lang.IllegalStateException: Error during attachment using: net.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@74a86f55
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:366) ~[byte-buddy-agent-1.6.11.jar:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332) ~[byte-buddy-agent-1.6.11.jar:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300) ~[byte-buddy-agent-1.6.11.jar:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286) ~[byte-buddy-agent-1.6.11.jar:?]
	at com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:90) ~[arthas-agent-attach-3.6.7.jar:3.6.7]
	... 12 more
Caused by: java.lang.reflect.InvocationTargetException
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:353) ~[byte-buddy-agent-1.6.11.jar:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332) ~[byte-buddy-agent-1.6.11.jar:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300) ~[byte-buddy-agent-1.6.11.jar:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286) ~[byte-buddy-agent-1.6.11.jar:?]
	at com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:90) ~[arthas-agent-attach-3.6.7.jar:3.6.7]
Caused by: java.io.IOException: Can not attach to current VM
	at sun.tools.attach.HotSpotVirtualMachine.<init>(HotSpotVirtualMachine.java:76) ~[jdk.attach:?]
	at sun.tools.attach.VirtualMachineImpl.<init>(VirtualMachineImpl.java:57) ~[jdk.attach:?]
	at sun.tools.attach.AttachProviderImpl.attachVirtualMachine(AttachProviderImpl.java:58) ~[jdk.attach:?]
	at com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:207) ~[jdk.attach:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?]
	at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?]
	at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?]
	at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:353) ~[byte-buddy-agent-1.6.11.jar:?]
	at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332) ~[byte-buddy-agent-1.6.11.jar:?]

java 进程异常信息

java.util.ServiceConfigurationError: com.sun.tools.attach.spi.AttachProvider: Provider sun.tools.attach.LinuxAttachProvider not found
	at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:593)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.nextProviderClass(ServiceLoader.java:1219)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1228)
	at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1273)
	at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1309)
	at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1393)
	at jdk.attach/com.sun.tools.attach.spi.AttachProvider.providers(AttachProvider.java:260)
	at jdk.attach/com.sun.tools.attach.VirtualMachine.attach(VirtualMachine.java:200)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
	at pinpoint.agent/pinpoint.agent/net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:353)
	at pinpoint.agent/pinpoint.agent/net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:332)
	at pinpoint.agent/pinpoint.agent/net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:300)
	at pinpoint.agent/pinpoint.agent/net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:286)
	at pinpoint.agent/pinpoint.agent/com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:90)
	at pinpoint.agent/pinpoint.agent/com.taobao.arthas.agent.attach.ArthasAgent.attach(ArthasAgent.java:66)
@lindzh
Copy link
Author

lindzh commented May 10, 2023

解法:升级 bytebuddy到最新版本 1.14.4

@hengyunabc hengyunabc added the bug Something isn't working label May 11, 2023
@hengyunabc hengyunabc added this to the target_jdk8 milestone May 11, 2023
@hengyunabc
Copy link
Collaborator

master 已经升级 bytebuddy,但还没有发布: 8834a0f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants