Improve investigation while encoutering a MathIllegalStateException

Thanks you both @sdinot @evan.ward !
I will know all that for the next time :wink:

We also have a contributing guide :slight_smile:

1 Like

I have followed the steps from contribution guide.

Now my branch is created but still failing:

There has been a timeout failure or the job got stuck. Check your timeout limits or try again

Do you have access to more details ?

Hi @Anne-Laure

On your fork itā€™s normal. Itā€™s because by default Orekitā€™s forks are not connected to the Continuous Integration worker.

I know that itā€™s possible to connect it to the worker, but we need the intervention of our Gitlab expert @sdinot :slight_smile:

Bryan

Oups,Iā€™m really sorry, I had completely missed the rest of this exchange. When I donā€™t answer, donā€™t hesitate to ask me again!

I just allowed your clone to use one of our runners.

And I am backā€¦ after few weeks againā€¦ Sorry!

I have rebased my branch on develop to be up to date.
I have completed the MISSING TRANSLATION in all language files.
I have replaced the embed exception with supressed exception as you requested, now the trace is :

org.orekit.errors.OrekitException: maximal count (5) exceeded
	at org.orekit.errors.OrekitException.unwrap(OrekitException.java:154)
	at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.propagate(AbstractAnalyticalPropagator.java:186)
	at org.orekit.propagation.AbstractPropagator.propagate(AbstractPropagator.java:186)
	at org.orekit.propagation.events.EventDetectorTest.testException(EventDetectorTest.java:335)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:59)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:56)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.BlockJUnit4ClassRunner$1.evaluate(BlockJUnit4ClassRunner.java:100)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:366)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:103)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:63)
	at org.junit.runners.ParentRunner$4.run(ParentRunner.java:331)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:79)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:329)
	at org.junit.runners.ParentRunner.access$100(ParentRunner.java:66)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:293)
	at org.junit.runners.ParentRunner$3.evaluate(ParentRunner.java:306)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:413)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:69)
	at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
	at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:221)
	at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:54)
Caused by: org.hipparchus.exception.MathIllegalStateException: maximal count (5) exceeded
	at org.hipparchus.util.Incrementor.lambda$static$0(Incrementor.java:41)
	at org.hipparchus.util.Incrementor.increment(Incrementor.java:238)
	at org.hipparchus.analysis.solvers.BaseAbstractUnivariateSolver.incrementEvaluationCount(BaseAbstractUnivariateSolver.java:318)
	at org.hipparchus.analysis.solvers.BaseAbstractUnivariateSolver.computeObjectiveValue(BaseAbstractUnivariateSolver.java:165)
	at org.hipparchus.analysis.solvers.BracketingNthOrderBrentSolver.doSolveInterval(BracketingNthOrderBrentSolver.java:297)
	at org.hipparchus.analysis.solvers.BracketingNthOrderBrentSolver.solveInterval(BracketingNthOrderBrentSolver.java:426)
	at org.hipparchus.analysis.solvers.BracketedUnivariateSolver.solveInterval(BracketedUnivariateSolver.java:126)
	at org.orekit.propagation.events.EventState.findRoot(EventState.java:323)
	at org.orekit.propagation.events.EventState.evaluateStep(EventState.java:220)
	at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.acceptStep(AbstractAnalyticalPropagator.java:237)
	at org.orekit.propagation.analytical.AbstractAnalyticalPropagator.propagate(AbstractAnalyticalPropagator.java:172)
	... 28 more
	Suppressed: org.orekit.errors.OrekitException: a-fake-detector failed to find root between 2011-05-11T00:00:00.000 (g=1.000e+00) and 2011-05-11T00:01:39.178 (g=-1.000e+00) : maximal count (5) exceeded
Last iteration at 2011-05-11T00:00:00.000 (g=1.000e+00)
		at org.orekit.propagation.events.EventState.findRoot(EventState.java:351)
		... 31 more
	[CIRCULAR REFERENCE:org.hipparchus.exception.MathIllegalStateException: maximal count (5) exceeded]

While running tests, I have found a duplicated message in the italian file so I fixed that in a separate commit (donā€™t know if it passes on develop?).

Thanks @sdinot for letting me use the gitlab pipeline, it helped a lot!
Still, my branch is failure because it can not execute sonar, maybe because I am on a fork ?

I donā€™t know if this could be merged before 11.0 release ? I have seen that it is in discussionā€¦

Best regards,

Anne-Laure

You are welcome!

You are right, but here is how to solve this problem:

  1. Connect to our SonarQube instance using your Gitlab account.
  2. The first time you log in, SonarQube will prompt you to generate a token. Generate it and keep it safe on your workstation. If you did not do so the first time you logged in, you can do so later by going to your account settings on SonarQube: My account ā†’ Security ā†’ Generate Tokens
  3. Then connect to Gitlab.
  4. Go to the continuous integration (CI) configuration page of your fork (Settings ā†’ CI/CD ā†’ Variables ā†’ Expand) and declare a variable named SONAR_TOKEN. The value of this variable must be the value of the token provided by SonarQube. Check the ā€œMask variableā€ option and click on ā€œAdd variableā€.
  5. SonarQube dynamically initiates the project on the first submission, but the first submission must be on the master branch. You can cause this by manually triggering a pipeline:
    • Once Orekit version 11 has been released (and its code pushed to master), all you will have to do will be follow this path: Project home page ā†’ CI/CD ā†’ Pipelines ā†’ Run pipeline ā†’ Select master branch ā†’ Run pipeline ā†’ Wait half an hour :wink:
    • While waiting for the release of Orekit version 11, you need to perform one more step, just before launching the pipeline: You have to override (in the web interface of Gitlab) the definition of the MAVEN_CLI_OPTS variable (defined in the CI script). Just before clicking on the final ā€œRun pipelineā€, state that MAVEN_CLI_OPTS variable value is:
      -s .CI/maven-settings.xml --batch-mode --errors --fail-at-end --show-version -DinstallAtEnd=true -DdeployAtEnd=true -Dsonar.projectKey="Anne-Laure/orekit" -Dsonar.projectName="Orekit (Anne-Laure/orekit)"
      
      In fact, this is the default value of the MAVEN_CLI_OPTS variable, increased by the following parameters:
      -Dsonar.projectKey="Anne-Laure/orekit" -Dsonar.projectName="Orekit (Anne-Laure/orekit)"
      
      Then, run the pipeline and wait half an hour.
  6. After that, you can run again the pipeline on your working branch. But if your working branch was created from master or release-10.3 branches, you have to override the MAVEN_CLI_OPTS variable as on the master branch.

