Improve handling of gigantic CommandExceptions

Summary:
See T2193. For some commands (`svn log --xml ...`), output may be very large:

  - Truncate the maximum length of exception messages.
  - Summarize outputs in CommandExceptions.

Test Plan: Added `execx('cat /usr/share/dict/words && exit 1')` to a controller, loaded page. Saw a reasonbly-sized exception onscreen and in the logs.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2193

Differential Revision: https://secure.phabricator.com/D4280
Fix a bug where an ExecFuture might hang on __destruct() if its process holds pipes

Summary:
I don't have a complete understanding of exactly what's going on here, but here's what I have been able to determine:

  - ExecFuture has a long-standing bug where it may hang indefinitely in __destruct() if the other process holds pipes open, even though ExecFuture has closed the pipes.
    - The new unit test reproduces this behavior.
    - Mystery: I don't know why closing the pipes from our side isn't good enough.
  - D4228 changed PhutilSocketChannel, which would previously tear down **both** pipes when either closed. Now it tears down only one pipe.
    - Mystery: I'm not sure which pipe dies and which stays alive.
  - This exposed T2248, where the remaining pipe kept the parent open and hanging in ExecFuture::__destruct().

Test Plan:
Added unit test, which failed. Made patch. Ran unit tests; tests passed.

Reproduced T2248 and ran "arc unit"; worked properly after this patch.

Reviewers: btrahan, vrana, ender, nh

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T2248

Differential Revision: https://secure.phabricator.com/D4292
Implement kvcache profiling with a proxy instead of in each cache

Summary:
We have a lot of profiler code duplication right now for a very marginal benefit (slightly better information about cache access from Memcache caches). Instead, use a Proxy to implement profiling on top of caches, then delete the four copies of the cache code from the APC, memory, disk and request caches.

(This is motivated by wanting to add a new cache for Diviner, which would have meant copy/pasting all this code //again//. I also anticipate other uses for proxies: prefixing all keys; isolating writes for tests.)

Test Plan: Ran unit tests.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T988

Differential Revision: https://secure.phabricator.com/D4287
Implement a directory-based cache

Summary: Implements a directory-based disk cache. This cache is more suitable for slow/large operations than the existing OnDisk cache. Specifically, it is suitable for use in Diviner.

Test Plan: Unit tests.

Reviewers: btrahan, vrana

Reviewed By: btrahan

CC: aran

Maniphest Tasks: T988

Differential Revision: https://secure.phabricator.com/D4288
Update CA roots ".pem" file

Summary: We're nearly a year out of date. Downloaded a fresh one from http://curl.haxx.se/docs/caextract.html

Test Plan: diffed them, saw sensible-looking changes

Reviewers: btrahan, codeblock

Reviewed By: codeblock

CC: aran

Differential Revision: https://secure.phabricator.com/D4349
Fix checking for the same name in tree

Summary: This cost me a segfault in HPHP, broken HPHP after restart, installing nginx, php-fpm, xhprof and several hours of my time.

Test Plan: Displayed a diff with file named '0' without segfault and timeout.

Reviewers: epriestley

Reviewed By: epriestley

CC: aran, Korvin

Differential Revision: https://secure.phabricator.com/D4352
Fix an issue where the first service call on the page may not be marked complete if it is a kvcache request

Summary: The first call ID we issue is 0. Possibly we should start at 1, but the ID counter is slightly complicated to muck with. Do a strict null test instead.

Test Plan: Loaded a page which did a kvcache hit first, didn't see a darkconsole issue with undefined 'duration' key in service log.

Reviewers: btrahan, codeblock

Reviewed By: codeblock

CC: aran

Differential Revision: https://secure.phabricator.com/D4358
Don't highlight whole text in () as URL

Summary:
Users are confused by it.

Also allow highlighting of `[http://...]` and such.

Test Plan:
`(http://example.com fixes this.)`
`[http://example.com]`

Reviewers: epriestley

Reviewed By: epriestley

CC: fzamore, aran, Korvin

Differential Revision: https://secure.phabricator.com/D4362