restart rendering process after it crashes

855 views
Skip to first unread message

Florin

unread,
Apr 11, 2016, 7:20:35 AM4/11/16
to Chromium-dev
Hi,

I have wrote a small browser application on top of chromium's Content API. 
Currently, I have managed to detect if the rendering process has crashed, but I would like to restart it afterwards. 
How I can do this?

Thank you!

Nasko Oskov

unread,
Apr 11, 2016, 12:31:07 PM4/11/16
to flm...@airtame.com, Chromium-dev
Performing any navigation in the same WebContents should recreate a renderer process. If you want the same document, you can just reload it.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

Florin Maticu

unread,
Apr 12, 2016, 4:30:52 AM4/12/16
to Nasko Oskov, Chromium-dev
Hi,

I have managed to make it work by posting a task to content::BrowserThread::UI. The task is  loading an URL after the render process has crashed.

content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
    base::Bind(&loadURLAfterRenderCrash,this));

On the other hand, I get a stack trace if I try to load the URL from the RenderProcessGone(base::TerminationStatus status). The method is implemented by my WebContentsDelegate class.

In both cases I am using the same content::WebContents object (I have only one that is needed for the entire application).

I was expecting that the RenderProcessGone method is executed in the BrowserThread::UI context also.

Can someone explain why is not the case?

Thank you!
Florin


Nasko Oskov

unread,
Apr 12, 2016, 11:19:25 AM4/12/16
to Florin Maticu, Chromium-dev
On Tue, Apr 12, 2016 at 4:29 AM, Florin Maticu <flm...@airtame.com> wrote:
Hi,

I have managed to make it work by posting a task to content::BrowserThread::UI. The task is  loading an URL after the render process has crashed.

content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE,
    base::Bind(&loadURLAfterRenderCrash,this));

On the other hand, I get a stack trace if I try to load the URL from the RenderProcessGone(base::TerminationStatus status). The method is implemented by my WebContentsDelegate class.

Initiating navigation while handling notifications from WebContentsObserver must be avoided. It leads to problems. Your approach of posting a task is the right way to do it. 

Also, having a single object be both WebContentsDelegate and WebContentsObserver seems suboptimal and can lead to problems if you ever want to add more than one WebContents to your app.
 
In both cases I am using the same content::WebContents object (I have only one that is needed for the entire application).

I was expecting that the RenderProcessGone method is executed in the BrowserThread::UI context also.

It only runs on the UI thread. 
 
Can someone explain why is not the case?

Can you show me a stack trace where this is actually the case? WebContentsObserver methods are only called on the UI thread.

In general, WebContentsObserver::RenderProcessGone is a problematic API and it is on our list of APIs to remove. You are better off using RenderProcessHostObserver to monitor for the lifetime of renderer processes.

Florin Maticu

unread,
Apr 13, 2016, 4:31:50 AM4/13/16
to Nasko Oskov, Chromium-dev
Hi,

I have attached my stack trace after the rendering process is killed (the case when I am trying to load an url from : RenderProcessGone(base::TerminationStatus status)

[0413/102558:ERROR:web_contents.cc(97)] Render process has terminated : (render killed)
[0413/102558:FATAL:raw_channel_posix.cc(328)] Check failed: message_loop_for_io()->WatchFileDescriptor( fd_.get().fd, true, base::MessageLoopForIO::WATCH_READ, read_watcher_.get(), this). 
#0 0x000000058d38 base::debug::StackTrace::StackTrace()
#1 0x00000005efac logging::LogMessage::~LogMessage()
#2 0x0000004682c6 mojo::system::(anonymous namespace)::RawChannelPosix::OnInit()
#3 0x0000004666f4 mojo::system::RawChannel::Init()
#4 0x00000046c16a mojo::system::Channel::Init()
#5 0x000000459e92 mojo::system::ChannelManager::CreateChannelOnIOThreadHelper()
#6 0x00000045a254 mojo::system::ChannelManager::CreateChannelHelper()
#7 0x00000045ac00 base::internal::RunnableAdapter<>::Run()
#8 0x00000045ab0c _ZN4base8internal12InvokeHelperILb0EvNS0_15RunnableAdapterIMN4mojo6system14ChannelManagerEFvyNS3_8embedder20ScopedPlatformHandleE13scoped_refptrINS4_15ChannelEndpointEERKNS_8CallbackIFvvEEES8_INS_10TaskRunnerEEEEENS0_8TypeListIJPS5_RKyS7_PS9_SF_PSG_EEEE8MakeItSoESK_SM_SO_S7_SP_SF_SQ_
#9 0x00000045aa6c _ZN4base8internal7InvokerINS_13IndexSequenceIJLj0ELj1ELj2ELj3ELj4ELj5EEEENS0_9BindStateINS0_15RunnableAdapterIMN4mojo6system14ChannelManagerEFvyNS6_8embedder20ScopedPlatformHandleE13scoped_refptrINS7_15ChannelEndpointEERKNS_8CallbackIFvvEEESB_INS_10TaskRunnerEEEEEFvPS8_ySA_SD_SI_SK_ENS0_8TypeListIJNS0_17UnretainedWrapperIS8_EEyNS0_13PassedWrapperISA_EESD_SG_SK_EEEEENSQ_IJNS0_12UnwrapTraitsISS_EENSX_IyEENSX_ISU_EENSX_ISD_EENSX_ISG_EENSX_ISK_EEEEENS0_12InvokeHelperILb0EvSN_NSQ_IJSO_RKySA_PSC_SI_PSJ_EEEEESF_E3RunEPNS0_13BindStateBaseE
#10 0x000000090560 base::debug::TaskAnnotator::RunTask()
#11 0x000000060a74 base::MessageLoop::RunTask()
#12 0x000000060d4c base::MessageLoop::DeferOrRunPendingTask()
#13 0x000000060ef2 base::MessageLoop::DoWork()
#14 0x00000008f5d4 base::MessagePumpLibevent::Run()
#15 0x00000006a7d8 base::RunLoop::Run()
#16 0x000000060538 base::MessageLoop::Run()
#17 0x00000007bb8a base::Thread::ThreadMain()
#18 0x000000078906 base::(anonymous namespace)::ThreadFunc()
#19 0x0000769f6100 start_thread


Best regards,
Florin

Anand

unread,
Apr 13, 2016, 10:46:26 PM4/13/16
to Chromium-dev, na...@chromium.org
That code is ancient (was deleted in January, I think). You should sync. Mojo stuff is under very active development.
Reply all
Reply to author
Forward
0 new messages