Closed Bug 1130678 Opened 10 years ago Closed 10 years ago

dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html intermittent with vsync refresh driver

Categories

(Core :: Graphics, defect)

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla38
Tracking Status
firefox38 --- fixed

People

(Reporter: mchang, Assigned: mchang)

References

Details

Attachments

(1 file)

From https://treeherder.mozilla.org/#/jobs?repo=try&revision=65c501042f81 b2g ics emulator opt, mochitest 2 is almost perma-orange with the vsync refresh driver. Find and fix the problem.
503 INFO TEST-UNEXPECTED-FAIL | dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html | SharedWorker has received the message - Result logged after SimpleTest.finish()
14:51:28 INFO - 502 INFO TEST-OK | dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html | took 1693ms 14:51:29 INFO - 503 INFO TEST-UNEXPECTED-FAIL | dom/broadcastchannel/tests/test_broadcastchannel_sharedWorker.html | SharedWorker has received the message - Result logged after SimpleTest.finish() 14:51:29 INFO - 504 INFO TEST-START | dom/broadcastchannel/tests/test_broadcastchannel_worker.html 14:51:31 INFO - 505 INFO TEST-PASS | dom/broadcastchannel/tests/test_broadcastchannel_worker.html | Worker is ready! 14:51:31 INFO - 506 INFO TEST-PASS | dom/broadcastchannel/tests/test_broadcastchannel_worker.html | The message matches! 14:51:32 INFO - 507 INFO TEST-PASS | dom/broadcastchannel/tests/test_broadcastchannel_worker.html | Worker is ready! 14:51:32 INFO - 508 INFO TEST-PASS | dom/broadcastchannel/tests/test_broadcastchannel_worker.html | The message matches!
Hi Andrea, I noticed you were the author of this test. Any thoughts on what we should be looking for in this test? Almost seems like there is something racy here with the workers. Thanks!
Flags: needinfo?(amarchesini)
I can't reproduce locally at all, I added a bunch of instrumentation and pushed to try: https://treeherder.mozilla.org/#/jobs?repo=try&revision=5e8b28c09a70
Attached patch bc.patchSplinter Review
https://treeherder.mozilla.org/#/jobs?repo=try&revision=93dc809b75e9 I had an idea why this happens. let me push it to try...
Flags: needinfo?(amarchesini)
From https://treeherder.mozilla.org/#/jobs?repo=try&revision=5e8b28c09a70 In the good case, it looks like the worker.port.onmessage executes before bc.onmessage executes. e.g. https://hg.mozilla.org/try/rev/c292d4af964a#l3.23 then https://hg.mozilla.org/try/rev/c292d4af964a#l3.33 With the vsync refresh driver, we get the inverse. The bc.onmessage executes before the worker.port.onmessage which finishes the test and fails. Log here - http://ftp.mozilla.org/pub/mozilla.org/b2g/try-builds/mchang@mozilla.com-5e8b28c09a70/try-emulator/try_ubuntu64_vm-b2g-emulator_test-mochitest-2-bm116-tests1-linux64-build1132.txt.gz
Hi Andreas, The shared worker posts a message on both the broadcast channel and the worker [1]. Since this is in JS, this occurs on the main thread on the content process. From there, do you know if both the broadcast channel and the worker have a guaranteed order to process the message or are they on separate threads? Thanks! [1] https://hg.mozilla.org/try/rev/c292d4af964a#l2.9
Flags: needinfo?(amarchesini)
> The shared worker posts a message on both the broadcast channel and the > worker [1]. Since this is in JS, this occurs on the main thread on the > content process. From there, do you know if both the broadcast channel and > the worker have a guaranteed order to process the message or are they on > separate threads? No garanteed order. This is the reason why I removed the second message (the worker.postMessage one). Does my patch fix the issue? It seems so.
Flags: needinfo?(amarchesini) → needinfo?(mchang)
Ahh thanks for the patch! The try from comment 6 didn't enable the vsync refresh driver, so I wasn't able to reproduce it on master. Here is a try push with your patch + vsync refresh driver https://treeherder.mozilla.org/#/jobs?repo=try&revision=7b510c38107a Thanks for the quick response!
Flags: needinfo?(mchang)
Comment on attachment 8560841 [details] [diff] [review] bc.patch Looks good!
Attachment #8560841 - Flags: feedback+
It seems green enough! I think we can land this simple fix.
Attachment #8560841 - Flags: review?(mchang)
Comment on attachment 8560841 [details] [diff] [review] bc.patch Review of attachment 8560841 [details] [diff] [review]: ----------------------------------------------------------------- ::: dom/broadcastchannel/tests/broadcastchannel_sharedWorker.js @@ +1,5 @@ > onconnect = function(evt) { > evt.ports[0].onmessage = function(evt) { > var bc = new BroadcastChannel('foobar'); > bc.addEventListener('message', function(event) { > + bc.postMessage(event.data == "hello world from the window" ? nit: delete space.
Attachment #8560841 - Flags: review?(mchang)
Attachment #8560841 - Flags: review+
Attachment #8560841 - Flags: feedback+
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: