New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 684680 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Mac
Pri: 3
Type: Bug



Sign in to add a comment

Video capture device thread: "Function marked as IO-only was called from a thread that disallows IO!"

Project Member Reported by mcasas@chromium.org, Jan 24 2017

Issue description

I've seen this a few times:
https://bugs.chromium.org/p/chromium/issues/attachmentText?aid=268131

This task runner comes from audio manager:
https://cs.chromium.org/chromium/src/content/browser/renderer_host/media/media_stream_manager.cc?sq=package:chromium&dr=C&rcl=1485260312&l=1234


[3585:775:0124/033044.157634:FATAL:thread_restrictions.cc(38)] Check failed: false. Function marked as IO-only was called from a thread that disallows IO!  If this thread really should be allowed to make IO calls, adjust the call to base::ThreadRestrictions::SetIOAllowed() in this thread's startup.
0   Chromium Framework                  0x0000000110cd7dce _ZN4base5debug10StackTraceC2Ev + 30
1   Chromium Framework                  0x0000000110cd7e45 _ZN4base5debug10StackTraceC1Ev + 21
2   Chromium Framework                  0x0000000110d5fd30 _ZN7logging10LogMessageD2Ev + 80
3   Chromium Framework                  0x0000000110d5d895 _ZN7logging10LogMessageD1Ev + 21
4   Chromium Framework                  0x0000000110f7ed08 _ZN4base18ThreadRestrictions15AssertIOAllowedEv + 168
5   Chromium Framework                  0x0000000110f4f7db _ZN4base14PlatformThread4JoinENS_20PlatformThreadHandleE + 59
6   Chromium Framework                  0x0000000110f6e51c _ZN4base6Thread4StopEv + 348
7   Chromium Framework                  0x000000010da35558 _ZN7content20DesktopCaptureDevice17StopAndDeAllocateEv + 280
8   Chromium Framework                  0x000000010d391d70 _ZN7content19VideoCaptureManager26DoStopDeviceOnDeviceThreadENSt3__110unique_ptrIN5media18VideoCaptureDeviceENS1_14default_deleteIS4_EEEE + 320
9   Chromium Framework                  0x000000010d3adc48 _ZN4base8internal13FunctorTraitsIMN7content19VideoCaptureManagerEFvNSt3__110unique_ptrIN5media18VideoCaptureDeviceENS4_14default_deleteIS7_EEEEEvE6InvokeIRK13scoped_refptrIS3_EJSA_EEEvSC_OT_DpOT0_ + 536
10  Chromium Framework                  0x000000010d3ad99f _ZN4base8internal12InvokeHelperILb0EvE8MakeItSoIRKMN7content19VideoCaptureManagerEFvNSt3__110unique_ptrIN5media18VideoCaptureDeviceENS6_14default_deleteIS9_EEEEEJRK13scoped_refptrIS5_ESC_EEEvOT_DpOT0_ + 95
11  Chromium Framework                  0x000000010d3ad860 _ZN4base8internal7InvokerINS0_9BindStateIMN7content19VideoCaptureManagerEFvNSt3__110unique_ptrIN5media18VideoCaptureDeviceENS5_14default_deleteIS8_EEEEEJ13scoped_refptrIS4_ENS0_13PassedWrapperISB_EEEEEFvvEE7RunImplIRKSD_RKNS5_5tupleIJSF_SH_EEEJLm0ELm1EEEEvOT_OT0_NS_13IndexSequenceIJXspT1_EEEE + 160
12  Chromium Framework                  0x000000010d3ad74c _ZN4base8internal7InvokerINS0_9BindStateIMN7content19VideoCaptureManagerEFvNSt3__110unique_ptrIN5media18VideoCaptureDeviceENS5_14default_deleteIS8_EEEEEJ13scoped_refptrIS4_ENS0_13PassedWrapperISB_EEEEEFvvEE3RunEPNS0_13BindStateBaseE + 44
13  Chromium Framework                  0x000000010ca0953a _ZNO4base8internal8RunMixinINS_8CallbackIFvvELNS0_8CopyModeE0ELNS0_10RepeatModeE0EEEE3RunEv + 90
14  Chromium Framework                  0x0000000110cd95ea _ZN4base5debug13TaskAnnotator7RunTaskEPKcPNS_11PendingTaskE + 714
15  Chromium Framework                  0x0000000110dacf0b _ZN4base11MessageLoop7RunTaskEPNS_11PendingTaskE + 923
16  Chromium Framework                  0x0000000110dad484 _ZN4base11MessageLoop21DeferOrRunPendingTaskENS_11PendingTaskE + 68
17  Chromium Framework                  0x0000000110dadebd _ZN4base11MessageLoop6DoWorkEv + 669
18  Chromium Framework                  0x0000000110dc3c88 _ZN4base24MessagePumpCFRunLoopBase7RunWorkEv + 104
19  Chromium Framework                  0x0000000110dc3c0c ___ZN4base24MessagePumpCFRunLoopBase13RunWorkSourceEPv_block_invoke + 28
20  Chromium Framework                  0x0000000110d63aca _ZN4base3mac15CallWithEHFrameEU13block_pointerFvvE + 10
21  Chromium Framework                  0x0000000110dc31f5 _ZN4base24MessagePumpCFRunLoopBase13RunWorkSourceEPv + 101
22  CoreFoundation                      0x00007fff80848981 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
23  CoreFoundation                      0x00007fff80829a7d __CFRunLoopDoSources0 + 557
24  CoreFoundation                      0x00007fff80828f76 __CFRunLoopRun + 934
25  CoreFoundation                      0x00007fff80828974 CFRunLoopRunSpecific + 420
26  HIToolbox                           0x00007fff7fdb4acc RunCurrentEventLoopInMode + 240
27  HIToolbox                           0x00007fff7fdb4901 ReceiveNextEventCommon + 432
28  HIToolbox                           0x00007fff7fdb4736 _BlockUntilNextEventMatchingListInModeWithFilter + 71
29  AppKit                              0x00007fff7e35aae4 _DPSNextEvent + 1120
30  AppKit                              0x00007fff7ead521f -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 2789
31  Chromium Framework                  0x000000010f57cfea __71-[BrowserCrApplication nextEventMatchingMask:untilDate:inMode:dequeue:]_block_invoke + 106
32  Chromium Framework                  0x0000000110d63aca _ZN4base3mac15CallWithEHFrameEU13block_pointerFvvE + 10
33  Chromium Framework                  0x000000010f57ce88 -[BrowserCrApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 248
34  AppKit                              0x00007fff7e34f465 -[NSApplication run] + 926
35  Chromium Framework                  0x0000000110dc49e2 _ZN4base24MessagePumpNSApplication5DoRunEPNS_11MessagePump8DelegateE + 306
36  Chromium Framework                  0x0000000110dc39da _ZN4base24MessagePumpCFRunLoopBase3RunEPNS_11MessagePump8DelegateE + 122
37  Chromium Framework                  0x0000000110dac995 _ZN4base11MessageLoop10RunHandlerEv + 645
38  Chromium Framework                  0x0000000110e83ea3 _ZN4base7RunLoop3RunEv + 307
39  Chromium Framework                  0x000000010f58f100 _ZN22ChromeBrowserMainParts18MainMessageLoopRunEPi + 400
40  Chromium Framework                  0x000000010c6ec315 _ZN7content15BrowserMainLoop23RunMainMessageLoopPartsEv + 453
41  Chromium Framework                  0x000000010c6fb0b1 _ZN7content21BrowserMainRunnerImpl3RunEv + 481
42  Chromium Framework                  0x000000010c6dd065 _ZN7content11BrowserMainERKNS_18MainFunctionParamsE + 421
43  Chromium Framework                  0x000000010f3f47c7 _ZN7content23RunNamedProcessTypeMainERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERKNS_18MainFunctionParamsEPNS_19ContentMainDelegateE + 599
44  Chromium Framework                  0x000000010f3f66b6 _ZN7content21ContentMainRunnerImpl3RunEv + 1462
45  Chromium Framework                  0x000000010f3f402d _ZN7content11ContentMainERKNS_17ContentMainParamsE + 349
46  Chromium Framework                  0x000000010a034b47 ChromeMain + 135
47  Chromium                            0x0000000105421d9c main + 780
48  libdyld.dylib                       0x00007fff95d81255 start + 1


 

Comment 1 by mcasas@chromium.org, Jan 24 2017

chfremer@ you've been working on this area of late,
can you take a look and see if this is a legit error?
Thanks!

Comment 2 by mcasas@chromium.org, Jan 24 2017

Components: Blink>GetUserMedia

Comment 3 by guidou@chromium.org, Jan 25 2017

Owner: chfremer@chromium.org
Status: Assigned (was: Unconfirmed)
Owner: dalecur...@chromium.org
Is this new or has this happened for a long time?
According to git blame of [1], it seems DesktopCaptureDevice has been calling base::Thread::Stop() since mid 2014, and therefore requiring IOAllowed, so no recent change there.

I am also not aware of any change in the fact that we are using the task runner from the audio manager for operating the video capture devices (on non-Windows platforms).

dalecurtis@, I see you have recently done some cleanup [2] on the AudioDeviceThread. Was there any change to which thread is being used or whether or not they set SetIOAllowed()?

[1] https://cs.chromium.org/chromium/src/content/browser/media/capture/desktop_capture_device.cc?dr=CSs&rcl=1485447450&l=437
[2] https://chromium.googlesource.com/chromium/src/+/d8cd11c786e0173afcc7031d85aa3cec75376b6c%5E%21/content/browser/audio_manager_thread.cc
Owner: chfremer@chromium.org
On OSX the UI thread is the audio thread. I don't think anything has changed, this seems like it's just missing an exception if it was always done.
Hmm, it does not feel right to block the UI thread (actually it does not feel right to block any thread). 
The code in DesktopVideoCapture probably assumed it could get away with this by not being run on the UI thread. But I wonder if the correct fix would be to change DesktopVideoCapture to not require blocking instead of officially allowing blocking operations on the UI thread on OSX.

Opinions?
Cc: emir...@chromium.org
This just happened again on emircan@'s Macbook.

@dalecurtis: Why are we choosing the UI thread as the audio thread on OSX? Should we maybe choose a different thread for video capture in that case?
This looks like the underlying reason why the tests started failing: https://build.chromium.org/p/chromium.webrtc/builders/Mac%20Tester/builds/67267 

Below CL enabled IO thread checks on browser_tests and it caused problems.
https://codereview.chromium.org/2844053002
I talked with jam and made a patch to allow IO for these mac test cases: https://codereview.chromium.org/2840333004/
Cc: grunell@chromium.org olka@chromium.org
The bots are green again. We should look into this if this is indeed an unexpected behavior. I am cc'ing some audio folks for their input.
Thanks for the heads-up. For some audio tests we already have this (for example WebRtcAudioDebugRecordingsBrowserTest). My suggestion is that someone (the author of the respective test) looks at the tests you've allowed IO on to verify that it's expected.

Sign in to add a comment