Hacker News new | ask | show | jobs
by korethr 1862 days ago
When Chrome was new and shiny, I used it for a time. Then, the first time I found myself needing to kill Chrome because it was completely locked up, I found myself staring at a wall of chrome processes in the task list, not knowing which one I needed to kill. At the time, I thought the idea of a separate process for each tab was silly. Though, with Firefox moving towards this model, I guess the engineers at Google were prescient in the correctness of that tradeoff.

I do use a lot of tabs, so I fear I'm going to find myself facing the same problem I faced with Chrome: a site misbehaves and locks things up, crap, which process do I kill? A way of tracking which tab maps to which process would be nice, so the next time I trip over a badly-coded page, I don't have to kill everything just to get my browser to respond again. Lazyweb question to y'all: is there a feature in Chrome or Firefox that can do this (mapping tab/page -> process), or have I just stumbled upon a side-project idea?

12 comments

I gave it a try. I opened a new tab to a random website, then went to about:memory

Scrolling down I found a section starting with

> web (pid 1036080)

> Explicit Allocations

> 108.27 MB (100.0%) -- explicit

> ├───45.04 MB (41.60%) -- window-objects/top(https://www.that-random.site/, id=175)

I try to kill that process now, but I post this message first in case I kill the whole browser.

Result: the tab crashed, the browser survived.

> Gah. Your tab just crashed.

> We can help!

> Choose Restore This Tab to reload the page.

Restore did work.

When a tab freezes, I just pull up activity monitor/top and look for the Chrome process using the most CPU. It's almost always the culprit.

I also like to occasionally sort by memory usage and kill the biggest Chrome processes. Chrome is nice in that it will show you when a process crashed, so what I do is kill the biggest memory hog, and then see what tab crashed. Then I do it again a few times.

This at least tells me which processes use the most RAM over time and should be recycled (Spoiler alert, it's always GMail and then GCal.)

Shift+Esc brings out Chrome task manager where you can kill individual tabs/pages by name.
Does this work when Chrome is locked up? Usually people go to Task Manager because it's unresponsive.
It works when 1..n of your tabs are frozen, but the UI is still responsive e.g. you are still able to switch to other tabs. If your chrome is completely frozen i.e. you can't even open the chrome task manager, then you usually have to restart the browser.
Chrome does not "lock up", at-least on Windows without extensions. Individual tabs may crash or lock up, but the rest of the interface hasn't done that for a many years.
Nice!

I suspected gmail was the heaviest thing I regularly had open, but it's good to see the stats.

On Firefox you can go to `about:processes`.

It lists tabs by process, and includes the PID (on Linux; no idea about other platforms). You can also directly kill tabs and processes from there.

That's super useful on a resource strapped system. Wish I knew this earlier.
For a resource-constrained machine, uBlock Origin + Auto Tab Discard save a lot of resources and keep a window with 100 tabs quite usable.
You should take a look at Firefox's about:about. There are all sorts of goodies in there.

For example, about:compat lists sites they added hard coded work arounds for.

sounds like page "about:processes" in Firefox would be super helpful in this case! you can use it to unload tabs and kill processes.
Process Explorer (from sysinternals) lists processes as a tree so it's easy to find and kill the root Chrome process. At a glance it looks like all non-root processes have a "--type" parameter given to them. The root process has the simplest command line with only "--remote-debugging-port" being passed.
not a direct resolution but i do use OneTab

https://addons.mozilla.org/en-US/firefox/addon/onetab/

to offload idle tabs. Downside is that it doesnt sync with firefox so anyhing i may need I may need to open in another firefox instance, I just bookmark.

The grouping is nice because it gives me a reference of a time i was doing x research/reading. And what i find is that there really isnt too much that i need to crossover, work stuff stays on my work computer, personal to personal etc.

Run `top`, sort by CPU or RES, depending on want is overspent.

If Firefox is still somehow responsive, open about:performance and identify the CPU-hungry tab(s), then close them.

In chrome when a site hangs its process the browser chrome is still responsive. So you just close the tab.
> a site misbehaves and locks things up

Why/how can this happen? That sounds like a bad failure of the browser.

In htop I can see and kill the process tree, I think processhacker2 can achieve the same on Windows.
if you're on linux you can do killall -9 firefox