Last Comment Bug 782338 - [B2G] Intermittent test_mobile_voice_state.js | Emulator callback still pending when finish() called
: [B2G] Intermittent test_mobile_voice_state.js | Emulator callback still pendi...
Status: RESOLVED FIXED
: intermittent-failure
Product: Core
Classification: Components
Component: DOM: Device Interfaces (show other bugs)
: Trunk
: All Gonk (Firefox OS)
: -- normal (vote)
: mozilla17
Assigned To: Vicamo Yang [:vicamo][:vyang]
:
Mentors:
Depends on:
Blocks: 438871 780558
  Show dependency treegraph
 
Reported: 2012-08-13 10:42 PDT by Jonathan Griffin (:jgriffin)
Modified: 2012-12-17 08:42 PST (History)
3 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
V1 (756 bytes, patch)
2012-08-14 20:39 PDT, Vicamo Yang [:vicamo][:vyang]
marshall: review+
philipp: review-
Details | Diff | Review
V2 (1.76 KB, patch)
2012-08-16 19:22 PDT, Vicamo Yang [:vicamo][:vyang]
philipp: review+
marshall: review+
Details | Diff | Review
V3 (1.66 KB, patch)
2012-08-19 20:01 PDT, Vicamo Yang [:vicamo][:vyang]
no flags Details | Diff | Review

Description Jonathan Griffin (:jgriffin) 2012-08-13 10:42:42 PDT
On the B2G CI, test_mobile_voice_state.js sometimes fails with the error:

test_mobile_voice_state.js
TEST-UNEXPECTED-FAIL | Traceback (most recent call last):
File "/data/jenkins/workspace/webapi-marionette-test/testing/marionette/client/marionette/marionette_test.py", line 176, in runTest
results = self.marionette.execute_js_script(js, args, special_powers=True)
File "/data/jenkins/workspace/webapi-marionette-test/testing/marionette/client/marionette/marionette.py", line 369, in execute_js_script
specialPowers=special_powers)
File "/data/jenkins/workspace/webapi-marionette-test/testing/marionette/client/marionette/marionette.py", line 171, in _send_message
self._handle_error(response)
File "/data/jenkins/workspace/webapi-marionette-test/testing/marionette/client/marionette/marionette.py", line 228, in _handle_error
raise MarionetteException(message=message, status=status, stacktrace=stacktrace)
MarionetteException: Emulator callback still pending when finish() called

Seems like a possible timing issue.
Comment 1 Vicamo Yang [:vicamo][:vyang] 2012-08-14 20:39:18 PDT
Created attachment 651984 [details] [diff] [review]
V1
Comment 2 Marshall Culpepper [:marshall_law] 2012-08-15 08:39:30 PDT
Comment on attachment 651984 [details] [diff] [review]
V1

Review of attachment 651984 [details] [diff] [review]:
-----------------------------------------------------------------

r+ since this will probably work -- but it feels a bit like a hack. See comments below.

