AbstractIntegrator.acceptStep endless looping in eventLoop

Hello, I have a simulation that get blocked. With the debugger I saw that it was looping endlessly in the eventLoop of the method acceptStep of AbstractIntegrator.

I use a combination of detectors for the start and the stop of low thrust maneuvers. One high level condition is to not thrust in eclipse, so I combined the start and stop detectors with an eclipse detectors. This result to have these 2 detectors to have a root at exactly the same time (date of eclipse). One will be increasing, the other one is decreasing, only the increasing will be managed once detected. I implemented this behaviour with a basic unit test and there is no problem in event detection. But I have sometime a problem when I use the whole combination of detectors.

When there is the problem, here are the details :

  • at the beginning of the eventLoop there are 2 events in the occurringEvents queue (start and stop of maneuver)
  • the test state.tryAdvance succeed and the 2 events are inverted in the queue
  • back to the beginning of eventLoop, and the behaviour above is repeated

I workaroud that works in my case is to compare the date of the event and to not invert the event if this is the same date :

for (final EventState state : eventsStates) {
    if (state != currentEvent && state.tryAdvance(eventState, interpolator)) {
        double absDiff = FastMath
                .abs(state.getEventTime() - currentEvent.getEventTime());
        if (absDiff > 0) {
            // we need to handle another event first
            // remove event we just updated to prevent heap corruption
            occurringEvents.remove(state);
            // add it back to update its position in the heap
            occurringEvents.add(state);
            // re-queue the event we were processing
            occurringEvents.add(currentEvent);
            continue eventLoop;
        } // else stuck
        else {
            System.out.println(
                    "Potential infinite loop on event detected : bypass it.");
        }
    }
}

I am pretty sure that it is a dirty workaround. But is there any risk to break the normal behaviour by doing that ? Is there a proper way to avoid this kind of infinite loop (or which looks like infinite) ?

I am sorry to not being able to provide the code to reproduce. It is a complex use case that needs many many classes

Hi Mikael,

Thanks the detailed description. I would definitely consider that behavior a bug. I want to understand the root cause so we can make sure the correct fix is applied.

The best help you could provide to get this fixed is a failing test case so I can step through the logic in my debugger. Also we need to add a test case to our suite so this issue stays fixed. I know it may take some time to put a test case together, but that is the only way I see this getting fixed at the moment.

I’ve tried reproducing the issue on my machine and was unable to. Our test suite has many cases devoted to close events (see *CloseEventsTest) including one that tests simultaneous events. I added another case that tests simultaneous events with opposite signs. That test also performed correctly, finding two events within the specified tolerance.

Which Propagator are you using? Numerical, Analytical and their field versions all have separate copies of the same code in order to accommodate the different types used for time. They also all have their own numerical precision subtleties. Which specific EventDetectors are you using? If the event detector is stateful (e.g. DateDetector) and a single instance is added multiple times to the same propagator (such as reusing the same instance in multiple BooleanDetectors) it may violate the Rules of Event Handling at [1, 2]. Namely that the definition of a g function can only change when an event occurs for that event handler. What are the maxCheck and event tolerance intervals you have set?

The infinite loop should be prevented because EventState.tryAdvance(...) returns false. Specifically the following check should be triggered. What are the values of g, pendingEventTime, t, positive, and g0Positive such that tryAdvance ends up calling findRoot(...)?

        // just found an event and we know the next time we want to search again
        if (strictlyAfter(t, earliestTimeConsidered)) {
            return false;
        }

Have you tried running your proposed modification against the test suite? I think it would fail when a new event is discovered at the same time as another event. In that case the new event would be dropped resulting in two increasing (or decreasing) events in a row for that detector.

Regards,
Evan

[1] https://hipparchus.org/apidocs-1.4/org/hipparchus/ode/events/package-summary.html
[2] https://hipparchus.org/apidocs-1.4/org/hipparchus/ode/events/ODEEventHandler.html#g(org.hipparchus.ode.ODEStateAndDerivative)

Thank you for your answer. I will try to extract the failing use case, this might be a bit hard but I will see.
First I will check that the boolean detectors do not share a common instance of an event detector. And I will check my workaround with the test suite. I thought at another way of detecting the iteration being stuck, it is when occurringEvents permuted the same way endlessly, or using a max iteration counter.

I come back to you in a few days

Hi,
The boolean detectors where sharing some of the sub detectors. This is due to the fact the create method creates a new list but uses the same instance of detectors. I changed the behaviour to make a copy of each detector (by calling withHandler on each one). This does not solve the problem but might be interesting to integrate ot Orekit anyway.

I tested my workaround against the hipparchus test suite and there is no error.

I will know check if it possible to extract a “simple” unit test from the failing use case

Hi again,
That is quite impossible to isolate the use case as it happens in a complex simulation involving a lot of mechanisms on maneuvers, at least 20 classes are involved.
So I will provide as many details as possible
Propagator numerical :