SĆ©bastien

1 Like

Hello,

Thank you for your advice. I have followed the first steps.

I have tried to run master at the moment and it worked (with simple quote).
Still my branch is RED after that maybe because I need to wait for 11.0 release ?
@sdinot Do I understand well that I could not run sonar on my branch until 11.0 is released ?

Best regards,

Anne-Laure

We would be very happy to include this contribution in the 11.0 release.

Sorry, but I am afraid that the workaround I provided does not work because of the following command line in the CI script. :frowning:

    - mvn $MAVEN_CLI_OPTS sonar:sonar -Dsonar.login=${SONAR_TOKEN} -Dsonar.branch.name=${CI_COMMIT_REF_NAME}

In fact, the initial submission should not specify a branch while the above command does. So you have no choice but to initiate this first solution from your workstation:

cd orekit-repository
git switch master

export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64

mvn -s .CI/maven-settings.xml --batch-mode --errors --fail-at-end \
    --show-version -DinstallAtEnd=true -DdeployAtEnd=true verify site

export SONAR_TOKEN=<your-sonarqube-token>
export CI_PROJECT_TITLE=Orekit
export CI_PROJECT_NAMESPACE=<your-namespace>
export CI_PROJECT_NAME=orekit
export SONAR_PROJECT_KEY="${CI_PROJECT_NAMESPACE}:${CI_PROJECT_NAME}"
export SONAR_PROJECT_NAME="${CI_PROJECT_TITLE} (${CI_PROJECT_NAMESPACE}:${CI_PROJECT_NAME})"

mvn -s .CI/maven-settings.xml --batch-mode --errors --fail-at-end \
    --show-version -DinstallAtEnd=true -DdeployAtEnd=true sonar:sonar \
    -Dsonar.login=$SONAR_TOKEN -Dsonar.projectKey="$SONAR_PROJECT_KEY" \
    -Dsonar.projectName="$SONAR_PROJECT_NAME"

Of course, this only works if Maven can connect to the Orekit SonarQube server from your workstation.

I apologize for the lost time, but in my defense, SonarQube is really a fussy softwareā€¦

I know integration can be hard, even if I have never used Sonar, thatā€™s totally fine!

As you quote, it does not work from my side as I am not connected to the networkā€¦

To sumup :

  • my branch would need the handy copy of @evan.ward as suggested above
  • Should I wait for this copy before requesting a merge ?
  • sonar did not execute : how we could solve that ? Is it possible to move this branch on the main repository ? Shall we merge blindly (my modifications are minor I think) ? I do not know what could be the best way to avoid or to succeed the sonar step ?

Best regards,

Anne-Laure

I think that I can initialize your project on SonarQube for you. Do you agree?

Since I had a little time to devote to this problem tonight and wonā€™t have much tomorrow, I took the liberty of :

  • generate another token in SonarQube for you;
  • build Orekit on my workstation by initializing as I had indicated in a previous message some environment variables;
  • launch the quality analysis and push the result on SonarQube.

Here is the report.

And I just restarted the last failed pipeline on your working branch.

Here is the report on branch issue-797. I have filtered the issues to show only those assigned to you (but 150 issues are not assigned).

Thank you a lot @sdinot !!! And sorry that it bothered you late yesterday :roll_eyes:
I fixed 2 of the 4 errors found :+1: .

The other 2 are about ā€œmissing javadocā€ in OrekitMessages. I have seen that this same error is also raised for others messages in the same file. I decided to let the code as it was, really similar to others. Hope thatā€™s ok for you?

Best regards,

Anne-Laure

I am not a member of the development team. Iā€™m just the guy who makes sure that people have the tools to make their lives easier and that they can contribute. :wink:

But many of the unassigned warnings are ā€œmissing Javadocā€, so I guess the team wonā€™t be shocked if two such warnings appear in addition to the others. :slight_smile:

Hello everyone,

With the sonar fixed and all the merge request feedbacks taken into accountā€¦ I think my branch could be ready for merge now ?! :blush:

Thank you a lot for your help and advices to all of you!
Really sorry it took me so long !
I learned a lot about contributing to Orekit and I will share this experience with my team very soon.

Best regards,
Anne-Laure

1 Like

Hello,

I have second thoughts about the exception handling.

With the supresssed use, the detailed message does not appear on top/first.
Whereas with the caused by exception, the detailed message appears on top/first, especially it can be reached with e.getMessage() for any logging mechanism for example.

Also, I would think that it is more meaningful for a user that the exception is ā€˜caused by something elseā€™ than it is ā€œsuppressedā€.

Best regards,

Anne-Laure

Anne-Laure,

That would be fine. The word ā€œsuppressedā€ doesnā€™t really describe the relationship between the two messages.

Best Regards,
Evan

1 Like