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

Lot of random errors - "Minion exited abnormally due to RUN_ERROR", "Minion exited abnormally due to TIMEOUT_ERROR" #1072

Open
sharath2106 opened this issue Aug 9, 2022 · 28 comments

Comments

@sharath2106
Copy link

sharath2106 commented Aug 9, 2022

We are trying to bring Mutation testing using pitest. But we are facing random errors - "Minion exited abnormally due to RUN_ERROR", "Minion exited abnormally due to TIMEOUT_ERROR" etc.,

We have added the plugin - id 'info.solidsoft.pitest' version '1.7.4'

The gradle task looks like -

pitest {
junit5PluginVersion.set("1.0.0")
pitestVersion.set("1.9.0")
targetClasses.addAll("com.abc.def.deliveries.configuration.","com.abc.def.deliveries.security.")
targetTests.addAll("com.abc.def.deliveries.*") // test packages to test coverage on
mutators.addAll("ALL")
threads.set(5)
failWhenNoMutations.set(true)
mutationThreshold.set(70) // minimum of 70% of mutations need to be caught in order for test to pass
reportDir.set(file("$buildDir/pitestHtml")) // output of report
}

On running the task, with the command - ./gradlew :deliveries:pitest -DtimeoutConstant=10000

The logs look like -

Task :deliveries:pitest
17:26:19 PIT >> INFO : Verbose logging is disabled. If you encounter a problem, please enable it before reporting an issue.
17:26:21 PIT >> INFO : Incremental analysis reduced number of mutations by 0
17:26:21 PIT >> INFO : Created 8 mutation test units in pre scan
17:26:23 PIT >> INFO : Sending 35 test classes to minion
17:26:23 PI| >> INFO : /ent tests\to minion / \ - / /17:27:56 PIT >> INFO : Calculated coverage in 95 seconds. -
17:27:56 PIT >> INFO : Incremental analysis reduced number of mutations by 0
17:27:56 PIT >> INFO : Created 8 mutation test units
17:28:10 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
17:28:27 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
17:28:50 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
17:29:09 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
17:29:28 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
17:30:22 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
1:31|01 PIT >> 17:32:36 PIT >> INFO : Completed in 376 secondsRROR
================================================================================

  • Mutators
    ================================================================================

org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_ELSE

Generated 1 Killed 0 (0%)
KILLED 0 SURVIVED 1 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.VoidMethodCallMutator

Generated 5 Killed 0 (0%)
KILLED 0 SURVIVED 5 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.experimental.MemberVariableMutator

Generated 20 Killed 8 (40%)
KILLED 8 SURVIVED 7 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 5


org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_ELSE

Generated 24 Killed 3 (13%)
KILLED 3 SURVIVED 4 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 17


org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator

Generated 27 Killed 25 (93%)
KILLED 10 SURVIVED 2 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 15
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_ORDER_IF

Generated 1 Killed 0 (0%)
KILLED 0 SURVIVED 1 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.MathMutator

Generated 8 Killed 0 (0%)
KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 8


org.pitest.mutationtest.engine.gregor.mutators.returns.EmptyObjectReturnValsMutator

Generated 13 Killed 11 (85%)
KILLED 11 SURVIVED 1 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 1


org.pitest.mutationtest.engine.gregor.mutators.NegateConditionalsMutator

Generated 26 Killed 5 (19%)
KILLED 5 SURVIVED 3 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 18


org.pitest.mutationtest.engine.gregor.mutators.returns.PrimitiveReturnsMutator

Generated 1 Killed 0 (0%)
KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 1


org.pitest.mutationtest.engine.gregor.mutators.ConditionalsBoundaryMutator

Generated 1 Killed 0 (0%)
KILLED 0 SURVIVED 1 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.experimental.ReturnValuesMutator

Generated 50 Killed 39 (78%)
KILLED 18 SURVIVED 2 TIMED_OUT 0 NON_VIABLE 2
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 19
NO_COVERAGE 9


org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanTrueReturnValsMutator

Generated 5 Killed 0 (0%)
KILLED 0 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 5


