Bug 1267930 - When the wasapi rendering loop is stuck and we're shuttin down, leak the thread and continue the shutdown process. r=kinetik
authorPaul Adenot <paul@paul.cx>
Thu, 28 Apr 2016 12:02:14 +0200
changeset 295203 8a9107830c844b4b8f811463ca6f9c30802d5acf
parent 295202 a29de45d453b042ec7638d08424d96564d1c4d74
child 295204 e3517606f9eeb49ec0d8925013ad26c0e81dff0b
push id75850
push userpaul@paul.cx
push dateThu, 28 Apr 2016 10:09:24 +0000
treeherdermozilla-inbound@8a9107830c84 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskinetik
bugs1267930
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1267930 - When the wasapi rendering loop is stuck and we're shuttin down, leak the thread and continue the shutdown process. r=kinetik It's probably better to not TerminateThread here, because we don't really know what happened down the stack of the rendering loop, so we just leak it. This happens during shutdown so it's not really an issue, it's going to be cleaned up by the OS anyways. MozReview-Commit-ID: 4o3Krj7L7m2
media/libcubeb/README_MOZILLA
media/libcubeb/src/cubeb_wasapi.cpp
--- a/media/libcubeb/README_MOZILLA
+++ b/media/libcubeb/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the cubeb 
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
 
-The git commit ID used was 05abb60b99a46d1d21abe58d9e5f3bdb4f0df4a8.
+The git commit ID used was 6194d5f4af9722e97084b5292a9f62a7f737a726.
--- a/media/libcubeb/src/cubeb_wasapi.cpp
+++ b/media/libcubeb/src/cubeb_wasapi.cpp
@@ -1155,17 +1155,25 @@ void stop_and_join_render_thread(cubeb_s
     return;
   }
 
   BOOL ok = SetEvent(stm->shutdown_event);
   if (!ok) {
     LOG("Destroy SetEvent failed: %d\n", GetLastError());
   }
 
-  DWORD r = WaitForSingleObject(stm->thread, INFINITE);
+  /* Wait five seconds for the rendering thread to return. It's supposed to
+   * check its event loop very often, five seconds is rather conservative. */
+  DWORD r = WaitForSingleObject(stm->thread, 5000);
+  if (r == WAIT_TIMEOUT) {
+    /* Something weird happened, leak the thread and continue the shutdown
+     * process. */
+    LOG("Destroy WaitForSingleObject on thread timed out,"
+        " leaking the thread: %d\n", GetLastError());
+  }
   if (r == WAIT_FAILED) {
     LOG("Destroy WaitForSingleObject on thread failed: %d\n", GetLastError());
   }
 
   CloseHandle(stm->thread);
   stm->thread = NULL;
 
   CloseHandle(stm->shutdown_event);