phetsims / vector-addition

“Vector Addition” is an educational simulation in HTML5, by PhET Interactive Simulations.
GNU General Public License v3.0
2 stars 5 forks source link

CT: InvalidStateError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D' #33

Closed veillette closed 5 years ago

veillette commented 5 years ago
vector-addition : fuzz : require.js-canvas : run
Query: brand=phet&ea&fuzz&rootRenderer=canvas&memoryLimit=1000
Uncaught InvalidStateError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
Error: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
    at CanvasBlock.walkDown (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/CanvasBlock.js?bust=1560758422617:273:33)
    at CanvasBlock.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/CanvasBlock.js?bust=1560758422617:176:14)
    at BackboneDrawable.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/BackboneDrawable.js?bust=1560758422617:258:35)
    at DOMBlock.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/DOMBlock.js?bust=1560758422617:57:24)
    at BackboneDrawable.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/BackboneDrawable.js?bust=1560758422617:258:35)
    at Display.updateDisplay (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/Display.js?bust=1560758422617:457:26)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/joist/js/Sim.js?bust=1560758422617:234:20
    at Action.execute (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/axon/js/Action.js?bust=1560758422617:177:20)
    at Sim.stepSimulation (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/joist/js/Sim.js?bust=1560758422617:934:33)
    at Sim.stepOneFrame (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/joist/js/Sim.js?bust=1560758422617:915:14)
id: Bayes Chrome
Approximately 6/17/2019, 12:32:58 AM

vector-addition : fuzz : require.js-canvas : run
Query: brand=phet&ea&fuzz&rootRenderer=canvas&memoryLimit=1000
Uncaught InvalidStateError: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
Error: Failed to execute 'drawImage' on 'CanvasRenderingContext2D': The image argument is a canvas element with a width or height of 0.
    at CanvasBlock.walkDown (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/CanvasBlock.js?bust=1560781009023:273:33)
    at CanvasBlock.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/CanvasBlock.js?bust=1560781009023:176:14)
    at BackboneDrawable.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/BackboneDrawable.js?bust=1560781009023:258:35)
    at DOMBlock.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/DOMBlock.js?bust=1560781009023:57:24)
    at BackboneDrawable.update (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/BackboneDrawable.js?bust=1560781009023:258:35)
    at Display.updateDisplay (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/Display.js?bust=1560781009023:457:26)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/joist/js/Sim.js?bust=1560781009023:234:20
    at Action.execute (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/axon/js/Action.js?bust=1560781009023:177:20)
    at Sim.stepSimulation (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/joist/js/Sim.js?bust=1560781009023:934:33)
    at Sim.stepOneFrame (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/joist/js/Sim.js?bust=1560781009023:915:14)
id: Bayes Chrome
Approximately 6/17/2019, 12:32:58 AM

vector-addition : fuzz : require.js-canvas : run
Query: brand=phet&ea&fuzz&rootRenderer=canvas&memoryLimit=1000
Uncaught Error: Assertion failed: This should not be run in the call tree of updateDisplay(). If you see this, it is likely that either the last updateDisplay() had a thrown error and it is trying to be run again (in which case, investigate that error), OR code was run/triggered from inside an updateDisplay() that has the potential to cause an infinite loop, e.g. CanvasNode paintCanvas() call manipulating another Node, or a bounds listener that Scenery missed.
Error: Assertion failed: This should not be run in the call tree of updateDisplay(). If you see this, it is likely that either the last updateDisplay() had a thrown error and it is trying to be run again (in which case, investigate that error), OR code was run/triggered from inside an updateDisplay() that has the potential to cause an infinite loop, e.g. CanvasNode paintCanvas() call manipulating another Node, or a bounds listener that Scenery missed.
    at window.assertions.assertFunction (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/assert/js/assert.js:22:13)
    at Display.ensureNotPainting (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/Display.js?bust=1560781009023:1110:17)
    at CanvasBlock.markDirtyDrawable (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/CanvasBlock.js?bust=1560781009023:402:22)
    at PathCanvasDrawable.markDirty (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/Drawable.js?bust=1560781009023:302:31)
    at PathCanvasDrawable.markPaintDirty (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/CanvasSelfDrawable.js?bust=1560781009023:52:12)
    at PathCanvasDrawable.proto.markDirtyFill (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/display/drawables/PaintableStatelessDrawable.js?bust=1560781009023:45:14)
    at FontAwesomeNode.invalidateFill (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/nodes/Paintable.js?bust=1560781009023:911:32)
    at FontAwesomeNode.setFill (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/nodes/Paintable.js?bust=1560781009023:132:18)
    at FontAwesomeNode.set fill [as fill] (https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/scenery/js/nodes/Paintable.js?bust=1560781009023:136:34)
    at https://bayes.colorado.edu/continuous-testing/snapshot-1560745978916/joist/js/HomeButton.js?bust=1560781009023:72:23
