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

CT: Assertion failed: recalculateVelocityAndAcceleration ... #56

Open
pixelzoom opened this issue Mar 26, 2020 · 14 comments
Open

CT: Assertion failed: recalculateVelocityAndAcceleration ... #56

pixelzoom opened this issue Mar 26, 2020 · 14 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Mar 26, 2020

Intermittent failure in CT (Continuous Testing):

normal-modes : fuzz : require.js : run
https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/normal-modes/normal-modes_en.html?postMessageOnLoad&postMessageOnError&postMessageOnBeforeUnload&brand=phet&ea&fuzz&memoryLimit=1000
Query: brand=phet&ea&fuzz&memoryLimit=1000
Uncaught Error: Assertion failed: bad result of recalculateVelocityAndAcceleration
Error: Assertion failed: bad result of recalculateVelocityAndAcceleration
    at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/assert/js/assert.js?bust=1585220009747:22:13)
    at OneDimensionModel.recalculateVelocityAndAcceleration (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/normal-modes/js/one-dimension/model/OneDimensionModel.js:342:13)
    at OneDimensionModel.setVerletPositions (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/normal-modes/js/one-dimension/model/OneDimensionModel.js:311:10)
    at OneDimensionModel.singleStep (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/normal-modes/js/one-dimension/model/OneDimensionModel.js:282:12)
    at OneDimensionModel.step (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/normal-modes/js/one-dimension/model/OneDimensionModel.js:262:14)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/joist/js/Sim.js:268:20
    at Action.execute (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/axon/js/Action.js:224:18)
    at Sim.stepSimulation (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/joist/js/Sim.js:921:31)
    at Sim.stepOneFrame (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/joist/js/Sim.js:911:12)
    at Sim.runAnimationLoop (https://bayes.colorado.edu/continuous-testing/snapshot-1585217674155/joist/js/Sim.js:894:12)
id: Bayes Chrome
Approximately 3/26/2020, 4:14:34 AM

Here's the assertion in OneDimensionModel.js:

assert( this.masses[ i ].velocityProperty.get().y === 0, 'bad result of recalculateVelocityAndAcceleration' );
@pixelzoom
Copy link
Contributor Author

Still occurring intermittently as of 5/18/202.

@Hyodar
Copy link
Contributor

Hyodar commented May 18, 2020

Right, we'll take a look at it.

@Hyodar
Copy link
Contributor

Hyodar commented Jul 2, 2020

Well, I got some time to work on the sim again!

I have a pretty good idea of what may be happening:
If the user grabs a mass and presses one of the arrow buttons to change the active AmplitudeDirection during the dragging process, the computed verlet positions (velocity and acceleration, too) directions will not match with the amplitudeDirectionProperty value. Thus, it will trigger the assert.

I don't think this would happen in a real situation, but it could be possible with the fuzz flag and some good hours of execution (I actually ran the sim here for a couple of hours and nothing happened).

@tmildemberger, do you think that makes any sense?

If this is really the issue, we should probably:

  • reset the draggingMassIndexProperty whenever the amplitudeDirectionProperty is changed; or
  • prevent the amplitudeDirectionProperty from being changed when a mass is being dragged

@tmildemberger
Copy link
Contributor

Before 366a306 there was a method to swap x and y coordinates of the displacement and velocity of every mass when the amplitude direction changed. It was removed because I thought it wouldn't be possible to press the button to change the amplitude direction while dragging a mass.

But... I have just tested the sim for a while on my phone and this was not the only problem caused by forgetting about the existence of multitouch (I'll better investigate the other oddities I found out to be possible using more than one pointer and open the appropriate issues).

Maybe it's a good idea to bring this method back, as that will be enough to solve the failing of the assertion when dragging a mass while changing the amplitude direction using multitouch, but I'm still not sure if this will solve the intermittent failure detected in CT.

@pixelzoom
Copy link
Contributor Author

Multitouch is always a little tricky. Using query parameterfuzzPointers might help you. It simulates multitouch while fuzzing. For example, running with ?ea&fuzz&fuzzPointers=2 will test the sim for mouse and touch events with 2 concurrent "pointers".

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Dec 6, 2021

This issue is a symptom of a more general problem, a lack of support for mulitouch, see #80. In fact, the implementation assumes that there is no multitouch. E.g.draggingMassIndexProperty assumes there is only 1 mass that is draggable at a time (see the workaround applied in #79 for the 1.0 prototpe).

That said... In the above commit, I added some additional info to the assertion messages. For example:

Uncaught Error: Assertion failed: recalculateVelocityAndAcceleration: N=3 i=2 velocity=Vector2(0.0014518150254393945, 0), expected non-zero y component

@pixelzoom pixelzoom changed the title CT: bad result of recalculateVelocityAndAcceleration CT: Assertion failed: recalculateVelocityAndAcceleration ... Dec 6, 2021
@KatieWoe
Copy link
Contributor

normal-modes : multitouch-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/normal-modes/normal-modes_en.html?continuousTest=%7B%22test%22%3A%5B%22normal-modes%22%2C%22multitouch-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1647595636252%22%2C%22timestamp%22%3A1647598031817%7D&brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=false
Query: brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=false
Uncaught Error: Assertion failed: recalculateVelocityAndAcceleration: N=6 i=1 velocity=Vector2(-3.363756398051847, 0), expected non-zero y component
Error: Assertion failed: recalculateVelocityAndAcceleration: N=6 i=1 velocity=Vector2(-3.363756398051847, 0), expected non-zero y component
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/assert/js/assert.js:25:13)
at OneDimensionModel.recalculateVelocityAndAcceleration (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:291:13)
at OneDimensionModel.setVerletPositions (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:257:10)
at OneDimensionModel.singleStep (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:230:12)
at OneDimensionModel.step (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:210:14)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:254:22
at PhetioAction.execute (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/tandem/js/PhetioAction.js:90:17)
at Sim.stepSimulation (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:822:31)
at Sim.stepOneFrame (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:811:12)
at Sim.runAnimationLoop (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:789:12)
id: Bayes Chrome
Snapshot from 3/18/2022, 3:27:16 AM

----------------------------------

normal-modes : pan-and-zoom-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/normal-modes/normal-modes_en.html?continuousTest=%7B%22test%22%3A%5B%22normal-modes%22%2C%22pan-and-zoom-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1647595636252%22%2C%22timestamp%22%3A1647597662654%7D&brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Query: brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Uncaught Error: Assertion failed: recalculateVelocityAndAcceleration: N=10 i=1 velocity=Vector2(-0.5374822624290272, 0), expected non-zero y component
Error: Assertion failed: recalculateVelocityAndAcceleration: N=10 i=1 velocity=Vector2(-0.5374822624290272, 0), expected non-zero y component
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/assert/js/assert.js:25:13)
at OneDimensionModel.recalculateVelocityAndAcceleration (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:291:13)
at OneDimensionModel.setVerletPositions (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:257:10)
at OneDimensionModel.singleStep (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:230:12)
at OneDimensionModel.step (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:210:14)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:254:22
at PhetioAction.execute (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/tandem/js/PhetioAction.js:90:17)
at Sim.stepSimulation (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:822:31)
at Sim.stepOneFrame (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:811:12)
at Sim.runAnimationLoop (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:789:12)
id: Bayes Chrome
Snapshot from 3/18/2022, 3:27:16 AM

