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: scale should be finite #321

Closed
pixelzoom opened this issue Feb 20, 2022 · 16 comments
Closed

CT: Assertion failed: scale should be finite #321

pixelzoom opened this issue Feb 20, 2022 · 16 comments

Comments

@pixelzoom
Copy link
Contributor

pixelzoom commented Feb 20, 2022

The first time that this occurred in CT was Saturday 2/19/2022 @ 3:31:37 AM. I hadn't touched the code since Thu 2/18/2022 @ 8:57PM. So I'm wondering if this is a common-code regression.

geometric-optics : pan-and-zoom-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/geometric-optics/geometric-optics_en.html?continuousTest=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22pan-and-zoom-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1645266697421%22%2C%22timestamp%22%3A1645300547953%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: scales should be finite
Error: Assertion failed: scales should be finite
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/assert/js/assert.js:25:13)
at Node.scale (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/scenery/js/nodes/Node.js:2120:17)
at updateScaleAndPosition (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/geometric-optics/js/common/view/FramedImageNode.js:64:18)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/geometric-optics/js/common/view/FramedImageNode.js:69:43
at TinyProperty.emit (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/axon/js/TinyEmitter.js:69:9)
at DerivedProperty._notifyListeners (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/axon/js/Property.js:228:23)
at DerivedProperty.set (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/axon/js/Property.js:159:14)
at DerivedProperty.getDerivedPropertyListener (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/axon/js/DerivedProperty.js:98:13)
at TinyProperty.emit (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/axon/js/TinyEmitter.js:69:9)
at DerivedProperty._notifyListeners (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1645266697421/chipper/dist/js/axon/js/Property.js:228:23)
id: Bayes Chrome
Snapshot from 2/19/2022, 3:31:37 AM
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Feb 20, 2022

Not immediately reproducible after 5 minutes running unbuilt with
?brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=true.

Manually mapping the FramedImageNode.js assertion to FramedImageNode.ts, it's failing at line 88:

      const scaleX = ( viewBounds.width / initialWidth ) || GOConstants.MIN_SCALE; // prevent zero scale
      const scaleY = ( viewBounds.height / initialHeight ) || GOConstants.MIN_SCALE; // prevent zero scale
88    parentNode.scale( scaleX, scaleY );

