alibaba / alibaba/arthas

Unable to startup Spring Boot app running inside Docker

Open
#1,676 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
37.6k
Forks
7.6k
Avg merge
1d 22h
Merged PRs (30d)
4

Description

- [x] I have searched the [issues](https://github.com/alibaba/arthas/issues) of this repository and believe that this is not a duplicate.

### Environment

* Arthas version: 3.4.6
* Operating System version: Ubuntu Server 20.10
* Java version of target JVM: 11
* Java version of JVM used to attach: 11
* Spring Boot 2.3.7

### Steps to reproduce this issue

1. Embed Arthas in Spring Boot via "arthas-spring-boot-starter" Maven dependency
2. Create Docker container with "gradlew bootBuildImage"
3. Start Docker container

### Expected Result

Application starts up with Arthas enabled.

### Actual Result

Application crashes on startup:

```
021-01-21 12:36:14.303 ERROR 1 --- [ main] o.s.boot.SpringApplication : Application run failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'arthasAgent' defined in class path resource [com/alibaba/arthas/spring/ArthasConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.taobao.arthas.agent.attach.ArthasAgent]: Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: java.lang.IllegalStateException: No compatible attachment provider is available
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:657)
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:637)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1336)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1176)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:556)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:897)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:879)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:758)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:750)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:405)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:315)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1237)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1226)
at xxxxxxx.MyApplication.main(SaasEngineApplication.java:94)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:49)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:107)
at org.springframework.boot.loader.Launcher.launch(Launcher.java:58)
at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:88)
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.taobao.arthas.agent.attach.ArthasAgent]: Factory method 'arthasAgent' threw exception; nested exception is java.lang.IllegalStateException: java.lang.IllegalStateException: No compatible attachment provider is available
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:652)
... 28 common frames omitted
Caused by: java.lang.IllegalStateException: java.lang.IllegalStateException: No compatible attachment provider is available
at com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:131)
at com.alibaba.arthas.spring.ArthasConfiguration.arthasAgent(ArthasConfiguration.java:62)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
... 29 common frames omitted
Caused by: java.lang.IllegalStateException: No compatible attachment provider is available
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:602)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:586)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:538)
at net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:515)
at com.taobao.arthas.agent.attach.ArthasAgent.init(ArthasAgent.java:90)
... 35 common frames omitted
```

### Hints

Works as expected when the Spring Boot app is started without Docker container.

Contributor guide

Open the contributing guide

Research direction

Reproduce the Docker startup path from the issue, beginning with com.alibaba.arthas.spring.ArthasConfiguration.arthasAgent and com.taobao.arthas.agent.attach.ArthasAgent.init, then follow the reported ByteBuddyAgent.install failure. Done means the Spring Boot application starts with Arthas enabled inside the Docker image without the reported attachment-provider error.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, java, spring-boot
Domain
backend, devops
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.