electronicarts / ea-async

EA Async implements async-await methods in the JVM.
https://go.ea.com/ea-async
Other
1.38k stars 129 forks source link

Agent failed to start #44

Open Tancred423 opened 5 years ago

Tancred423 commented 5 years ago

At first, when I tried to run my .jar which uses the ea async dependency, I got the error that it couldn't find the class agend in my manifest. Therefore, I added Agent-Class: com.ea.async.instrumentation.Agent to my MANIFEST.MF and it seemed to fix this error, but now I got a new one and I really don't know what I am doing wrong.

It's a maven project so that's what I did:

  1. Added the dependency to my pom.xml
  2. Added the plugin to my pom.xml
  3. I rebuild the project, recreated the artifacts to apply possibly missing changes.
  4. I started using it with the import parameter import static com.ea.async.Async.await; like on the examples.

It works fine if I start it in my IDE (Intellij / Javac 11), but does not if I put the compiled .jar (which contains the com.ea.async dir) on my debian 9 server and try to launch it there (it runs with open jdk 11).

I am grateful for any help! 🙏

This is my error (Servant is the name of my program):

Exception in thread "Attach Listener" java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
    at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallAgentmain(InstrumentationImpl.java:535)
Caused by: java.lang.UnsupportedOperationException: adding retransformable transformers is not supported in this environment
    at java.instrument/sun.instrument.InstrumentationImpl.addTransformer(InstrumentationImpl.java:94)
    at com.ea.async.instrumentation.Agent.agentmain(Agent.java:52)
    ... 6 more

Agent failed to start!

Exception in thread "main" java.lang.ExceptionInInitializerError
    at com.ea.async.Async.init(Async.java:79)
    at servant.Servant.main(Servant.java:79)

Caused by: java.lang.RuntimeException: Error attaching ea-async java agent
    at com.ea.async.instrumentation.InitializeAsync.<clinit>(InitializeAsync.java:99)
    ... 2 more

Caused by: java.lang.RuntimeException: Error activating orbit-async agent from /home/bots/rin/Rin.jar
    at com.ea.async.instrumentation.InitializeAsync.loadAgent(InitializeAsync.java:211)
    at com.ea.async.instrumentation.InitializeAsync.<clinit>(InitializeAsync.java:80)
    ... 2 more

Caused by: java.lang.IllegalStateException: Could not self-attach to current VM using external process
    at com.ea.async.shaded.net.bytebuddy.agent.ByteBuddyAgent.installExternal(ByteBuddyAgent.java:486)
    at com.ea.async.shaded.net.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:420)
    at com.ea.async.shaded.net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:248)
    at com.ea.async.shaded.net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:223)
    at com.ea.async.shaded.net.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:210)
    at com.ea.async.instrumentation.InitializeAsync.loadAgent(InitializeAsync.java:205)
    ... 3 more
JoeHegarty commented 5 years ago

Do you need the agent on your server? If you are using the plugin, you should only need the agent for IDE debugging, the best way to do that is to pass it as an argument in your debug config. The plugin will strip all async/await calls in your built artifact so there is no need to use the agent.

sampopes commented 2 years ago

@Tancred423 Facing the issue, did find you a solution ?

Tancred423 commented 2 years ago

@Tancred423 Facing the issue, did find you a solution ?

No sorry :( ended up just not using it