Node.js is failing at line 2120:

  // eslint-disable-line
  scale(x, y, prependInstead) {
    // eslint-disable-line
    if (typeof x === 'number') {
2120      assert && assert(isFinite(x), 'scales should be finite');

... which maps to Node.ts line 2285:

  scale( s: number, prependInstead?: boolean ): void;
  scale( s: Vector2, prependInstead?: boolean ): void; // eslint-disable-line
  scale( x: number, y: number, prependInstead?: boolean ): void; // eslint-disable-line
  scale( x: number | Vector2, y?: number | boolean, prependInstead?: boolean ) { // eslint-disable-line
    if ( typeof x === 'number' ) {
2285      assert && assert( isFinite( x ), 'scales should be finite' );

@pixelzoom
Copy link
Contributor Author

This has not occurred in the 4 most-recent CT cycles. It has not occurred since 2/20/2022 @ 1:30:34 AM. And CT seems to have restarted, so I can't tell how many times it occurred since the first occurrence on 2/19/2022 @ 3:31:37. So before spending more time on this, I'm going to wait to see if it reoccurs, or was perhaps some transient common-code issue.

@pixelzoom
Copy link
Contributor Author

Still nothing in CT, so closing.

@pixelzoom
Copy link
Contributor Author

pixelzoom commented Mar 1, 2022

Reopening. This occurred once:

geometric-optics : multitouch-fuzz : unbuilt
https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/geometric-optics/geometric-optics_en.html?continuousTest=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22multitouch-fuzz%22%2C%22unbuilt%22%5D%2C%22snapshotName%22%3A%22snapshot-1646128908517%22%2C%22timestamp%22%3A1646131689502%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: scales should be finite
Error: Assertion failed: scales should be finite
at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/assert/js/assert.js:25:13)
at Node.scale (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/scenery/js/nodes/Node.js:2120:17)
at updateScaleAndPosition (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/geometric-optics/js/common/view/FramedImageNode.js:62:18)
at https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/geometric-optics/js/common/view/FramedImageNode.js:67:43
at TinyProperty.emit (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/axon/js/TinyEmitter.js:69:9)
at DerivedProperty._notifyListeners (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/axon/js/Property.js:228:23)
at DerivedProperty.set (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/axon/js/Property.js:159:14)
at DerivedProperty.getDerivedPropertyListener (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/axon/js/DerivedProperty.js:98:13)
at TinyProperty.emit (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/axon/js/TinyEmitter.js:69:9)
at DerivedProperty._notifyListeners (https://bayes.colorado.edu/continuous-testing/ct-snapshots/1646128908517/chipper/dist/js/axon/js/Property.js:228:23)
id: Bayes Chrome
Snapshot from 3/1/2022, 3:01:48 AM

Manually mapping from .js to .ts, this is occurring on line 87 of FramedImageNode.ts:

      const initialWidth = parentNode.width;
      const initialHeight = parentNode.height;
      const scaleX = ( viewBounds.width / initialWidth ) || GOConstants.MIN_SCALE; // prevent zero scale
      const scaleY = ( viewBounds.height / initialHeight ) || GOConstants.MIN_SCALE; // prevent zero scale
87   parentNode.scale( scaleX, scaleY );

@pixelzoom pixelzoom reopened this Mar 1, 2022
pixelzoom added a commit that referenced this issue Mar 2, 2022
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Mar 2, 2022

I suspect that parentNode has zero bounds because the Image node that it wraps does not have valid bounds -- for some reason. In the above commit, I've added assertions with messages that will help me (dis)prove this theory.

EDIT: I've tried to reproduce this locally with
?brand=phet&ea&fuzz&fuzzPointers=2&memoryLimit=1000&supportsPanAndZoom=false
... but no luck. So I guess I'll have to wait until CT hits it.

pixelzoom added a commit that referenced this issue Mar 2, 2022
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Mar 11, 2022

I haven't seen this failure since 3/1/2022.
(Sometimes saying that out loud will make it happen :)

@pixelzoom
Copy link
Contributor Author

I fuzzed tested the unbuilt sim for 30 minutes and did not encounter this problem.
URL: geometric-optics_en.html?brand=phet&ea&debugger&fuzz

@pixelzoom pixelzoom removed their assignment Mar 17, 2022
@pixelzoom
Copy link
Contributor Author

This is a non-blocking error. It won't cause the sim to crash, and is unlikely to result in any noticeable problems in practice. 1.1 was published with this as a known issue.

@KatieWoe
Copy link

KatieWoe commented Sep 9, 2022

Can you confirm if this issue is still needed? I don't see it in CT right now, but it is noted as rare. For phetsims/qa#832

@pixelzoom
Copy link
Contributor Author

Yes, please keep this open.

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

It is not necessary to address this for #278, the 1.3 PhET-iO release.

@pixelzoom
Copy link
Contributor Author

Still occurring occassionally, last seen 5/4/23 @ 10:56AM.

@pixelzoom
Copy link
Contributor Author

Still occurring occassionally, last seen 9/25/2023, 11:16:26 PM. I still cannot reproduce locally.

geometric-optics : fuzz : unbuilt : listenerOrderRandom
http://128.138.93.172/continuous-testing/ct-snapshots/1695705386589/geometric-optics/geometric-optics_en.html?continuousTest=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22listenerOrderRandom%22%5D%2C%22snapshotName%22%3A%22snapshot-1695705386589%22%2C%22timestamp%22%3A1695706354264%7D&brand=phet&ea&fuzz&listenerOrder=random
Query: brand=phet&ea&fuzz&listenerOrder=random
Uncaught Error: Assertion failed: scale should be finite: scaleX=Infinity, initialWidth=0 viewBounds.width=241012948808499200scaleY=2111062325329920.8, initialHeight=0 viewBounds.height=241012948808499200
Error: Assertion failed: scale should be finite: scaleX=Infinity, initialWidth=0 viewBounds.width=241012948808499200scaleY=2111062325329920.8, initialHeight=0 viewBounds.height=241012948808499200
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1695705386589/assert/js/assert.js:28:13)
at assert (FramedImageNode.ts:66:16)
at updateScaleAndPosition (FramedImageNode.ts:75:43)
at listener (TinyEmitter.ts:123:8)
at emit (ReadOnlyProperty.ts:315:22)
at _notifyListeners (ReadOnlyProperty.ts:262:13)
at unguardedSet (ReadOnlyProperty.ts:246:11)
at set (DerivedProperty.ts:157:12)
at listener (TinyEmitter.ts:123:8)
at emit (ReadOnlyProperty.ts:315:22)
[URL] http://128.138.93.172/continuous-testing/aqua/html/sim-test.html?url=..%2F..%2Fct-snapshots%2F1695705386589%2Fgeometric-optics%2Fgeometric-optics_en.html&simQueryParameters=brand%3Dphet%26ea%26fuzz%26listenerOrder%3Drandom&testInfo=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22listenerOrderRandom%22%5D%2C%22snapshotName%22%3A%22snapshot-1695705386589%22%2C%22timestamp%22%3A1695706354264%7D
[NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/sim-test.html?url=..%2F..%2Fct-snapshots%2F1695705386589%2Fgeometric-optics%2Fgeometric-optics_en.html&simQueryParameters=brand%3Dphet%26ea%26fuzz%26listenerOrder%3Drandom&testInfo=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22listenerOrderRandom%22%5D%2C%22snapshotName%22%3A%22snapshot-1695705386589%22%2C%22timestamp%22%3A1695706354264%7D
...
id: "Sparky Node Puppeteer"
Snapshot from 9/25/2023, 11:16:26 PM

pixelzoom added a commit that referenced this issue Sep 26, 2023
@pixelzoom pixelzoom changed the title CT: Assertion failed: scales should be finite CT: Assertion failed: scale should be finite Sep 26, 2023
@pixelzoom
Copy link
Contributor Author

pixelzoom commented Dec 27, 2023

After addressing #487, this is occurring again in CT, see below.

The problem is that initialWidth=0 and initialHeight=0, which results in divide-by-zero.

geometric-optics : fuzz : unbuilt : listenerOrderRandom
http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/geometric-optics/geometric-optics_en.html?continuousTest=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22listenerOrderRandom%22%5D%2C%22snapshotName%22%3A%22snapshot-1703715702864%22%2C%22timestamp%22%3A1703716268833%7D&brand=phet&ea&fuzz&listenerOrder=random
Query: brand=phet&ea&fuzz&listenerOrder=random
Uncaught Error: Assertion failed: scale should be finite: scaleX=Infinity, initialWidth=0 viewBounds.width=241012948808499200 scaleY=2849934139195391.5, initialHeight=0 viewBounds.height=241012948808499200
Error: Assertion failed: scale should be finite: scaleX=Infinity, initialWidth=0 viewBounds.width=241012948808499200 scaleY=2849934139195391.5, initialHeight=0 viewBounds.height=241012948808499200
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/assert/js/assert.js:28:13)
at assert (FramedImageNode.ts:66:16)
at updateScaleAndPosition (FramedImageNode.ts:75:43)
at listener (TinyEmitter.ts:123:8)
at emit (ReadOnlyProperty.ts:329:22)
at _notifyListeners (ReadOnlyProperty.ts:276:13)
at unguardedSet (ReadOnlyProperty.ts:260:11)
at set (DerivedProperty.ts:174:12)
at listener (TinyEmitter.ts:123:8)
at emit (ReadOnlyProperty.ts:329:22)
[URL] http://128.138.93.172/continuous-testing/aqua/html/sim-test.html?url=..%2F..%2Fct-snapshots%2F1703715702864%2Fgeometric-optics%2Fgeometric-optics_en.html&simQueryParameters=brand%3Dphet%26ea%26fuzz%26listenerOrder%3Drandom&testInfo=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22listenerOrderRandom%22%5D%2C%22snapshotName%22%3A%22snapshot-1703715702864%22%2C%22timestamp%22%3A1703716268833%7D
[NAVIGATED] http://128.138.93.172/continuous-testing/aqua/html/sim-test.html?url=..%2F..%2Fct-snapshots%2F1703715702864%2Fgeometric-optics%2Fgeometric-optics_en.html&simQueryParameters=brand%3Dphet%26ea%26fuzz%26listenerOrder%3Drandom&testInfo=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22listenerOrderRandom%22%5D%2C%22snapshotName%22%3A%22snapshot-1703715702864%22%2C%22timestamp%22%3A1703716268833%7D
[NAVIGATED] about:blank
[NAVIGATED] http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/geometric-optics/geometric-optics_en.html?continuousTest=%7B%22test%22%3A%5B%22geometric-optics%22%2C%22fuzz%22%2C%22unbuilt%22%2C%22listenerOrderRandom%22%5D%2C%22snapshotName%22%3A%22snapshot-1703715702864%22%2C%22timestamp%22%3A1703716268833%7D&brand=phet&ea&fuzz&listenerOrder=random
[CONSOLE] enabling assert
[CONSOLE] listenerOrder random seed: 829371
[CONSOLE] continuous-test-load
[CONSOLE] Assertion failed: scale should be finite: scaleX=Infinity, initialWidth=0 viewBounds.width=241012948808499200 scaleY=2849934139195391.5, initialHeight=0 viewBounds.height=241012948808499200
[PAGE ERROR] Error: Error: Assertion failed: scale should be finite: scaleX=Infinity, initialWidth=0 viewBounds.width=241012948808499200 scaleY=2849934139195391.5, initialHeight=0 viewBounds.height=241012948808499200
at window.assertions.assertFunction (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/assert/js/assert.js:28:13)
at updateScaleAndPosition (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/geometric-optics/js/common/view/FramedImageNode.js:45:17)
at http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/geometric-optics/js/common/view/FramedImageNode.js:49:43
at TinyProperty.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/axon/js/TinyEmitter.js:96:9)
at DerivedProperty._notifyListeners (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/axon/js/ReadOnlyProperty.js:250:23)
at DerivedProperty.unguardedSet (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/axon/js/ReadOnlyProperty.js:199:14)
at DerivedProperty.set (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/axon/js/ReadOnlyProperty.js:184:12)
at DerivedProperty.getDerivedPropertyListener (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/axon/js/DerivedProperty.js:119:13)
at TinyProperty.emit (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/axon/js/TinyEmitter.js:96:9)
at DerivedProperty._notifyListeners (http://128.138.93.172/continuous-testing/ct-snapshots/1703715702864/chipper/dist/js/axon/js/ReadOnlyProperty.js:250:23)
[CONSOLE] continuous-test-error

id: "Sparky Node Puppeteer"
Snapshot from 12/27/2023, 3:21:42 PM

pixelzoom added a commit that referenced this issue Dec 27, 2023
@pixelzoom
Copy link
Contributor Author

Addressed in the above commit by testing for both zero and non-finite scale. I'll leave this open for a few cycles to verify that CT is happy.

@pixelzoom
Copy link
Contributor Author

CT is happy. Closing.

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

2 participants