AsyncUDPSocket

Summary:
Move AsyncUDPSocket to folly.

There is also one under realtime/voip/async that looks functionaly equivalent?  I think this one is only used in gangplank currently.

Test Plan: contbuild

Reviewed By: hans@fb.com

Subscribers: trunkagent, doug, alandau, bmatheny, njormrod, mshneer, folly-diffs@

FB internal diff: D1710675

Tasks: 5788116

Signature: t1:1710675:1417477000:9aebb466757554a5fa49d7c36cb504b4d8711b68
"fix" timeout behavior of ThriftServer

Summary: D1717707 introduced a regression.  If the server has task timeouts turned off, we shouldn't even follow the client timeout.

Test Plan: run failing unittest (see task)

Reviewed By: mshneer@fb.com

Subscribers: alandau, bmatheny, mshneer

FB internal diff: D1735667

Tasks: 5791442

Signature: t1:1735667:1418350454:d239091d96c22a7663e3150a1e63b3f0e3707f2c
move wangle/Executor.h to folly/ root

Summary:
this removes the dep EventBase has on wangle as we prepare to split off wangle
also changes namespace from folly::wangle to folly

Test Plan: just a couple of codemods so waiting for contbuild

Reviewed By: davejwatson@fb.com

Subscribers: trunkagent, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, zeus-diffs@, nli, cold-storage-diffs@, unicorn-diffs@, targeting-diff-backend@, hannesr, vighnesh, fugalh, alandau, bmatheny, adityab, zhuohuang, luk, darshan, gunjan, hdoshi, dzhulgakov, alihussains, panin, ves, mshneer, folly-diffs@, lins, nimishshah

FB internal diff: D1737376

Tasks: 5802833

Signature: t1:1737376:1418423430:82d219c34fcc50218c380a17435e5880e53db6bd
add more TApplicationException types to python

Test Plan: shake_head

Reviewed By: alandau@fb.com

Subscribers: trunkagent, ruibalp, hannesr, alandau, bmatheny, mshneer

FB internal diff: D1738394

Signature: t1:1738394:1418672652:3f936efcc5c94721d4538cb04be77b9e26b5f761
codemod: folly/wangle/ -> folly/wangle/futures

Summary: Last thing before moving experimental/wangle here. Once everything is in the same directory I'm probably going to consolidate experimental/wangle/concurrent with the executors in this directory into wangle/executors/. And probably rename some of these targets. For now, a dumb move is enough.

Test Plan: waiting for contbuild

Reviewed By: davejwatson@fb.com

Subscribers: trunkagent, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, lars, ruibalp, hero-diffs@, zeus-diffs@, vikas, danielg, mcduff, cold-storage-diffs@, unicorn-diffs@, ldbrandy, targeting-diff-backend@, netego-diffs@, fugalh, adamsyta, atlas2-eng@, alandau, bmatheny, adityab, everstore-dev@, zhuohuang, sweeney, mwa, jgehring, smarlow, akr, bnitka, jcoens, luk, zhguo, jying, apodsiadlo, alikhtarov, fuegen, dzhulgakov, mshneer, folly-diffs@, wch, tingy, hannesr

FB internal diff: D1740327

Tasks: 5802833

Signature: t1:1740327:1418752541:82d7486293b0a12938730ae66d480c120aded4dc
make ThreadManager a folly::Executor

Summary:
I want to make thrift TMs usable with wangle::via()

Damn overloaded virtual warnings mean implementing this in every subclass

Test Plan: fbconfig -r thrift/lib/cpp/concurrency && fbmake runtests

Reviewed By: hans@fb.com

Subscribers: trunkagent, alandau, bmatheny, mshneer, sjenkins

FB internal diff: D1742984

Tasks: 5838909

Signature: t1:1742984:1418761819:38d928839a4b07edf724e8dea6c7e216eeca4a2d
Unbreak proxygen build

Summary: https://phabricator.fb.com/D1729442 broke the build

Test Plan: fbconfig -r proxygen && fbmake runtests

Reviewed By: davejwatson@fb.com

Subscribers: alandau, bmatheny, mshneer

FB internal diff: D1743757

