phetsims/vector-addition

?fuzzPointers=2 error: "Cannot drag tip when not on graph"

Closed this issue · 7 comments

From phetsims/aqua#106, this assertion is thrown when fuzzing with ?fuzzPointers=2.

Cannot drag tip when not on graph.

It didn't happen right away, I didn't encounter this until fuzzing the sim for about 45 seconds. Assigning to the responsible dev for this repo.

@jessegreenberg I doubt that anything would fail with ?fuzzPointers=2, because that doesn't enable assertions. Please provide the full set of query parameters for the test, and indicate whether you were testing built or unbuilt.

I am seeing this with brand=phet&ea&fuzz&fuzzPointers=2, in the unbuilt sim.

In phetsims/aqua#106 (comment), @jessegreenberg reported:

Here is the new list after fuzzing for one minute per sim:
...

  • vector-addition: Uncaught Error: Assertion failed: Cannot drag tip when not on graph, #271
  • vector-addition: Assertion failed: reentry detected, value=Vector2(-63.200000000000045, 111.4), oldValue=Vector2(116.00000000000001, -87.00000000000001)
    Error: Assertion failed: reentry detected, value=Vector2(-63.200000000000045, 111.4), oldValue=Vector2(116.00000000000001, -87.00000000000001)

I don't see a GitHub issue for the "reentry detected" error. @jessegreenberg did that occur as part of the same test as the "Cannot drag tip" error? If so, did it appear before or after in the stack trace?

Reproduced in working copy with brand=phet&ea&fuzz&fuzzPointers=2, stack traces below. The "reentry detected" error occurs after the "Cannot drag tip" error. The second error is likely symptomatic of the first error.

assert.js:22 Uncaught Error: Assertion failed: Cannot drag tip when not on graph
    at window.assertions.assertFunction (assert.js:22)
    at VectorNode.updateTipPosition (VectorNode.js:362)
    at tipListener (VectorNode.js:228)
    at TinyEmitter.emit (TinyEmitter.js:71)
    at Vector2Property._notifyListeners (Property.js:280)
    at Vector2Property.set (Property.js:178)
    at Vector2Property.set value [as value] (Property.js:350)
    at DragListener.reposition (DragListener.js:625)
    at DragListener.js:294
    at DragListener.onPress (PressListener.js:601)

assert.js:22 Uncaught Error: Assertion failed: reentry detected, value=Vector2(15.77426636568849, -92.23702031602707), oldValue=Vector2(-100.12641083521441, -48.86004514672685)
    at window.assertions.assertFunction (assert.js:22)
    at Vector2Property._notifyListeners (Property.js:277)
    at Vector2Property.set (Property.js:178)
    at Vector2Property.set value [as value] (Property.js:350)
    at DragListener.reposition (DragListener.js:625)
    at DragListener._dragAction.Action.parameters.name (DragListener.js:241)
    at Action.execute (Action.js:225)
    at DragListener.drag (DragListener.js:363)
    at DragListener.pointerMove (PressListener.js:790)
    at Input.dispatchToListeners (Input.js:1822)

As of 2/3/21, multi-touch fuzzing has been enabled in CT, see phetsims/aqua#106 and phetsims/perennial@e10047f. So this error is now occurring in CT.

To reproduce manually on an iPad:

  1. Run the sim on a touch device with ?ea
  2. Go to the "Explore 2D" screen
  3. With one finger, drag a⃗ out of the toolbox, but do not put it on the graph.
  4. With another finger, try to drag the tip of a⃗. This will cause the exception.

Since there's no harm in allowing the user to drag the vector's tip when the vector is not on the graph, I simply removed the problematic assertion in the commit above. Tested on iPad6 with iOS 14.4 and mobile Safari.

Since this problem is very rarely encountered in CT, I'm going to go ahead and close this issue. If for some reason it resurfaces, we can reopen.