Reload crashed tab

2,895 views
Skip to first unread message

Jasper H.

unread,
Apr 1, 2012, 6:42:54 PM4/1/12
to Chromium-discuss
Hey all,

I'm wondering if there's a flag or option in chrome to reload a tab
the moment it crashes.
I'm building a kiosk-application and want to make it as independent as
possible. This includes a automatic recovery from possible crashes.

I've looked all over the web for an hour now but couldn't find if
chrome can do this.

So in other words: Is there an option or flag to automatically reload
the tab when it goes 'Aw snap...'

Cheers!
Jasper

number_one

unread,
Apr 3, 2012, 4:08:50 PM4/3/12
to Chromium-discuss
I've been looking for the same thing. This is something that is
really a requirement for any type of unattended kiosk or signage
application. Given that I've yet to be able to go for more than a few
days without Chrome crashing it would be extremely helpful for a flag
that would simply reload Chrome with the original command (options and
all) instead of leaving it at an "Aw Snap" page. It doesn't seem like
it would be difficult to add an option to reload since Chrome clearly
has the ability to display the crash page (i.e. it knows something
happened and can respond).

Dan Nawara

unread,
Dec 2, 2013, 12:01:57 PM12/2/13
to chromium...@chromium.org
Did either of you find a solution for this?

Isiah Meadows

unread,
Dec 5, 2013, 11:32:57 AM12/5/13
to chromium...@chromium.org
If I knew any C/C++ I would have likely already proposed a patch for this to allow it via added switch (it would prove its convenience for more than just this scenario).

Peter Teoh

unread,
Dec 8, 2013, 7:46:26 PM12/8/13
to goo...@jasperheeffer.nl, Chromium-discuss
I think not available, but best solution is to create another monitoring process that poll the existence of this chrome process by pid, and restart it it does not exists, and the new pid will be used for polling.

Similar ideas are discussed here:


The follow proposed a Javascript (but it is very irritating to refresh all the time):




(you can read the side links in stackoverflow or superuser for more similar questions)
 


Jasper

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



--
Regards,
Peter Teoh

number_one

unread,
Dec 10, 2013, 3:43:00 AM12/10/13
to chromium...@chromium.org, goo...@jasperheeffer.nl
Peter, your "solution" completely misses the point and would not work at all.  It would be relatively simple if the entire Chrome process terminated, but that is not what is happening.  When a tab process malfunctions or crashes the main Chrome process still exists so monitoring for the lack of a Chrome process won't do anything.  Also, there is no way to effectively track the PID of a particular tab process (no way to programatically get that).  And there can be multiple "child" processes relating to plugins and such, so that is just not viable at all.

What we need from Chrome is some type of notification system that can be subscribed to or polled for the state of all tabs and plugins.  Clearly the primary Chrome process has access to that data in order to be able to replace a failed tab process with the "Aw snap" message.  All we need is a way to get notified when that happens.  I'd dive into the code myself but just don't have the time...

Peter Teoh

unread,
Dec 12, 2013, 1:54:02 AM12/12/13
to dlon...@gmail.com, Chromium-discuss, Jasper Heeffer
Thanks "Number one" for the reply.   Totally agree with you, which is why I mentioned "best effort".   The short answer to your reply is that Linux does not have a mechanism for monitoring a process's exit condition if the process is not your child.   There is a "pnotify" patch to kernel suggested before but was rejected:


On Tue, Dec 10, 2013 at 4:43 PM, number_one <dlon...@gmail.com> wrote:
Peter, your "solution" completely misses the point and would not work at all.  It would be relatively simple if the entire Chrome process terminated, but that is not what is happening.  When a tab process malfunctions or crashes the main Chrome process still exists so monitoring for the lack of a Chrome process won't do anything.  Also, there is no way to effectively track the PID of a particular tab process (no way to programatically get that).  And there can be multiple "child" processes relating to plugins and such, so that is just not viable at all.

By "polling" I meant actively looking for something.   This contrast with "subscribe"....which is passively waiting to be informed.

So to actively poll for the existence of chrome is simple (many ways..just one here):

cat /proc/*/comm | grep chrome

and you can get a list of all chrome processes running.

Get the pid from the above, and then do a "stat()" to find the status of process.

Agree, plugins are individual processes, but all of them can be identified by searching for "chrome" as the comm filename.   False positive are possible.   Race condition (because you are not using waitpid()) from using stat() is also possible (eg, after stat() and the tab process died).    This is only a best-effort monitoring possible in current Linux, since "chrome" is not your child process.

(ps auwxf and you can see the parent child relationship - based on type=renderer, or zygote etc)



What we need from Chrome is some type of notification system that can be subscribed to or polled for the state of all tabs and plugins.  Clearly the primary Chrome process has access to that data in order to be able to replace a failed tab process with the "Aw snap" message.  All we need is a way to get notified when that happens.  I'd dive into the code myself but just don't have the time...


Clearly this is possible for the mother chrome process, since the mother process always know who are all the children, and can maintain a list of pid of who are running.
 
But for the OP's Kiosk application, there is simple solution.   There is a "chrome --app=http://www.google.com" option available to run it without tab, and then perhaps disable the right click to disable the popup-menu for creating new tab (by using extension, search the web).    So I guess that's the simplest solution I can think of - one tab process running at any one time, simplifying the monitoring and restart problem.  


On Sunday, December 8, 2013 7:46:26 PM UTC-5, Peter Teoh wrote:
I think not available, but best solution is to create another monitoring process that poll the existence of this chrome process by pid, and restart it it does not exists, and the new pid will be used for polling.

Similar ideas are discussed here:


The follow proposed a Javascript (but it is very irritating to refresh all the time):




(you can read the side links in stackoverflow or superuser for more similar questions)
 


On Mon, Apr 2, 2012 at 6:42 AM, Jasper H. <goo...@jasperheeffer.nl> wrote:
Hey all,

I'm wondering if there's a flag or option in chrome to reload a tab
the moment it crashes.
I'm building a kiosk-application and want to make it as independent as
possible. This includes a automatic recovery from possible crashes.

I've looked all over the web for an hour now but couldn't find if
chrome can do this.

So in other words: Is there an option or flag to automatically reload
the tab when it goes 'Aw snap...'

--
Regards,
Peter Teoh
Reply all
Reply to author
Forward
0 new messages