Tasks: 5841524

Signature: t1:1743757:1418770369:ba0fc9b619e571b1d0943b18ed579a377df8a249

Blame Revision: D1729442
Support read in TSimpleJSONProtocol

Summary:
TSimpleJSONProtocol produces JSON comformant output and is write-only. This implements read methods for TSimpleJSONProtocol by using type spec of a thrift struct.
Read methods reuse the contexts used by write methods to handle syntax. A spec stack is maintained for type information.

Test Plan: I am able to get this to work with all basic types and deeply nested types I created, like list<list<SomeStruct>>. Send it out first and will update after testing it thoroughly.

Reviewed By: mcduff@fb.com

Subscribers: trunkagent, mshneer, ruibalp, alandau, bmatheny

FB internal diff: D1466519

Signature: t1:1466519:1418166059:fd1725a135003639da513d38291e08c3e34a15f4
don't try to run async calls in EventBase thread if there's no EventBase

Summary: test channels like the one in the SR test "servicerouter/common/tests:ThriftUtilTest - Thrift2MethodName.BinaryProtocol" might not have associated event bases, don't choke if that's the case

Test Plan: ran failing tests, they pass now

Reviewed By: ckwalsh@fb.com

Subscribers: ruibalp, alandau, mshneer

FB internal diff: D1743706

Tasks: 5810465

Signature: t1:1743706:1418775626:0ae2422fe7c994934c74f45a2ba1e238cda9da5d
Use folly::SpinLock

Summary:
Update code to use the newer folly::SpinLock name, instead of
folly::io::PortableSpinLock.

Test Plan: fbconfig -r thrift/lib/cpp && fbmake runtests

Reviewed By: davejwatson@fb.com

Subscribers: trunkagent, doug, net-systems@, alandau, bmatheny, exa, mshneer

FB internal diff: D1734660

Signature: t1:1734660:1418334896:e6d935157111e58bb5bf20a05118c7488ac8b691
Refactor to eliminate duplicate code

Summary: See title / code

Test Plan: Unit tests, loadgen

Reviewed By: alandau@fb.com

Subscribers: cold-storage-diffs@, tw-eng@, dtw, kennyyu, hannesr, andreib, trunkagent, mhorowitz, mshneer, alandau, bmatheny, wstefancik

FB internal diff: D1732646

Signature: t1:1732646:1418677655:415fa4ea47cdf0f123a9bd617df9281a4a0e6fe6
Fix memory corruption

Summary: Was working on something else, and noticed this. It's pretty bad. Amazing that we didn't see more crashes here. Also why's ASAN not catching this?

Test Plan: Unit tests?

Reviewed By: alandau@fb.com

Subscribers: trunkagent, hannesr, alandau, bmatheny, mhorowitz, mshneer, wstefancik

FB internal diff: D1738334

Signature: t1:1738334:1418687630:8ae6e3904ff7fc3a302714fce0a956c612a41ef9
Encrypt in-place -- avoid unnecessary memcpy

Summary:
This diff makes the wrap / encrypt path be in-place for secure thrift. It eliminates two buffer copies:
- one during coalesce
- one during buffer allocation inside krb5 code

This is about 14% perf boost seen on loadgen with 100kb requests.

The decrypt path is a little more complicated, I'll try to see if it's possible to do it in-place given the current apis tomorrow. If possible, I'll do that in a separate diff. The complication is around knowing the padding size in advance.

Test Plan: loadgen, unittests

Reviewed By: alandau@fb.com

Subscribers: hannesr, trunkagent, alandau, bmatheny, mshneer, mhorowitz, acampi, wstefancik

FB internal diff: D1733275

Signature: t1:1733275:1418428637:fa3b39aad33d95bd3f300613e3073793e6e0388c
Eliminate buffer allocation during decrypt

Summary:
This eliminates one buffer copy during a decrypt. Unfortunately we're still doing a coalesce(). With some more coding that can probably be avoided, but it becomes a bit harder.

Basically gss_unwrap_iov interface can either accept a single contiguous token (we use this in the diff), or a broken up token. But that interface requires knowing the sizes of headers/padding, etc.

