{"id":3171,"date":"2018-02-22T16:08:38","date_gmt":"2018-02-22T05:08:38","guid":{"rendered":"http:\/\/blog.mozilla.org\/nnethercote\/?p=3171"},"modified":"2018-02-22T16:08:38","modified_gmt":"2018-02-22T05:08:38","slug":"nicer-commands-for-content-processes","status":"publish","type":"post","link":"https:\/\/blog.mozilla.org\/nnethercote\/2018\/02\/22\/nicer-commands-for-content-processes\/","title":{"rendered":"Nicer commands for content processes"},"content":{"rendered":"<p>The current Firefox release creates content processes with very long and ugly commands. Here&#8217;s an example, as reported by &#8216;ps&#8217; on my Linux64 machine (with wrapping to make it show up entirely on your screen):<\/p>\n<pre>\/home\/njn\/moz\/mi8\/o64\/dist\/bin\/firefox -contentproc -childID 2 -isForBrowser -in\r\ntPrefs 6:50|7:-1|20:0|35:1000|43:20|44:5|45:10|52:0|58:128|59:10000|64:0|66:400|\r\n67:1|68:0|69:0|70:100|75:0|76:120|77:120|162:2|163:1|167:60|168:30|169:512000|17\r\n8:5000|180:6|194:8192|195:524288|196:5|209:10000|230:24|231:32768|233:0|234:0|24\r\n3:5|247:1048576|249:100|250:5000|252:600|253:4|254:1|262:20|279:4|291:60000|309:\r\n300|310:30| -boolPrefs 1:0|2:0|4:1|5:1|25:1|28:1|29:1|30:1|32:1|33:1|34:1|37:1|3\r\n8:1|39:1|42:1|46:1|47:0|48:0|49:1|50:1|51:1|53:0|56:1|57:1|60:1|61:0|62:0|63:0|6\r\n5:0|71:1|72:1|73:1|74:1|78:1|79:1|80:0|81:0|82:1|83:1|84:1|85:1|86:1|89:0|90:0|9\r\n3:1|94:1|98:1|99:1|100:0|101:1|102:1|103:1|104:0|105:0|107:0|108:0|109:1|110:1|1\r\n11:1|114:1|115:1|116:1|117:1|118:1|119:0|120:0|121:1|122:0|123:0|124:1|125:1|126\r\n:0|127:1|128:1|129:0|131:1|132:0|133:0|134:1|135:1|136:0|137:0|138:0|139:1|140:1\r\n|141:1|142:1|143:0|144:1|145:1|146:1|147:1|148:1|149:1|150:0|151:1|152:1|153:0|1\r\n54:1|155:0|156:0|157:0|158:1|159:1|160:1|161:1|164:1|165:0|172:1|175:0|176:0|177\r\n:1|181:0|183:1|184:0|185:1|187:1|189:0|190:0|193:0|197:1|198:0|199:1|200:1|201:0\r\n|204:1|208:1|210:1|211:0|213:1|216:0|228:0|229:0|232:1|235:0|237:1|238:1|240:1|2\r\n41:0|248:1|251:1|256:0|257:0|258:0|259:1|260:1|261:0|266:1|269:1|270:1|271:1|272\r\n:1|273:1|274:0|275:1|281:1|284:0|285:1|286:1|287:0|288:1|289:1|290:1|292:0|293:0\r\n|295:1|304:1|305:1|306:0|307:0|308:0| -stringPrefs 3:7;default|215:3;1.0|226:332\r\n; \u00a0\u00bc\u00bd\u00be\u01c3\u02d0??\u0589\u058a\u05c3\u05f4\u0609\u060a\u066a\u06d4\u0701\u0702\u0703\u0704\u115f\u1160\u1735\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a???\u2010 \u2019\u2024\u2027???????\u202f\u2039\u203a\u2041\u2044\u2052\u205f\u2153\u2154\u2155\u2156\u2157\u2158\u2159\u215a?\u215c\u215d\u215e\u215f\u2215\u2236\u23ae\u2571\u29f6\u29f8\u2afb\u2afd&gt;\r\n\u2ff0\u2ff1\u2ff2\u2ff3\u2ff4\u2ff5\u2ff6\u2ff7\u2ff8\u2ff9\u2ffa\u2ffb\u3000\u3002\u3014\u3015\u3033\u30a0\u3164\u321d\u321e\u33ae\u33af\u33c6\u33df\ua789\ufe14\ufe15\ufe3f\ufe5d\ufe5e?\uff0e\uff0f\uff61\uffa0???\ufffc\ufffd|227:4;\r\nhigh|280:36;97c47c17-80b5-497c-b5ee-1c5db2d06af6| -schedulerPrefs 0001,2 -appdir\r\n \/home\/njn\/moz\/mi8\/o64\/dist\/bin\/browser 4500 true tab<\/pre>\n<p>That&#8217;s 1733 characters! Most of it is for three flags, called <code>-intPrefs<\/code>, <code>-boolPrefs<\/code>, and <code>-stringPrefs<\/code>, which are used to pass values of prefs that are required very early in the content process&#8217;s existence, before the first normal IPC message is received. These pref values are encoded compactly, but there are enough of them that they make the command quite long.<\/p>\n<p>Furthermore, there is one pref (<code>network.IDN.blacklist_chars<\/code>) that contains a bunch of unusual characters. That explains the gobbledygook on the 4th and 3rd last lines. Unsurprisingly, this gobbledygook was reported as <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1373157\">a bug<\/a>&#8230; which has been duplicated five times.<\/p>\n<p>The good news is that I recently <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1436863\">fixed this<\/a>, by changing things so that only pref values that have changed since startup get passed in this way. (Content processes are able to see the startup values, and so don&#8217;t need to be told them.) On my machine and profile, this reduces the number of pref values passed via the command from ~222 to ~3. It also reduces the number sent later via IPC from ~3165 to ~180.<\/p>\n<p>The command now looks like this:<\/p>\n<pre>\/home\/njn\/local\/install\/firefox\/firefox -contentproc -childID 4 -isForBrowser -b\r\noolPrefs 37:1|235:1|257:1|294:1| -stringPrefs 280:36;8bdf7a6e-d39a-494c-b55a-829\r\n2c4fc6254| -schedulerPrefs 0001,2 -greomni \/home\/njn\/local\/install\/firefox\/omni.\r\nja -appomni \/home\/njn\/local\/install\/firefox\/browser\/omni.ja -appdir \/home\/njn\/lo\r\ncal\/install\/firefox\/browser 3237 true tab<\/pre>\n<p>That&#8217;s 361 characters, all of them ASCII. Much better! And I have <a href=\"https:\/\/bugzilla.mozilla.org\/show_bug.cgi?id=1438678\">a plan<\/a>\u00a0to reduce things even further.<\/p>\n<p>This change is in Firefox 60, which is on track to be released around May 9th.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The current Firefox release creates content processes with very long and ugly commands. Here&#8217;s an example, as reported by &#8216;ps&#8217; on my Linux64 machine (with wrapping to make it show up entirely on your screen): \/home\/njn\/moz\/mi8\/o64\/dist\/bin\/firefox -contentproc -childID 2 -isForBrowser -in tPrefs 6:50|7:-1|20:0|35:1000|43:20|44:5|45:10|52:0|58:128|59:10000|64:0|66:400| 67:1|68:0|69:0|70:100|75:0|76:120|77:120|162:2|163:1|167:60|168:30|169:512000|17 8:5000|180:6|194:8192|195:524288|196:5|209:10000|230:24|231:32768|233:0|234:0|24 3:5|247:1048576|249:100|250:5000|252:600|253:4|254:1|262:20|279:4|291:60000|309: 300|310:30| -boolPrefs 1:0|2:0|4:1|5:1|25:1|28:1|29:1|30:1|32:1|33:1|34:1|37:1|3 8:1|39:1|42:1|46:1|47:0|48:0|49:1|50:1|51:1|53:0|56:1|57:1|60:1|61:0|62:0|63:0|6 5:0|71:1|72:1|73:1|74:1|78:1|79:1|80:0|81:0|82:1|83:1|84:1|85:1|86:1|89:0|90:0|9 3:1|94:1|98:1|99:1|100:0|101:1|102:1|103:1|104:0|105:0|107:0|108:0|109:1|110:1|1 11:1|114:1|115:1|116:1|117:1|118:1|119:0|120:0|121:1|122:0|123:0|124:1|125:1|126 :0|127:1|128:1|129:0|131:1|132:0|133:0|134:1|135:1|136:0|137:0|138:0|139:1|140:1 |141:1|142:1|143:0|144:1|145:1|146:1|147:1|148:1|149:1|150:0|151:1|152:1|153:0|1 [&hellip;]<\/p>\n","protected":false},"author":139,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[30,281515],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/3171"}],"collection":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/users\/139"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/comments?post=3171"}],"version-history":[{"count":0,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/posts\/3171\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/media?parent=3171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/categories?post=3171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.mozilla.org\/nnethercote\/wp-json\/wp\/v2\/tags?post=3171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}