Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Web Content process still in memory after Firefox crashed

Recently I have been playing with Ubuntu 16.04 (patched and upgraded) with MATE. On top of OS there is Firefox 56 (FF) installed for usual web browsing. As we know there are occasions FF goes down. But I have noticed there is quite high Disk utilization after such occasion. And reason was old FF process did not close the cache processes called Web Content.

As per Google-d info there are by default 4 of such processes. By fiddling with about:config you can modify the number of child processes. For more info in this check FF Electrolysis. I would not mark this malicious behavior, but its inconvenient never the less.
I have made a script that goes up on FF crash and kills such a processes. They run command similar to this:

"/usr/lib/firefox/firefox-contentproc-childID8-isForBrowser-intPrefs5:50|6:-1|18:0|28:1000|33:20|34:10|43:128|44:10000|49:0|51:400|52:1|53:0|54:0|59:0|60:120|61:120|91:2|92:1|106:5000|117:0|119:0|130:10000|155:24|156:32768|158:0|159:0|167:5|171:1048576|172:100|173:5000|175:600|176:4|177:1|186:2|200:60000|-boolPrefs1:0|2:0|4:0|26:1|27:1|30:0|35:1|36:0|37:0|38:0|41:1|42:1|45:0|46:0|47:0|48:0|50:0|55:1|56:1|57:0|58:1|62:1|63:1|64:0|65:1|66:1|67:0|68:1|71:0|72:0|75:1|76:1|80:1|81:1|82:1|83:0|85:0|86:0|87:1|88:0|93:1|94:0|100:0|105:0|108:1|109:0|111:1|112:1|114:1|118:0|120:0|122:0|124:1|125:1|131:0|132:0|133:1|135:0|146:0|153:0|154:0|157:1|160:0|162:1|164:1|165:0|170:0|174:1|179:0|180:0|181:0|182:1|183:0|184:0|185:1|188:1|192:0|193:0|194:1|195:1|196:0|197:1|198:1|199:1|201:0|202:0|204:0|212:1|213:1|214:0|215:0|216:0|-stringPrefs3:7;release|134:3;1.0|151:332;  ¼½¾ǃː̷̸։֊׃״؉؊٪۔܁܂܃܄ᅟᅠ᜵           ​‎‏‐’․‧

‪‫‬‭‮ ‹›⁁⁄⁒ ⅓⅔⅕⅖⅗⅘⅙⅚⅛⅜⅝⅞⅟∕∶⎮╱⧶⧸⫻⫽⿰⿱⿲⿳⿴⿵⿶⿷⿸⿹⿺⿻ 。〔〕〳゠ㅤ㈝㈞㎮㎯㏆㏟꞉︔︕︿﹝﹞./。ᅠ�|152:8;moderate|-greomni/usr/lib/firefox/omni.ja-appomni/usr/lib/firefox/browser/omni.ja-appdir/usr/lib/firefox/browser1078truetab "

Parts of this command I have identified so far :

  1. For starter : /usr/lib/firefox/firefox -contentproc -childID"CHILD_ID" -isForBrowser
    where "CHILD_ID" is the index of subprocess handling cache for FF, I have them from 0 to 9 as my FF settings goes by default to 4 but max is at 10. Other params are self explanatory.
  2. Then there are many preferences int/bool/string which looks like piping the process over to some other process. I'm not sure how to interpret these to human readable language.
  3. Lastly all the processes end in -greomni/usr/lib/firefox/omni.ja -appomni/usr/lib/firefox/browser/omni.ja -appdir/usr/lib/firefox/browser "FF_PID" true tab
    where omni.ja is a multi lib archive, more info here. "FF_PID" is the process ID number of FF process that created such cache child. Last two params true tab are unknown to me. Man page of FF is too shallow to help here.
  4. If you want to see your hung up processes try my pickup line : ps -ef | grep "firefox -contentproc" --color=never | awk ' { t = $1; $1 = $3; $3 = t; print; } ' | grep "^1" --color=never

So my reasoning and questioning is:

  1. Why is it that FF crash report leave these processes in the memory ?
    Is this leftover child process used for tab recovery ?
    If not, why ?
  2. Can I use this to recover my text edit in browser before the crash (e.g. forum message lost on crash) ?
  3. So far I kill all of the processes to free my disk usage. Is there a better way ? Let me know please.
  4. What are those ridiculous pipes in the command? I suppose that is the main reason my disk usage is so high. Looking for some inexistent memory addresses ?

My cleanup line is : for ch_id in `ps -ef | grep "firefox -contentproc" --color=never | awk ' { t = $1; $1 = $3; $3 = t; print; } ' | grep "^1" --color=never | awk '{print$2}'`; do kill -9 $ch_id ; done

like image 265
lukassos Avatar asked Nov 08 '22 15:11

lukassos


1 Answers

This is only a partial answer only about the "pipes" in the command line. Those are not pipes but part of firefox command line parameters syntax for -*Prefs options. As far as I could tell this is only "documented" in the source code (see https://dxr.mozilla.org/mozilla-release/source/dom/ipc/ContentProcess.cpp).

For example the -stringPrefs options refers to some preferences about strings (I do not know more than that) and the syntax is as follows: "index:length;string|(next entry...)". The list of weird looking characters seems to correspond to the blacklisted characters listed in http://kb.mozillazine.org/Network.IDN.blacklist_chars.

I have the same (or a very similar) result when I "ps -elf | firefox" and I have found other reference to this string elsewhere on the internet (but not about this string).

like image 177
TT Farreo Avatar answered Nov 15 '22 07:11

TT Farreo