org.pitest.mutationtest.engine.gregor.mutators.InlineConstantMutator

Generated 28 Killed 4 (14%)
KILLED 4 SURVIVED 7 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 17


org.pitest.mutationtest.engine.gregor.mutators.experimental.NakedReceiverMutator

Generated 12 Killed 8 (67%)
KILLED 8 SURVIVED 4 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.ReturnValsMutator

Generated 41 Killed 38 (93%)
KILLED 23 SURVIVED 2 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 15
NO_COVERAGE 1


org.pitest.mutationtest.engine.gregor.mutators.experimental.ArgumentPropagationMutator

Generated 3 Killed 3 (100%)
KILLED 3 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.ConstructorCallMutator

Generated 4 Killed 1 (25%)
KILLED 1 SURVIVED 3 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 0


org.pitest.mutationtest.engine.gregor.mutators.returns.BooleanFalseReturnValsMutator

Generated 3 Killed 1 (33%)
KILLED 1 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 2


org.pitest.mutationtest.engine.gregor.mutators.NonVoidMethodCallMutator

Generated 98 Killed 56 (57%)
KILLED 41 SURVIVED 17 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 15
NO_COVERAGE 25


org.pitest.mutationtest.engine.gregor.mutators.RemoveConditionalMutator_EQUAL_IF

Generated 25 Killed 4 (16%)
KILLED 4 SURVIVED 3 TIMED_OUT 0 NON_VIABLE 0
MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 0
NO_COVERAGE 18


================================================================================

  • Timings
    ================================================================================

pre-scan for mutations : < 1 second
scan classpath : < 1 second
coverage and dependency analysis : 1 minutes and 35 seconds
build mutation tests : < 1 second
run mutation analysis : 4 minutes and 39 seconds


Total : 6 minutes and 15 seconds


Since the tests are failing randomly, our confidence of using pitest is decreasing. Can you please take a look at this?

@sharath2106 sharath2106 changed the title Lots of random errors - "Minion exited abnormally due to RUN_ERROR", "Minion exited abnormally due to TIMEOUT_ERROR" Lot of random errors - "Minion exited abnormally due to RUN_ERROR", "Minion exited abnormally due to TIMEOUT_ERROR" Aug 9, 2022
@hcoles
Copy link
Owner

hcoles commented Aug 10, 2022

If you enable verbose logging it may give some information about the cause of the RUN_ERRORs.

Also, please note that you almost certainly do not want to enable "ALL" mutators as this will produce low quality mutants and the latest version of pitest is 1.9.4.

@hcoles
Copy link
Owner

hcoles commented Aug 22, 2022

@sharath2106 Did you try enabling verbose logging?

@briardalexis
Copy link

Hi, I also have a lot of RUN_ERROR, maybe these logs will help.

> org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator
>> Generated 44 Killed 44 (100%)
> KILLED 27 SURVIVED 0 TIMED_OUT 0 NON_VIABLE 0 
> MEMORY_ERROR 0 NOT_STARTED 0 STARTED 0 RUN_ERROR 17 
> NO_COVERAGE 0 

more than half of my mutations end up in run error, and it looks like it's always the same issue:

stderr  : 23:21:04 PIT >> WARNING : Error during mutation test
stderr  : java.lang.UnsupportedOperationException: class redefinition failed: attempted to add 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.CatchNewClassLoadersTransformer.restoreClasses(CatchNewClassLoadersTransformer.java:66)
stderr  : 	at org.pitest.mutationtest.execute.CatchNewClassLoadersTransformer.setMutant(CatchNewClassLoadersTransformer.java:57)
stderr  : 	at org.pitest.mutationtest.execute.MutationTestWorker.handleCoveredMutation(MutationTestWorker.java:147)
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)
stdout  : java.lang.UnsupportedOperationException: class redefinition failed: attempted to add a method
23:21:04 PIT >> FINE : MutationIdentifier [location=Location [clazz=com.abriard.braincheck.msconnect.infrastructure.repository.TicketRepository, method=updateUserIdByCode, methodDesc=(Ljava/lang/String;Ljava/lang/String;)Lio/smallrye/mutiny/Uni;], indexes=[20], mutator=org.pitest.mutationtest.engine.gregor.mutators.returns.NullReturnValsMutator] KILLED by [com.abriard.braincheck.msconnect.infrastructure.repository.TicketRepositoryTest.[engine:junit-jupiter]/[class:com.abriard.braincheck.msconnect.infrastructure.repository.TicketRepositoryTest]/[method:updateUserByIdCodeShouldCallUpdate()]]
23:21:04 PIT >> FINE : Exit code was - UNKNOWN_ERROR
23:21:04 PIT >> WARNING : Minion exited abnormally due to RUN_ERROR
23:21:04 PIT >> FINE : Setting 1 unfinished runs to RUN_ERROR state
23:21:04 PIT >> FINE : No longer able to read stream.
23:21:04 PIT >> FINE : No longer able to read stream.