----------------------------------

normal-modes : pan-and-zoom-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/normal-modes/normal-modes_en.html?continuousTest=%7B%22test%22%3A%5B%22normal-modes%22%2C%22pan-and-zoom-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1647595636252%22%2C%22timestamp%22%3A1647613678472%7D&brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Query: brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true
Uncaught Error: Assertion failed: recalculateVelocityAndAcceleration: N=7 i=2 velocity=Vector2(0.21619212057443649, -0.04415930380800608), expected non-zero x component
Error: Assertion failed: recalculateVelocityAndAcceleration: N=7 i=2 velocity=Vector2(0.21619212057443649, -0.04415930380800608), expected non-zero x component
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/assert/js/assert.js:25:13)
at OneDimensionModel.recalculateVelocityAndAcceleration (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:288:13)
at OneDimensionModel.setVerletPositions (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:257:10)
at OneDimensionModel.singleStep (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:230:12)
at OneDimensionModel.step (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/normal-modes/js/one-dimension/model/OneDimensionModel.js:210:14)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:254:22
at PhetioAction.execute (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/tandem/js/PhetioAction.js:90:17)
at Sim.stepSimulation (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:822:31)
at Sim.stepOneFrame (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:811:12)
at Sim.runAnimationLoop (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1647595636252/chipper/dist/js/joist/js/Sim.js:789:12)
id: Bayes Chrome
Snapshot from 3/18/2022, 3:27:16 AM

@pixelzoom
Copy link
Contributor Author

Latest stack trace:

normal-modes : fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1654864711113/normal-modes/normal-modes_en.html?continuousTest=%7B%22test%22%3A%5B%22normal-modes%22%2C%22fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1654864711113%22%2C%22timestamp%22%3A1654866068367%7D&brand=phet&ea&fuzz&memoryLimit=1000
Query: brand=phet&ea&fuzz&memoryLimit=1000
Uncaught Error: Assertion failed: recalculateVelocityAndAcceleration: N=3 i=1 velocity=Vector2(-0.0263046873121256, 0), expected non-zero y component
Error: Assertion failed: recalculateVelocityAndAcceleration: N=3 i=1 velocity=Vector2(-0.0263046873121256, 0), expected non-zero y component
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1654864711113/assert/js/assert.js:28:13)
at assert (OneDimensionModel.js:308:12)
at recalculateVelocityAndAcceleration (OneDimensionModel.js:270:9)
at setVerletPositions (OneDimensionModel.js:241:11)
at singleStep (OneDimensionModel.js:221:13)
at step (Sim.ts:447:21)
at apply (PhetioAction.ts:124:16)
at execute (Sim.ts:990:30)
at stepSimulation (Sim.ts:980:11)
at stepOneFrame (Sim.ts:955:11)
id: Bayes Puppeteer
Snapshot from 6/10/2022, 6:38:31 AM

@pixelzoom
Copy link
Contributor Author

It's likely to be a long time before this is fixed. It may be masking other problems, and it would be nice not to have to continually inspect in CT. So for now, I've commented out the failing assertion, and added a TODO that references this issue.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jun 14, 2022

In the above commit, I commented out a similar failing assertion for acceleration, marked with a TODO.

pixelzoom added a commit that referenced this issue Jun 21, 2022
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Jun 21, 2022

In the above commit, I commented out the entire if ( assert ) {...} block, since all of its assertions are failing in CT.

@KatieWoe
Copy link
Contributor

KatieWoe commented Sep 9, 2022

Can this be closed for phetsims/qa#832?

@pixelzoom
Copy link
Contributor Author

Please keep this open. The problem is still very much present. The reporting in CT has been silenced (by commenting out assertions) since there's no one to work on this.

@pixelzoom pixelzoom removed their assignment Sep 9, 2022
@marlitas
Copy link
Contributor

marlitas commented Sep 22, 2023

@pixelzoom, since the assertions have been silenced here can we add the label blocks-sim-publication and deferred to indicate we will not work on this until the sim is re-prioritized? Please remove the labels if you disagree.

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

No branches or pull requests

5 participants