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

Jacoco agent is added to mutation minion #1070

Closed
eorloff opened this issue Aug 1, 2022 · 1 comment · Fixed by #1071
Closed

Jacoco agent is added to mutation minion #1070

eorloff opened this issue Aug 1, 2022 · 1 comment · Fixed by #1071

Comments

@eorloff
Copy link
Contributor

eorloff commented Aug 1, 2022

After updating to PiTest 1.9.3 we are seeing RUN_ERROR when running PiTest. I have tested with PiTest 1.9.2 that does not fail.

When running with verbose logging I get the following error

stdout  : Hotswap loader jdk.internal.loader.ClassLoaders$AppClassLoader@5e2de80c
stdout  : java.lang.UnsupportedOperationException: class redefinition failed: attempted to delete a method
stdout  :       at java.instrument/sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
stdout  :       at java.instrument/sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:195)
stdout  :       at org.pitest.boot.HotSwapAgent.hotSwap(HotSwapAgent.java:46)
stdout  :       at org.pitest.mutationtest.execute.HotSwap.apply(HotSwap.java:30)
stdout  :       at org.pitest.mutationtest.execute.HotSwap.apply(HotSwap.java:9)
stdout  :       at org.pitest.mutationtest.execute.MutationTestWorker.handleCoveredMutation(MutationTestWorker.java:149)
stdout  :       at org.pitest.mutationtest.execute.MutationTestWorker.handleMutation(MutationTestWorker.java:126)
stdout  :       at org.pitest.mutationtest.execute.MutationTestWorker.processMutation(MutationTestWorker.java:108)
stdout  :       at org.pitest.mutationtest.execute.MutationTestWorker.run(MutationTestWorker.java:79)
stdout  :       at org.pitest.mutationtest.execute.MutationTestMinion.run(MutationTestMinion.java:99)
stdout  :       at org.pitest.mutationtest.execute.MutationTestMinion.main(MutationTestMinion.java:148)
stderr  : 19.16.45 PIT >> WARNING : Error during mutation test
stderr  : java.lang.UnsupportedOperationException: class redefinition failed: attempted to delete a method
stderr  :       at java.instrument/sun.instrument.InstrumentationImpl.redefineClasses0(Native Method)
stderr  :       at java.instrument/sun.instrument.InstrumentationImpl.redefineClasses(InstrumentationImpl.java:195)
stderr  :       at org.pitest.boot.HotSwapAgent.hotSwap(HotSwapAgent.java:46)
stderr  :       at org.pitest.mutationtest.execute.HotSwap.apply(HotSwap.java:30)
stderr  :       at org.pitest.mutationtest.execute.HotSwap.apply(HotSwap.java:9)
stderr  :       at org.pitest.mutationtest.execute.MutationTestWorker.handleCoveredMutation(MutationTestWorker.java:149)
stderr  :       at org.pitest.mutationtest.execute.MutationTestWorker.handleMutation(MutationTestWorker.java:126)
stderr  :       at org.pitest.mutationtest.execute.MutationTestWorker.processMutation(MutationTestWorker.java:108)
stderr  :       at org.pitest.mutationtest.execute.MutationTestWorker.run(MutationTestWorker.java:79)
stderr  :       at org.pitest.mutationtest.execute.MutationTestMinion.run(MutationTestMinion.java:99)
stderr  :       at org.pitest.mutationtest.execute.MutationTestMinion.main(MutationTestMinion.java:148)
19.16.45 PIT >> FINE : Exit code was - UNKNOWN_ERROR
19.16.45 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
19.16.45 PIT >> FINE : Setting 1 unfinished runs to RUN_ERROR state

Digging into the changes between 1.9.2 and 1.9.3 I have tried modifying the argLine parameter and this seems to be the problematic change. The JaCoCo agent is accidentally enabled if the argLine has not been explicitly set. See below.

Without setting ArgLine:
"C:\Program Files\Eclipse Foundation\jdk-17.0.0.35-hotspot\bin\java" -Djava.awt.headless=true -javaagent:C:\\Users\\ebo\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.8\\org.jacoco.agent-0.8.8-runtime.jar=destfile=C:\\Users\\ebo\\src\\pbc\\core\\contract\\target\\jacoco.exec -javaagent:C:\Users\ebo\AppData\Local\Temp\16593783398090350423204432893312611738940937464797.jar "-Dclassworlds.conf=C:/Program Files (x86)/apache-maven-3.6.3/bin/m2.conf" "-Dmaven.home=C:/Program Files (x86)/apache-maven-3.6.3" "-Dlibrary.jansi.path=C:/Program Files (x86)/apache-maven-3.6.3/lib/jansi-native" -Dmaven.multiModuleProjectDirectory=C:/Users/ebo/src/pbc/core/contract org.pitest.mutationtest.execute.MutationTestMinion 54271

With ArgLine set with -DargLine='':
"C:\Program Files\Eclipse Foundation\jdk-17.0.0.35-hotspot\bin\java" -Djava.awt.headless=true -javaagent:C:\Users\ebo\AppData\Local\Temp\1659378250879088791656585998567406604286261976640.jar "-Dclassworlds.conf=C:/Program Files (x86)/apache-maven-3.6.3/bin/m2.conf" "-Dmaven.home=C:/Program Files (x86)/apache-maven-3.6.3" "-Dlibrary.jansi.path=C:/Program Files (x86)/apache-maven-3.6.3/lib/jansi-native" -Dmaven.multiModuleProjectDirectory=C:/Users/ebo/src/pbc/core/contract org.pitest.mutationtest.execute.MutationTestMinion 53977

With PiTest 1.9.2
"C:\Program Files\Eclipse Foundation\jdk-17.0.0.35-hotspot\bin\java" -Djava.awt.headless=true -javaagent:C:\Users\ebo\AppData\Local\Temp\165937861524900867023834234013112109174415442643105.jar "-Dclassworlds.conf=C:/Program Files (x86)/apache-maven-3.6.3/bin/m2.conf" "-Dmaven.home=C:/Program Files (x86)/apache-maven-3.6.3" "-Dlibrary.jansi.path=C:/Program Files (x86)/apache-maven-3.6.3/lib/jansi-native" -Dmaven.multiModuleProjectDirectory=C:/Users/ebo/src/pbc/core/contract org.pitest.mutationtest.execute.MutationTestMinion 51602

@hcoles
Copy link
Owner

hcoles commented Aug 2, 2022

Thanks for the report.

The options here are limited as prior to the change other users had the opposite problem (important argline arguments weren't picked up by default).

Possibilities include

  1. Toggle argline inclusion on/off with a flag (but this just moved the problem so one group or another has to debug in order to switch off the defauilt value).
  2. If jacoco is on the argline throw an error telling the user to remove it
  3. Try and automatically remove jacoco from the argline (or otherwise disable it)

Option 3 seems best, but would be easy to mess up as there will be some variation in what the argline looks like.

Option 2 should be straigthforward

Not sure Option 1 really solves or improves anything.
5. Try and remove jacoco from the argline

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants