phetsims / vibe

Library for handling audio for PhET simulations. Provides cross-platform support and enables usage of base64 audio embedded in an HTML document.
MIT License
3 stars 3 forks source link

Automated testing error #20

Closed jonathanolson closed 8 years ago

jonathanolson commented 9 years ago

In Chrome/Win7:

TypeError: Failed to set the 'buffer' property on 'AudioBufferSourceNode': The provided value is not of type 'AudioBuffer'.
    at TypeError (native)
    at e.play (http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:469:10565)
    at n.listener (http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:469:24187)
    at http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:464:2840
    at Array.forEach (native)
    at e.r.fire (http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:464:2820)
    at http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:464:2247
    at Array.i (http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:455:8232)
    at i._notifyObservers (http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:455:7124)
    at i._setAndNotifyObservers (http://192.168.0.2:8080/vibe/build/vibe_en.html?ea&postMessageOnLoad&postMessageOnError&fuzzMouse=100:455:6945)
pixelzoom commented 9 years ago

@jonathanolson Details? Is this a build or runtime error? With which sim(s)?

jonathanolson commented 9 years ago

The built 'vibe' runnable, with URL /vibe/build/vibe_en.html. Might be tricky to reproduce OR fixed, as I haven't seen this the last few times.

pixelzoom commented 8 years ago

Still failing, Mac OS 10.10.5 + Chrome. This is failing in some sims too (e.g. Ohm's Law), so it's a little concerning. Poking @jbphet.

jbphet commented 8 years ago

I just ran the RequireJS version on both Chrome+OSX 10.9.5 and Chrome+Win 7 with fuzzMouse=100 and the failure did not occur, so it may be specific to the built version. I did notice that after roughly ~1/2 hr of the fuzz testing the demo sim would crash with Chrome's "Aw snap..." message, so I should profile and make sure that this isn't leaking memory.

pixelzoom commented 8 years ago

As @jonathanolson said in https://github.com/phetsims/vibe/issues/20#issuecomment-152377434, it's the built version.

jbphet commented 8 years ago

Yes, I know, I was just noting that it does not appear to be reproducible on the RequireJS version, and I wanted to record that there may be an issue with leaking memory.

jbphet commented 8 years ago

This issue is due to a race condition where the loading of the audio has not completed by the time the fuzz test starts pressing buttons. It only happens right after startup if it happens at all, so running the fuzz test for a long period doesn't help to reproduce it. I've added an if clause that skips playback if the audio data is not finished loading. I verified this solution by loading the built version a number of times with some additional console logging in place, and could see the instances when the data hadn't yet loaded. This would occur roughly 1 out of 8 loads on a MacBook Air OSX 10.9.5 ("Jordan"). It was less frequent on Win7, but would happen occasionally.

The debug code is now removed, and the automated testing has been run several times for both vibe and ohms-law, and no failures were observed.

jbphet commented 8 years ago

Assigning to @pixelzoom to verify.