public static double minStep = 1e-2;
public static double maxPropagationStep = 100;
public static double[] vecAbsoluteTolerance = { 1e-5, 1e-5, 1e-5, 1e-8, 1e-8, 1e-8, 1e-5 };
public static double[] vecRelativeTolerance = { 1e-10, 1e-10, 1e-10, 1e-10, 1e-10, 1e-10,


public NumericalPropagator createPropagator(Orbit orbit) {
    DormandPrince54Integrator integrator = new DormandPrince54Integrator(minStep,
            maxPropagationStep, vecAbsoluteTolerance, vecRelativeTolerance);

    final NumericalPropagator propagator = new NumericalPropagator(integrator);

    SpacecraftState iniState = new SpacecraftState(orbit, totalMass);
    propagator.resetInitialState(iniState);

    return propagator;
}

2 maneuvers with each one a start and stop detector.
Detectors on maneuvers : Boolean detectors using Eclipse detector, and 2 custom detectors (position on orbit, revolution counter)

When the problem occurs, here are the debug traces :

-------- eventLoop -----
occurringEvents (hashcodes) : [1583079430 1518671028 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : Infinity
  > tryAdvance 1681422435
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1518671028
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : 4256.814376977759
  >>>> tryAdvance 1681422435
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1518671028 1583079430 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : Infinity
  > tryAdvance 1709371186
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1583079430
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : 4256.814376977759
  > tryAdvance 1709371186
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1583079430 1518671028 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : Infinity
  > tryAdvance 389052302
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1518671028
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : 4256.814376977759
  >>>> tryAdvance 389052302
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1518671028 1583079430 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : Infinity
  > tryAdvance 910977735
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1583079430
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : 4256.814376977759
  > tryAdvance 910977735
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1583079430 1518671028 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : Infinity
  > tryAdvance 294713101
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1518671028
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : 4256.814376977759
  > tryAdvance 294713101
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1518671028 1583079430 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : Infinity
  > tryAdvance 1668878706
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1583079430
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : 4256.814376977759
  > tryAdvance 1668878706
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1583079430 1518671028 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : Infinity
  > tryAdvance 2011272852
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1518671028
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : 4256.814376977759
  > tryAdvance 2011272852
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1518671028 1583079430 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : Infinity
  > tryAdvance 581882109
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1583079430
  currentEvent.hashCode() : 1518671028
  state.getEventTime() : 4256.814376977759
  > tryAdvance 581882109
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1583079430 1518671028 ]
for (state : eventsStates)
  state.hashCode() : 1343109757
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : Infinity
  > tryAdvance 873489210
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1518671028
  currentEvent.hashCode() : 1583079430
  state.getEventTime() : 4256.814376977759
  > tryAdvance 873489210
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
  => tryAdvance true    

I hope this helps, let me know if I can provide more details.

Edit : additionnal element forgotten : in the propagation there is also detactors that will stop the propagation when the target is met (eccentricity with a precision of 1e-5). One of the eventState in the debug log above is related to this detector. But the target will be met later

Hi,

Thanks for all the extra information. I’ll take a look at it. I will see if I can determine a test case from it. Still need the test case to make sure the bug stays fixed as code is modified.

Regards,
Evan

A few questions:

  • What is the maxCheck and threshold set for the BooleanDetectors?
  • Could you make a plot of the g function in the vicinity of t = 4256.814376977759?

After looking through that the issue might be in EventState.findRoot(...). pendingEventTime is supposed to be set to a ttime at or before the zero crossing, but in this case it is after since t==pendingEventTime, g(t) > 0, and g0 < 0. Could you provide a trace of how these variables are set during the call to findRoot that originally found the roots: ta, tb, ga, gb, beforeRootT, beforeRootG, afterRootT, afterRootG, loopT, loopG?

  • maxCheck : 100
  • threshold : 1.0E-6
    here is a plot of the 4 booleans detectors

    From what I see quickly there is a problem of maneuvers nearly overlapping: i.e. the 2 thrust arcs are too close. I will check that quickly.

Well, the problem does not occur if I correctly manage the thrust arc to avoid overlapping.
This was a model error. Sorry about that.
I don’t know if you want to close this issue or if you prefer to go further to add more robustness. I can provide the variables values in findRoot if you want

It appears that you’ve found a way for findRoot to return true but not bracket a root, which would be a bug. I would like to either find and fix the bug, or show that one of the preconditions of the method was violated. So if you’re still willing to help having the detailed trace from findRoot would be the next step.

I’m glad you fixed the problem for your application. I’m not sure I understand how overlapping thrust arcs would cause this problem. Perhaps I don’t need to understand those details. I could imagine a case where if the maneuver started and ended at the same time it could get stuck in a loop of RESET_*, but that wasn’t the case here.

I think that the case you describe was the one happening : one maneuver was ending exaclty when another one was starting, both using RESET_* to manage the event. This specific case might be detected and throw an error, or might be handle safely

here the trace you asked :

-------- eventLoop -----
occurringEvents (hashcodes) : [1927848747 1907166116 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : Infinity
>>>> tryAdvance 1164970926
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1907166116
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1164970926
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = -0.0017453283659004206
        tb     = 4256.814376977759
        gb     = 0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = -0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = 0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = -0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1907166116 1927848747 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : Infinity
>>>> tryAdvance 1924536784
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1927848747
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1924536784
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = 0.0017453283659004206
        tb     = 4256.814376977759
        gb     = -0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = 0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = -0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = 0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1927848747 1907166116 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : Infinity
>>>> tryAdvance 1809832969
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1907166116
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1809832969
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = -0.0017453283659004206
        tb     = 4256.814376977759
        gb     = 0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = -0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = 0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = -0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1907166116 1927848747 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : Infinity
>>>> tryAdvance 1224247474
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1927848747
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1224247474
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = 0.0017453283659004206
        tb     = 4256.814376977759
        gb     = -0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = 0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = -0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = 0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1927848747 1907166116 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : Infinity
>>>> tryAdvance 227596152
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1907166116
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 227596152
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = -0.0017453283659004206
        tb     = 4256.814376977759
        gb     = 0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = -0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = 0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = -0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1907166116 1927848747 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : Infinity
>>>> tryAdvance 1336555395
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1927848747
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1336555395
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = 0.0017453283659004206
        tb     = 4256.814376977759
        gb     = -0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = 0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = -0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = 0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1927848747 1907166116 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : Infinity
>>>> tryAdvance 1509987819
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1907166116
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1509987819
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = -0.0017453283659004206
        tb     = 4256.814376977759
        gb     = 0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = -0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = 0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = -0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1907166116 1927848747 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : Infinity
>>>> tryAdvance 1446062849
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1927848747
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1446062849
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = 0.0017453283659004206
        tb     = 4256.814376977759
        gb     = -0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = 0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = -0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = 0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1927848747 1907166116 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : Infinity
>>>> tryAdvance 1569791400
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1907166116
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1569791400
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = -0.0017453283659004206
        tb     = 4256.814376977759
        gb     = 0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = -0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = 0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = -0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1907166116 1927848747 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : Infinity
>>>> tryAdvance 1134116790
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1927848747
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1134116790
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = 0.0017453283659004206
        tb     = 4256.814376977759
        gb     = -0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = 0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = -0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = 0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1927848747 1907166116 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : Infinity
>>>> tryAdvance 501761507
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1907166116
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 501761507
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = -0.0017453283659004206
        tb     = 4256.814376977759
        gb     = 0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = -0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = 0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = -0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1907166116 1927848747 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : Infinity
>>>> tryAdvance 1113459836
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  => tryAdvance false
  state.hashCode() : 1927848747
  currentEvent.hashCode() : 1907166116
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 1113459836
    g                = -0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = false
    g0Positive       = true
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = 0.0017453283659004206
        tb     = 4256.814376977759
        gb     = -0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = 0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = -0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = 0.0017453283659004206
  => tryAdvance true
-------- eventLoop -----
occurringEvents (hashcodes) : [1927848747 1907166116 ]
for (state : eventsStates)
  state.hashCode() : 1722332573
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : Infinity
>>>> tryAdvance 393688514
    g                = -0.004960705022253478
    pendingEventTime = NaN
    t                = 4256.814376977759
    positive         = false
    g0Positive       = false
  => tryAdvance false
  state.hashCode() : 1907166116
  currentEvent.hashCode() : 1927848747
  state.getEventTime() : 4256.814376977759
>>>> tryAdvance 393688514
    g                = 0.13349433239971395
    pendingEventTime = 4256.814376977759
    t                = 4256.814376977759
    positive         = true
    g0Positive       = false
>>>>>>>> find root
        ta     = 4256.814376977759
        ga     = -0.0017453283659004206
        tb     = 4256.814376977759
        gb     = 0.13349433239971395
        beforeRootT   = 4256.814376977759
        beforeRootG   = -0.0017453283659004206
        afterRootT    = 4256.814377977758
        afterRootG    = 0.13349433349669212
        loopT         = 4256.814376977759
        loopG         = -0.0017453283659004206
  => tryAdvance true    

Let me know if I can provide more details.

Thanks for the details! I was finally able to reproduce it. I’ll be filing bug reports against hipparchus and Orekit.

1 Like

Good news, thank you for the support

1 Like

This should be fixed in the 684-infinit-loop branch in the orekit repository. Could you try that out and make sure it is fixed for your application? The jar should be available from [1] in a couple hours.

[1] https://gitlab.orekit.org/orekit/orekit/-/jobs/789/artifacts/file/target/orekit-10.2-SNAPSHOT.jar

I tested the update made on hipparchus on EventState, it works well. Thank you for fixing the issue.