多线程下base库里可能的死锁重入问题。

2020-03-19 21:42:32 浏览数 (1)

问题是这样的,blink线程的void WaitableEvent::Wait() 里会卡死,等待UI线程。但UI线程可能在等blink线程的npapi真窗口响应消息。

理论上的解决方式,应该是blink线程不放真窗口,但实在要改太多东西,现在我只好折中一下,把void WaitableEvent::Wait()里加上消息循环,临时处理下真窗口消息。

但这样又有重入的问题:

     KernelBase.dll!_DebugBreak@0    未知      node.dll!logging::LogMessage::Init    C      node.dll!logging::LogMessage::LogMessage    C      node.dll!gpu::gles2::GLES2Implementation::SingleThreadChecker::SingleThreadChecker    C      node.dll!gpu::gles2::GLES2Implementation::Viewport    C      node.dll!gpu_blink::WebGraphicsContext3DImpl::viewport    C      node.dll!blink::WebGLRenderingContextBase::viewport    C      node.dll!blink::WebGLRenderingContextV8Internal::viewportMethod    C      node.dll!blink::WebGLRenderingContextV8Internal::viewportMethodCallback    C      node.dll!v8::internal::FunctionCallbackArguments::Call    C      node.dll!v8::internal::`anonymous namespace'::HandleApiCallHelper<0>    C      node.dll!v8::internal::Builtin_Impl_HandleApiCall    C      node.dll!v8::internal::Builtin_HandleApiCall    C      3d28607e    未知      node.dll!v8::internal::`anonymous namespace'::Invoke    C      node.dll!v8::internal::Execution::Call    C      node.dll!v8::Function::Call    C      node.dll!blink::V8ScriptRunner::callFunction    C      node.dll!blink::ScriptController::callFunction    C      node.dll!blink::V8FrameRequestCallback::handleEvent    C      node.dll!blink::FrameRequestCallbackCollection::executeCallbacks    C      node.dll!blink::ScriptedAnimationController::executeCallbacks    C      node.dll!blink::ScriptedAnimationController::serviceScriptedAnimations    C      node.dll!blink::Document::serviceScriptedAnimations    C      node.dll!blink::PageAnimator::serviceScriptedAnimations    C      node.dll!blink::PageWidgetDelegate::animate    C      node.dll!blink::WebViewImpl::beginFrame    C      node.dll!content::WebPageImpl::onBeginMainFrame    C      node.dll!content::RenderWidgetCompositor::BeginMainFrame    C      node.dll!cc::LayerTreeHost::BeginMainFrame    C      node.dll!cc::ThreadProxy::BeginMainFrame    C      node.dll!base::internal::RunnableAdapter<void (__thiscall cc::ThreadProxy::*)(scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> >)>::Run    C      node.dll!base::internal::InvokeHelper<1,void,base::internal::RunnableAdapter<void (__thiscall cc::ThreadProxy::*)(scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> >)>,base::internal::TypeList<base::WeakPtr<cc::ThreadProxy> const &,scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> > > >::MakeItSo    C      node.dll!base::internal::Invoker<base::IndexSequence<0,1>,base::internal::BindState<base::internal::RunnableAdapter<void (__thiscall cc::ThreadProxy::*)(scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> >)>,void __cdecl(cc::ThreadProxy *,scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> >),base::internal::TypeList<base::WeakPtr<cc::ThreadProxy>,base::internal::PassedWrapper<scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> > > > >,base::internal::TypeList<base::internal::UnwrapTraits<base::WeakPtr<cc::ThreadProxy> >,base::internal::UnwrapTraits<base::internal::PassedWrapper<scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> > > > >,base::internal::InvokeHelper<1,void,base::internal::RunnableAdapter<void (__thiscall cc::ThreadProxy::*)(scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> >)>,base::internal::TypeList<base::WeakPtr<cc::ThreadProxy> const &,scoped_ptr<cc::ThreadProxy::BeginMainFrameAndCommitState,base::DefaultDeleter<cc::ThreadProxy::BeginMainFrameAndCommitState> > > >,void __cdecl(void)>::Run    C      node.dll!base::Callback<void __cdecl(void)>::Run    C      node.dll!base::debug::TaskAnnotator::RunTask    C      node.dll!base::MessageLoop::RunTask    C      node.dll!base::MessageLoop::DeferOrRunPendingTask    C      node.dll!base::MessageLoop::DoWork    C      node.dll!base::MessagePumpForUI::HandleWorkMessage    C      node.dll!base::MessagePumpForUI::WndProcThunk    C      node.dll!base::win::WrappedWindowProc<&base::MessagePumpForUI::WndProcThunk>    C      user32.dll!_InternalCallWinProc@20    未知      user32.dll!_UserCallWinProcCheckWow@32    未知      user32.dll!_DispatchMessageWorker@8    未知      user32.dll!_DispatchMessageW@4    未知 >    node.dll!base::WaitableEvent::Wait    C      node.dll!gpu::InProcessCommandBuffer::WaitForGetOffsetInRange    C      node.dll!gpu::CommandBufferHelper::WaitForGetOffsetInRange    C      node.dll!gpu::CommandBufferHelper::Finish    C      node.dll!gpu::gles2::GLES2Implementation::WaitForCmd    C      node.dll!gpu::gles2::GLES2Implementation::CheckFramebufferStatus    C      node.dll!gpu_blink::WebGraphicsContext3DImpl::checkFramebufferStatus    C      node.dll!blink::DrawingBuffer::resizeFramebuffer    C      node.dll!blink::DrawingBuffer::reset    C      node.dll!blink::WebGLRenderingContextBase::reshape    C      node.dll!blink::HTMLCanvasElement::reset    C      node.dll!blink::HTMLCanvasElement::parseAttribute    C      node.dll!blink::Element::attributeChanged    C      node.dll!blink::Element::didModifyAttribute    C      node.dll!blink::Element::setAttributeInternal    C      node.dll!blink::Element::setAttribute    C      node.dll!blink::Element::setIntegralAttribute    C      node.dll!blink::HTMLCanvasElement::setHeight    C      node.dll!blink::HTMLCanvasElementV8Internal::heightAttributeSetter    C      node.dll!blink::HTMLCanvasElementV8Internal::heightAttributeSetterCallback    C      node.dll!v8::internal::FunctionCallbackArguments::Call    C      node.dll!v8::internal::`anonymous namespace'::HandleApiCallHelper<0>    C      node.dll!v8::internal::Builtins::InvokeApiFunction    C      node.dll!v8::internal::Object::SetPropertyWithAccessor    C      node.dll!v8::internal::Object::SetPropertyInternal    C      node.dll!v8::internal::Object::SetProperty    C      node.dll!v8::internal::StoreIC::Store    C      node.dll!v8::internal::Runtime_StoreIC_Miss    C      3d28607e    未知      node.dll!v8::internal::`anonymous namespace'::Invoke    C      node.dll!v8::internal::Execution::Call    C      node.dll!v8::Function::Call    C      node.dll!blink::V8ScriptRunner::callFunction    C      node.dll!blink::ScriptController::callFunction    C      node.dll!blink::ScriptController::callFunction    C      node.dll!blink::V8EventListener::callListenerFunction    C      node.dll!blink::V8AbstractEventListener::invokeEventHandler    C      node.dll!blink::V8AbstractEventListener::handleEvent    C      node.dll!blink::V8AbstractEventListener::handleEvent    C      node.dll!blink::EventTarget::fireEventListeners    C      node.dll!blink::EventTarget::fireEventListeners    C      node.dll!blink::Node::handleLocalEvents    C      node.dll!blink::NodeEventContext::handleLocalEvents    C      node.dll!blink::EventDispatcher::dispatchEventAtTarget    C      node.dll!blink::EventDispatcher::dispatch    C      node.dll!blink::EventDispatchMediator::dispatchEvent    C      node.dll!blink::EventDispatcher::dispatchEvent    C      node.dll!blink::Node::dispatchEvent    C      node.dll!blink::HTMLImageLoader::dispatchLoadEvent    C      node.dll!blink::ImageLoader::dispatchPendingLoadEvent    C      node.dll!blink::ImageLoader::dispatchPendingEvent    C      node.dll!blink::EventSender<blink::ImageLoader>::dispatchPendingEvents    C      node.dll!blink::EventSender<blink::ImageLoader>::timerFired    C      node.dll!blink::Timer<blink::EventSender<blink::ImageLoader> >::fired    C      node.dll!blink::TimerBase::runInternal    C      node.dll!blink::TimerBase::CancellableTimerTask::run    C      node.dll!content::WebTimerBase::fired    C      node.dll!content::WebThreadImpl::schedulerTasks    C      node.dll!content::WebThreadImpl::fire    C      node.dll!content::sharedTimerFiredFunction    C      node.dll!content::TimerWindowWndProc    C      user32.dll!_InternalCallWinProc@20    未知      user32.dll!_UserCallWinProcCheckWow@32    未知      user32.dll!_DispatchMessageWorker@8    未知      user32.dll!_DispatchMessageW@4    未知      node.dll!base::MessagePumpForUI::ProcessMessageHelper    C      node.dll!base::MessagePumpForUI::ProcessNextWindowsMessage    C      node.dll!base::MessagePumpForUI::DoRunLoop    C      node.dll!base::MessagePumpWin::RunWithDispatcher    C      node.dll!base::MessagePumpWin::Run    C      node.dll!base::MessageLoop::RunHandler    C      node.dll!base::RunLoop::Run    C      node.dll!base::RunLoop::RunUntilIdle    C      node.dll!base::MessageLoop::RunUntilIdle    C      node.dll!content::OrigChromeMgr::runUntilIdle    C      node.dll!wkeSetDebugConfig    C      mb.dll!040fd7a9    未知      mb.dll!040fdca9    未知      mb.dll!04186d0d    未知      kernel32.dll!@BaseThreadInitThunk@12    未知      ntdll.dll!___RtlUserThreadStart@8    未知      ntdll.dll!__RtlUserThreadStart@8    未知 现在的解决方案是搞个重入禁止的标记。

0 人点赞