Hope it helps, I can give more information if you need.

@hcoles
Copy link
Owner

hcoles commented Sep 21, 2022

@briardalexis

Based on

java.lang.UnsupportedOperationException: class redefinition failed: attempted to add a method

I think the most likely issue is that another bytecode processor is modifying the mutated class, but it could be something else.

If you can create a minimal project that reproduces the issue I can take a look.

@briardalexis
Copy link

Ok, I'll try to do that next week, thanks!

@briardalexis
Copy link

Hi, here is the minimal project to reproduce the RUN_ERROR: https://github.com/briardalexis/pitest-run-error . It looks like the RUN_ERROR disappear when I remove the quarkus-jacoco dependency. I tried to remove it from my original project, it reduces the amount of RUN_ERROR I get, but it looks like there is other Quarkus dependencies that produce these.

@hcoles
Copy link
Owner

hcoles commented Oct 3, 2022

@briardalexis Just taken a quick look at the repo now. It doesn't generate any run errors for me, but I guess this is a version without jacoco?

Pitest and jacoco can't really co-exist. Even if it didn't generate run errors, the probes that jacoco adds would likely result in performance and other issues.

If you can update the repo to reproduce the run errors you are seeing without jacoco I can take a look.

@briardalexis
Copy link

My bad, I pushed it without quarkus-jacoco dependency, it's fixed now. I'll do another version to find which other dependencies produce RUN_ERROR later this week.

@Manfred73
Copy link

Manfred73 commented Nov 3, 2022

I'm also getting a lot of TIMED_OUT errors. When I add 8000 to the pom, I get more RUN_ERRORS, but still random TIMED_OUT errors as well.

I'm using version 1.9.9 of pitest and version 1.1.0 for the pitest-junit5-plugin.

All my unittests are annotated with @QuarkusTest and integrationtests with @QuarkusIntegrationTest.

I also use the quarkus-jacoco dependency (quarkus version 2.12.3.Final), so it produces a coverage report without configuring anything else in the pom.

I have also removed the quarkus-jacoco dependency, but the result is the same.

The same configuration is working fine for some other spring boot projects. Is this somehow related to Quarkus?

@hcoles
Copy link
Owner

hcoles commented Nov 3, 2022

@Manfred73 It's probably related to Quarkus, but without an example that reproduces the issue it's impossible to say for sure.

@Manfred73
Copy link

OK, I can't post my project as an example here, so I'll have to see if I can create some small example project with the same configuration next week.

@Manfred73
Copy link

Sample project added: https://github.com/Manfred73/file-repository-rest-service

About the pitest: I understand QuarkusTest is using some kind of Proxy classes which may cause pitest not to work? I have also raised an issue on GitHub with Quarkus, but not sure if this is a Quarkus or pitest issue and where it should be fixed: quarkusio/quarkus#29160

@hcoles
Copy link
Owner

hcoles commented Nov 16, 2022

@Manfred73 Thanks for the sample, I should be able to take a look later today.

@hcoles
Copy link
Owner

hcoles commented Nov 16, 2022

@Manfred73 The issue seems to occur when pitest attempts to restore the previously mutated class. For some reason structural changes (new fields/methods) have been added.