::: dom/network/tests/marionette/test_mobile_voice_state.js
@@ +110,5 @@
>  function cleanUp() {
>    SpecialPowers.clearUserPref(WHITELIST_PREF);
> +
> +  // For 'Emulator callback still pending when finish() called'
> +  setTimeout(finish, 1000);

It would be better if we provided runEmulatorCmd a callback, and wait for that callback before moving on to the next test function (or in this case, cleanUp()). I currently do this in my voicemail tests here:

https://mxr.mozilla.org/mozilla-central/source/dom/telephony/test/marionette/test_voicemail_statuschanged.js#12
Comment 3 Philipp von Weitershausen [:philikon] 2012-08-15 09:12:50 PDT
Comment on attachment 651984 [details] [diff] [review]
V1

Review of attachment 651984 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/network/tests/marionette/test_mobile_voice_state.js
@@ +110,5 @@
>  function cleanUp() {
>    SpecialPowers.clearUserPref(WHITELIST_PREF);
> +
> +  // For 'Emulator callback still pending when finish() called'
> +  setTimeout(finish, 1000);

I agree with Marshall. I suggest something like this:

  let emulatorCmdPending = false;
  function setEmulatorVoiceState(state) {
    emulatorCmdPending = true;
    runEmulatorCmd("gsm voice " + state, function (result) {
      emulatorCmdPending = false;
      is(result[0], "OK");
    });
  }

and then do a tighter wait loop, e.g.:

  function cleanUp() {
    if (emulatorCmdPending) {
      setTimeout(cleanUp, 100);
      return;
    }
    SpecialPowers.clearUserPref(WHITELIST_PREF);
    finish();
  }
Comment 4 Vicamo Yang [:vicamo][:vyang] 2012-08-16 19:22:01 PDT
Created attachment 652652 [details] [diff] [review]
V2

* rebase to include changes made in bug 780558
* address review comment #2 and #3. Thank you both ;)
Comment 5 Marshall Culpepper [:marshall_law] 2012-08-17 10:13:07 PDT
Comment on attachment 652652 [details] [diff] [review]
V2

Review of attachment 652652 [details] [diff] [review]:
-----------------------------------------------------------------

Looks good
Comment 6 Vicamo Yang [:vicamo][:vyang] 2012-08-19 20:01:05 PDT
Created attachment 653245 [details] [diff] [review]
V3

rebase only
Comment 7 Vicamo Yang [:vicamo][:vyang] 2012-08-19 20:18:48 PDT
https://hg.mozilla.org/integration/mozilla-inbound/rev/785cd1cb9446
Comment 8 Ed Morley [:emorley] 2012-08-20 08:55:04 PDT
https://hg.mozilla.org/mozilla-central/rev/785cd1cb9446
Comment 9 Treeherder Robot 2012-12-17 08:42:39 PST
paul
https://tbpl.mozilla.org/php/getParsedLog.php?id=18019426&tree=Fx-Team
b2g_ics_armv7a_gecko_emulator fx-team opt test marionette-webapi on 2012-12-17 08:23:37
slave: talos-r3-fed-051

08:35:07    ERROR -  Traceback (most recent call last):
08:35:07     INFO -  TEST-UNEXPECTED-FAIL | test_filter_unread.js | EOFError: telnet connection closed
08:35:07    ERROR -  FAILED (errors=1)
08:35:07    ERROR -  Traceback (most recent call last):
08:35:07     INFO -  TEST-UNEXPECTED-FAIL | test_number_of_messages.js | error: [Errno 111] Connection refused
08:35:07    ERROR -  FAILED (errors=1)
08:35:07    ERROR -  Traceback (most recent call last):
08:35:07     INFO -  TEST-UNEXPECTED-FAIL | test_mark_msg_read.js | error: [Errno 111] Connection refused
08:35:07    ERROR -  FAILED (errors=1)
08:35:07    ERROR -  Traceback (most recent call last):
08:35:07     INFO -  TEST-UNEXPECTED-FAIL | test_mark_msg_read_error.js | error: [Errno 111] Connection refused
08:35:07    ERROR -  FAILED (errors=1)
08:35:07    ERROR -  Traceback (most recent call last):
08:35:07     INFO -  TEST-UNEXPECTED-FAIL | test_bug814761.js | error: [Errno 111] Connection refused
08:35:07    ERROR -  FAILED (errors=1)
08:35:07    ERROR -  Traceback (most recent call last):
08:35:07     INFO -  TEST-UNEXPECTED-FAIL | test_mobile_voice_state.js | error: [Errno 111] Connection refused
08:35:07    ERROR -  FAILED (errors=1)
08:35:07    ERROR -  Traceback (most recent call last):
08:35:07     INFO -  TEST-UNEXPECTED-FAIL | test_mobile_iccinfo.js | error: [Errno 111] Connection refused
Only displaying first 20 of 100+ failures -
.

Note You need to log in before you can comment on or make changes to this bug.