Page 1 of 1

FATAL:thread_restrictions.cc Check failed in debug (Windows)

PostPosted: Fri Sep 20, 2019 11:08 am
by robs
This is reproducible in cefclient on the 3809 branch (didn't test master) with a small change.

* comment out the call to CefEnableHighDPISupport in cefclient_win.cc around line 38
* build and run the debug version of cefclient
* DCHECK fails with the message and call stacks pasted below

Note, the release build seems to work just fine with CefEnableHighDPISupport missing.

Is it valid to not call CefEnableHighDPISupport? My application has High DPI support as a configurable option, so I'd like to take control of that part.

Also, I'm not sure why this DCHECK fails if we don't call CefEnableHighDPISupport. Maybe there's a deeper problem and this is just a hint?

Thanks for any suggestions!

Rob

The message in console with odd backtrace:
Code: Select all
[0920/115812.220:FATAL:thread_restrictions.cc(76)] Check failed: !g_blocking_disallowed.Get().Get(). Function marked as blocking was called from a scope that disallows blocking! If this task is running inside the ThreadPool, it needs to have MayBlock() in its TaskTraits. Otherwise, consider making this blocking work asynchronous or, as a last resort, you may use ScopedAllowBlocking (see its documentation for best practices).
g_blocking_disallowed currently set to true by
Backtrace:
   cef_time_delta [0x00007FFA0143F7C2+207134]
   cef_string_utf16_to_upper [0x00007FFA0055B692+185744]
   cef_string_utf16_to_upper [0x00007FFA005CC96D+649323]
   GetHandleVerifier [0x00007FFA02ACAC77+23462423]
   GetHandleVerifier [0x00007FFA02ACABED+23462285]
   GetHandleVerifier [0x00007FFA026626E7+18840711]
   GetHandleVerifier [0x00007FFA02662649+18840553]
   GetHandleVerifier [0x00007FFA02B3C565+23927557]
   GetHandleVerifier [0x00007FFA01AE65C8+6798184]
   IsSandboxedProcess [0x00007FFA00DD2ECF+2504630]
   cef_string_utf16_to_upper [0x00007FFA009A3EF7+4677109]
   IsSandboxedProcess [0x00007FFA00C4EA05+914156]
   cef_time_delta [0x00007FFA014111F5+17233]
   cef_zip_reader_create [0x00007FF9FE9E1F72+18252802]
   cef_zip_reader_create [0x00007FF9FE9E1EFD+18252685]
   cef_zip_reader_create [0x00007FF9FE9FE120+18367920]
   cef_zip_reader_create [0x00007FF9FE9FDF70+18367488]
   cef_zip_reader_create [0x00007FF9FE9FDD77+18366983]
   cef_zip_reader_create [0x00007FF9FE9E137E+18249742]
   cef_zip_reader_create [0x00007FF9FE9E8F64+18281460]
   cef_zip_reader_create [0x00007FF9FE598F68+13759480]
   cef_zip_reader_create [0x00007FF9FE598E9A+13759274]
   cef_zip_reader_create [0x00007FF9FE904A36+17346246]
   cef_zip_reader_create [0x00007FF9FE9D0C6E+18182398]
   cef_zip_reader_create [0x00007FF9FEA0C83F+18427087]
   cef_zip_reader_create [0x00007FF9FEA037E0+18390128]
   cef_zip_reader_create [0x00007FF9FEA03628+18389688]
   CrashForExceptionInNonABICompliantCodeRange [0x00007FFA004E3482+13567922]
   CrashForExceptionInNonABICompliantCodeRange [0x00007FFA004E2EE4+13566484]
   CrashForExceptionInNonABICompliantCodeRange [0x00007FFA004E285F+13564815]
   cef_string_utf16_to_upper [0x00007FFA005B3862+546656]
   cef_time_delta [0x00007FFA0145CA12+326510]
   cef_time_delta [0x00007FFA0145C6F1+325709]
   cef_string_utf16_to_upper [0x00007FFA00579CE8+310246]
   cef_string_utf16_to_upper [0x00007FFA00579204+307458]
   cef_time_delta [0x00007FFA0145D39F+328955]
   cef_string_utf16_to_upper [0x00007FFA0059AB01+444927]
   CrashForExceptionInNonABICompliantCodeRange [0x00007FFA004F5B4E+13643390]
   CefRunMessageLoop [0x00007FF6D005023A+26] (c:\users\rob\downloads\cef_binary_76.1.5+gd8a577c+chromium-76.0.3809.87_windows64\libcef_dll\wrapper\libcef_dll_wrapper.cc:135)
   client::MainMessageLoopStd::Run [0x00007FF6CFF84793+35] (c:\users\rob\downloads\cef_binary_76.1.5+gd8a577c+chromium-76.0.3809.87_windows64\tests\shared\browser\main_message_loop_std.cc:15)
   client::`anonymous namespace'::RunMain [0x00007FF6CFF9BDEF+2015] (c:\users\rob\downloads\cef_binary_76.1.5+gd8a577c+chromium-76.0.3809.87_windows64\tests\cefclient\cefclient_win.cc:119)
   wWinMain [0x00007FF6CFF9DE6B+59] (c:\users\rob\downloads\cef_binary_76.1.5+gd8a577c+chromium-76.0.3809.87_windows64\tests\cefclient\cefclient_win.cc:142)
   invoke_main [0x00007FF6D0266D5D+45] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:118)
   __scrt_common_main_seh [0x00007FF6D0266C07+295] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:253)
   __scrt_common_main [0x00007FF6D0266ACE+14] (f:\dd\vctools\crt\vcstartup\src\startup\exe_common.inl:296)
   wWinMainCRTStartup [0x00007FF6D0266D79+9] (f:\dd\vctools\crt\vcstartup\src\startup\exe_wwinmain.cpp:17)
   BaseThreadInitThunk [0x00007FFA82807BD4+20]
   RtlUserThreadStart [0x00007FFA8388CEE1+33]



Call stack:
Code: Select all
    libcef.dll!logging::LogMessage::~LogMessage() Line 937   C++
    libcef.dll!base::internal::AssertBlockingAllowed() Line 83   C++
    libcef.dll!base::ScopedBlockingCall::ScopedBlockingCall(const base::Location & from_here, base::BlockingType blocking_type) Line 77   C++
    libcef.dll!base::PinSystemLibrary(base::BasicStringPiece<std::__1::basic_string<wchar_t> > name, base::NativeLibraryLoadError * error) Line 233   C++
    libcef.dll!base::win::`anonymous namespace'::PinUser32Internal(base::NativeLibraryLoadError * error) Line 183   C++
    libcef.dll!base::win::IsDeviceUsedAsATablet(std::__1::basic_string<char,std::__1::char_traits<char>,std::__1::allocator<char> > * reason) Line 566   C++
    libcef.dll!ui::GetAvailableHoverTypes() Line 59   C++
    libcef.dll!ui::GetAvailablePointerAndHoverTypes() Line 27   C++
    libcef.dll!content::RenderViewHostImpl::SetSlowWebPreferences(const base::CommandLine & command_line, content::WebPreferences * prefs) Line 648   C++
    libcef.dll!content::RenderViewHostImpl::ComputeWebPreferences() Line 460   C++
    libcef.dll!content::RenderViewHostImpl::OnWebkitPreferencesChanged() Line 993   C++
    libcef.dll!content::RenderViewHostImpl::GetWebkitPreferences() Line 978   C++
    libcef.dll!content::RenderViewHostImpl::GetWebkitPreferencesForWidget() Line 439   C++
    libcef.dll!content::RenderWidgetHostViewAura::RenderWidgetHostViewAura(content::RenderWidgetHost * widget_host, bool is_guest_view_hack) Line 382   C++
    libcef.dll!content::WebContentsViewAura::CreateViewForWidget(content::RenderWidgetHost * render_widget_host, content::RenderWidgetHost * embedder_render_widget_host) Line 969   C++
    libcef.dll!content::WebContentsImpl::CreateRenderWidgetHostViewForRenderManager(content::RenderViewHost * render_view_host) Line 6439   C++
    libcef.dll!content::WebContentsImpl::CreateRenderViewForRenderManager(content::RenderViewHost * render_view_host, int opener_frame_routing_id, int proxy_routing_id, const base::UnguessableToken & devtools_frame_token, const content::FrameReplicationState & replicated_frame_state) Line 6455   C++
    libcef.dll!content::RenderFrameHostManager::InitRenderView(content::RenderViewHostImpl * render_view_host, content::RenderFrameProxyHost * proxy) Line 2108   C++
    libcef.dll!content::RenderFrameHostManager::ReinitializeRenderFrame(content::RenderFrameHostImpl * render_frame_host) Line 2264   C++
    libcef.dll!content::RenderFrameHostManager::GetFrameHostForNavigation(const content::NavigationRequest & request) Line 732   C++
    libcef.dll!content::RenderFrameHostManager::DidCreateNavigationRequest(content::NavigationRequest * request) Line 566   C++
    libcef.dll!content::FrameTreeNode::CreatedNavigationRequest(std::__1::unique_ptr<content::NavigationRequest,std::__1::default_delete<content::NavigationRequest> > navigation_request) Line 432   C++
    libcef.dll!content::NavigatorImpl::Navigate(std::__1::unique_ptr<content::NavigationRequest,std::__1::default_delete<content::NavigationRequest> > request, content::ReloadType reload_type, content::RestoreType restore_type) Line 352   C++
    libcef.dll!content::NavigationControllerImpl::NavigateWithoutEntry(const content::NavigationController::LoadURLParams & params) Line 2892   C++
    libcef.dll!content::NavigationControllerImpl::LoadURLWithParams(const content::NavigationController::LoadURLParams & params) Line 974   C++
    libcef.dll!content::NavigationControllerImpl::LoadURL(const GURL & url, const content::Referrer & referrer, ui::PageTransition transition, const std::__1::basic_string<char,std::__1::char_traits<char>,std::__1::allocator<char> > & extra_headers) Line 940   C++
    libcef.dll!CefBrowserHostImpl::LoadMainFrameURL(const std::__1::basic_string<char,std::__1::char_traits<char>,std::__1::allocator<char> > & url, const content::Referrer & referrer, ui::PageTransition transition, const std::__1::basic_string<char,std::__1::char_traits<char>,std::__1::allocator<char> > & extra_headers) Line 1622   C++
    libcef.dll!CefBrowserHostImpl::Create(CefBrowserHostImpl::CreateParams & create_params) Line 383   C++
    libcef.dll!CefBrowserHost::CreateBrowserSync(const CefWindowInfo & windowInfo, scoped_refptr<CefClient> client, const CefStringBase<CefStringTraitsUTF16> & url, const CefStructBase<CefBrowserSettingsTraits> & settings, scoped_refptr<CefDictionaryValue> extra_info, scoped_refptr<CefRequestContext> request_context) Line 291   C++
    libcef.dll!`anonymous namespace'::CreateBrowserWithHelper(`anonymous namespace'::CreateBrowserHelper * helper) Line 142   C++
    libcef.dll!base::TaskAnnotator::RunTask(const char * trace_event_name, base::PendingTask * pending_task) Line 142   C++
    libcef.dll!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoWorkImpl(base::sequence_manager::LazyNow * continuation_lazy_now, bool * ran_task) Line 369   C++
    libcef.dll!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::DoSomeWork() Line 221   C++
    libcef.dll!base::MessagePumpForUI::DoRunLoop() Line 219   C++
    libcef.dll!base::MessagePumpWin::Run(base::MessagePump::Delegate * delegate) Line 77   C++
    libcef.dll!base::sequence_manager::internal::ThreadControllerWithMessagePumpImpl::Run(bool application_tasks_allowed, base::TimeDelta timeout) Line 470   C++
    libcef.dll!base::RunLoop::RunWithTimeout(base::TimeDelta timeout) Line 164   C++
    libcef.dll!CefRunMessageLoop() Line 308   C++
>   cefclient.exe!CefRunMessageLoop() Line 135   C++
    cefclient.exe!client::MainMessageLoopStd::Run() Line 15   C++
    cefclient.exe!client::`anonymous namespace'::RunMain(HINSTANCE__ * hInstance, int nCmdShow) Line 119   C++
    cefclient.exe!wWinMain(HINSTANCE__ * hInstance, HINSTANCE__ * hPrevInstance, wchar_t * lpCmdLine, int nCmdShow) Line 142   C++

Re: FATAL:thread_restrictions.cc Check failed in debug (Wind

PostPosted: Fri Sep 20, 2019 11:16 am
by magreenblatt
Please add a bug. Include information about your Windows version and display type (high-dpi or not).

Re: FATAL:thread_restrictions.cc Check failed in debug (Wind

PostPosted: Fri Sep 20, 2019 11:34 am
by robs
Here you go:
https://bitbucket.org/chromiumembedded/ ... eck-failed

Thanks for taking a look!

Re: FATAL:thread_restrictions.cc Check failed in debug (Wind

PostPosted: Fri Sep 20, 2019 11:38 am
by magreenblatt
robs wrote:Is it valid to not call CefEnableHighDPISupport? My application has High DPI support as a configurable option, so I'd like to take control of that part.

It is valid but not recommended. Why would the user choose to disable high-dpi on a screen that supports it?

Re: FATAL:thread_restrictions.cc Check failed in debug (Wind

PostPosted: Fri Sep 20, 2019 12:04 pm
by robs
There are two reasons I can think of. First, performance; with high-dpi our application needs to render 4x as many pixels. Second is that our application can host third-party plugins and in some cases those only work properly with high-dpi disabled. But hopefully over time this option becomes less important.

Rob

Re: FATAL:thread_restrictions.cc Check failed in debug (Wind

PostPosted: Fri Sep 20, 2019 4:30 pm
by amaitland
Are you setting --force-device-scale-factor=1

Historically chromium would render incorrectly when running on a HighDPI display in an application that doesn't support HighDPI.

Re: FATAL:thread_restrictions.cc Check failed in debug (Wind

PostPosted: Tue Sep 24, 2019 4:44 pm
by robs
Are you setting --force-device-scale-factor=1


No, thanks for the pointer. This post is more about the fact that I was unable to run a Debug build of CEF without calling CefEnableHighDPISupport, which was a bit curious.

Thanks,
Rob

Re: FATAL:thread_restrictions.cc Check failed in debug (Wind

PostPosted: Thu Apr 02, 2020 3:39 am
by softharshal
Hello Team,

I am still facing this issue with CEF 76. Is there any workaround or fix available to this?