id: Bayes Chrome
Approximately 6/17/2019, 12:32:58 AM
veillette commented 5 years ago

We have not hit this assertion again. Closing

brandonLi8 commented 5 years ago

We are still getting this. It only happens around 50% of the time. Unable to reproduce.

veillette commented 5 years ago

I have not been able to reproduce on my machine either even after 20 minutes of fuzzing.

veillette commented 5 years ago

My hypothesis is that to do with a slow machine while in the process of launching the simulation and some of the bounds of the scenery elements are not set yet.

pixelzoom commented 5 years ago

In #66, @brandonLi8 said:

@pixelzoom, I was hoping that you could give me advice to solving number #33. I have been getting this for weeks, but it seems strange that It only picks up about 30% of the time on CT. I have been unable to reproduce even after 25+ minutes of fuzzing, and I have been trying for weeks.

I'll have a look. Self assigning.

pixelzoom commented 5 years ago

I had a look, then @brandonLi8 and I discussed this issue on Slack:

Chris Malley [2:49 PM] I’m looking at https://github.com/phetsims/vector-addition/issues/33. The only occurrence of ‘canvas’ that I see is renderer: 'canvas' in GraphNode for the sphere at the origin. Why is it necessary to use renderer: 'canvas' for this? And are there other uses of Canvas?

Brandon Li [2:50 PM] Not sure why I put that there. I don’t even know what canvas is.

Chris Malley [2:52 PM] Canvas is an API for drawing graphics via Javascript. When a scenery Node is set to renderer: 'canvas', it uses the Canvas API to do its rendering. The other values for renderer are ‘svg’, ‘dom’, and ‘webgl’, which are all different rendering APIs. You typically don’t set renderer unless you have performance (or bug) requirements that necessitate using a specific rendering API.

Brandon Li [2:54 PM] Hmm, yea I’ll remove it.

Chris Malley [2:54 PM] Yep, that’s the next thing I was going to say ;)

Brandon Li [2:56 PM] Hopefully that’ll do it.

Chris Malley [2:56 PM] I’m skeptical that was causing the problem (thought it might). I don’t see anything in the stack trace that is specific to Vector Addition.

Brandon Li [2:56 PM] Ya and no one can reproduce it.

Chris Malley [2:56 PM] If it continues to occur, comment in the issue that you need Jonathan to take a look, and assign it to Ariel.

pixelzoom commented 5 years ago

Chris Malley [3:01 PM] Ah… I see in the CT output that the query parameters were brand=phet&ea&fuzz&rootRenderer=canvas&memoryLimit=1000. So I believe this means that it’s running a test using Canvas as the default renderer. I don’t know why that’s done by CT.

Brandon Li [3:02 PM] Even when I tried those exact query parameters and fuzzed for 25 minutes, I was not able to reproduce.

Chris Malley [3:03 PM] interesting.

pixelzoom commented 5 years ago

I also tried running locally in requirejs mode with brand=phet&ea&fuzz&rootRenderer=canvas&memoryLimit=1000 and cannot reproduce.

pixelzoom commented 5 years ago

Chris Malley [3:03 PM] Question, anyone feel free to jump in. In https://github.com/phetsims/vector-addition/issues/33, Vector Addition does not use Canvas, but is experiencing a Canvas failure with CT query parameters brand=phet&ea&fuzz&rootRenderer=canvas&memoryLimit=1000. What is the purpose of the rootRenderer=canvas test? And how can we track this down? (edited)

Jonathan Olson [3:05 PM] It mimics how we used to force Canvas rendering for Edge (which we now do not do, IIRC)

Chris Malley [3:05 PM] So (1) should this test be removed from CT? and if not (2) how can we track this down?

pixelzoom commented 5 years ago

There doesn't appear to be anything that I can assist with here (nothing sim-specific). So I'm assigning to @jonathanolson to continue the conversation started in Slack and documented in https://github.com/phetsims/vector-addition/issues/33#issuecomment-511571941.

brandonLi8 commented 5 years ago

Looks like we finally are clear. Will re open if this pops up again.

pixelzoom commented 5 years ago

OK to close this issue. But there's still the general question of why the rootRenderer=canvas test is being run for every sim if (according to @jonathanolson) we no longer force Canvas rendering on Edge. I've moved that question to https://github.com/phetsims/aqua/issues/75.