The experimental change made for roboelectric support (#1067) seems to fix this, but I'd like to understand the issue better before merging it.

@Manfred73
Copy link

Do you have any idea when this fix will be available in a new version?

@hcoles
Copy link
Owner

hcoles commented Nov 24, 2022

@Manfred73 Will probably be released next week.

@Manfred73
Copy link

Is this working already?

@hcoles
Copy link
Owner

hcoles commented Dec 15, 2022

@Manfred73 The fix was in 1.10.0. There were a few issues in this release, but they resolved in 1.10.3.

@Manfred73
Copy link

I have updated to 1.10.3, but unfortunately still seeing the timeouts:

image

@hcoles
Copy link
Owner

hcoles commented Dec 15, 2022

@Manfred73

The fix was for the RUN_ERRORS.

Time outs are not necessarily a problem. They will occur if a mutation creates an infinite loop, or if the execution time of a test is quite variable. For the latter case tweaking the timeout constant can make them go away.

For the example project you posted I see no time outs if I increase the timeout to 100000 (a low number will probably also work but some experimentation is required).

Unrelated - removing the custom mutationUnitSize config set for this project results in much faster analysis.

@Manfred73
Copy link

I removed the mutationUnitSize and set the timeout to 100000. All tests pass, but boy, it takes a long time ;-)
A big difference between normal unittests in a Spring project and QuarkusTest.
I will experiment a bit with setting the timeout value lower.

@Manfred73
Copy link

Works with 20000 as well.

@hcoles
Copy link
Owner

hcoles commented Dec 15, 2022

@Manfred73 If it's taking a long time to run you might want to take a look at the way in which the tests are written.

In the example repo every test looks to be annotated with @QuarkusTest, although many appear to be pure unit tests that use no quarkus functionality. These tests run green with the annotation removied. I'm not familiar enough with quarkus to know what overhead this adds, but it will be non zero, particularly for pitest which needs to run each test multiple times. In a quick experiment, removing the annotation from just three of these tests reduced analysis time by about 30 seconds.

There are also other tests which could become pure unit tests with a few changes to the code so it is no longer tied to Quarkus (e.g using constructor injection instead of field injection so the classes can be constructed normally).

@Manfred73
Copy link

Yes, that was just a thought I had as well.

I went for the @QuarkusTest annotation as described by the Quarkus testing guide, in which case you only need to include the quarkus-jacoco dependency and no jacoco plugin is needed. But it is still possible to have both and then also include the jacoco maven plugin (Intellij also doesn't seem to work nicely, producing quite some errors when using @QuarkusTest and running a test with coverage).

Using @QuarkusTest spins up the Quarkus application, but I understand it only does this once, even if you have more tests annotated with @QuarkusTest).

But agree that for most tests this should not be necessary and should probably only be used if it really needs some Quarkus related things. Even though the tests run fast enough, it is indeed a very overhead when running the pittest.

For another service I'm using constructor injection, which is indeed a better way to go.

@Manfred73
Copy link

I can confirm that PITest is running much better after having rewritten tests to be pure unittests (removing @QuarkusTest using constructor injection).
The only tests I still annotate with @QuarkusTest are the Resource/Controller classes which I test using RestAssured.
I do notice however, when PIT mutates these classes, it complains about coverage (which is 0%), so I've excluded these classes annotated with @QuarkusTest from PIT.

@hcoles
Copy link
Owner

hcoles commented Jan 6, 2023

@Manfred73 If you update the example project with your changes I'll take a look at the Resource/Controller classes. Depending on how the tests work, the 0% coverage may be expected, or it could be that pitest has a further issue with Quarkus to resolve.

@Manfred73
Copy link

@hcoles I have to see if I can find some time next week to do these changes on the sample project. I have now done this on a real (different) project, which I cannot submit to github.

@Manfred73
Copy link

I think this issue is more about how I have configured maven-surefire-plugin and maven-failsafe-plugin. I used https://quarkus.pro/guides/tests-with-coverage.html as an example, where @QuarkusTest are excluded as unittests (by adding a @tag("integration"), since they are more or less considered as integrationtests. I guess that's why they are all red in the PIT report.

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

No branches or pull requests

4 participants