The perf win here is about 6% when running loadgen with 100kb messages.

Test Plan: loadgen, unittests

Reviewed By: alandau@fb.com

Subscribers: trunkagent, hannesr, alandau, bmatheny, mshneer, wstefancik

FB internal diff: D1738442

Signature: t1:1738442:1418677304:2711542d75265e7b679ab9a861338295287beaa1
Revert buffer copy optimizations

Summary:
Description:

Revert "[SecureThrift] Encrypt in-place -- avoid unnecessary memcpy"

This reverts commit f5ed88f6f3f5c0efaced1f5f25ae3efc9537bad7.

Revert "[SecureThrift] Eliminate buffer allocation during decrypt"

This reverts commit 44b20e321e2ba5a5fbdaf5b1daba170bf6de33a8.

Basically I was doing some more testing, and saw the following lines in the output sometimes:
E1217 11:19:43.907742  7803 ThriftUtil.cpp:154] Failed to parse header. Invalid message from client

Not sure why yet. But to be safe, let's revert while I investigate.

Test Plan: Compiled, ran test that showed this error

Reviewed By: alandau@fb.com

Subscribers: alandau, bmatheny, mshneer, wstefancik

FB internal diff: D1745940

Signature: t1:1745940:1418844368:cef5c9bf097ca2dd4169d502b5e51e8dd2f5d174
Adding async/SaslEndpoint.cpp to makefile

Summary:
as described
This currently breaks the proxygen open source build

Test Plan: contbuild

Reviewed By: davejwatson@fb.com

Subscribers: alandau, mshneer, bmatheny, ajitb

FB internal diff: D1746801

Tasks: 5851324

Signature: t1:1746801:1418859801:e8eba4672ff2671b1299841233876d8ab0e8d51b
remove Cpp2WorkerFactory

Summary:
In preparation for a global IOThreadPoolExecutor - we can't override the workerFactory if we are using a global one.

Instead, add a new getEventBases() to IOTHreadPoolExecutro and just run code on each eventBase.  For shutdown, explicitly add a stop(), instead of doing the work after loop() as exited

Cpp2Worker required minor changes to be able to use EventBaseManager's eventbase vs. their own

Test Plan: fbconfig -r thrift/lib/cpp2; fbmake runtests

Reviewed By: jsedgwick@fb.com

Subscribers: trunkagent, andrewcox, doug, fugalh, alandau, bmatheny, mshneer, folly-diffs@

FB internal diff: D1734795

Signature: t1:1734795:1418759367:b45f419e5cbc482a64a5873d9e00e3bcb071db5a
codemod: merge folly/wangle and folly/experimental/wangle

Summary:
Various TARGETS could definitely use some rearranging but I'd rather wait until we're cut over to the new repo

Test Plan: wait for contbuild

Reviewed By: davejwatson@fb.com

Subscribers: ptarjan, joelm, trunkagent, hphp-diffs@, ps, fbcode-common-diffs@, fugalh, alandau, bmatheny, everstore-dev@, mwa, jgehring, fuegen, mshneer, folly-diffs@, hannesr

FB internal diff: D1740858

Tasks: 5802833

Signature: t1:1740858:1418752569:4d7d9c5b955e4d9fab4b322cf08a3d285e3db7ce
Eliminate buffer allocation during decrypt

Summary:
Rediffing after this revert: D1745940. The revert got rid of two diffs, this particular one wasn't the cause of the issue. So there are no changes.

This eliminates one buffer copy during a decrypt. Unfortunately we're still doing a coalesce(). With some more coding that can probably be avoided, but it becomes a bit harder.

Basically gss_unwrap_iov interface can either accept a single contiguous token (we use this in the diff), or a broken up token. But that interface requires knowing the sizes of headers/padding, etc.

The perf win here is about 6% when running loadgen with 100kb messages.

Test Plan: loadgen, unittests

Reviewed By: alandau@fb.com

Subscribers: wstefancik, mshneer, bmatheny, alandau, hannesr, trunkagent

FB internal diff: D1748731

Signature: t1:1748731:1418932448:291870b1bcc753ee1eb37499655fe2b362e20c59
Bump version to 16:0