Latest commit c80831a Dec 10, 2016 @nbronson nbronson committed with Facebook Github Bot folly/io/async/tests: always detach event base in tests, fixes UBSAN …
…tests

Summary:
In AsyncSSLSocket tests the shared_ptr structure means that the
AsyncSSLSocket-s outlive the stack-allocated EventBase on which they were
created.  Previously there were scattered calls to detachEventBase on the
last interesting callback, but several calls were missing.  This diff
switches to a model where the SSLServerAcceptCallbackBase is responsible
for detaching the sockets.

This diff also fixes a low-firing race between shutdown
of the TestSSLAsyncCacheServer Main thread and a call to
EmptyReadCallback::readEOF.  Most uses of EmptyReadCallback don't attach
the TCP socket, so they can't actually tolerate a call to readError
or readEOF.

These use-after-destruction problems were discovered by UBSAN.

Reviewed By: djwatson

Differential Revision: D4301416

fbshipit-source-id: 127fb5e506d0694c5ca81d7a38c704d69f4ab3eb
Permalink
..
Failed to load latest commit information.
build fix bootstrap on osx Nov 28, 2016
detail Begin making folly compile cleanly with a few of MSVC's sign mismatch… Dec 2, 2016
docs Fix Synchronized.md documentation to use correct condition_variable::… Dec 7, 2016
experimental Enable -Wextra-semi Dec 9, 2016
fibers Enable -Wextra-semi Dec 9, 2016
futures Enable -Wextra-semi Dec 9, 2016
gen Enable -Wextra-semi Dec 9, 2016
init Don't try to install the failure signal handler in folly::init on Win… Nov 9, 2016
io folly/io/async/tests: always detach event base in tests, fixes UBSAN … Dec 9, 2016
m4 Fix BoostContextCompatibility for boost >= 1.61 Nov 1, 2016
portability USE_JEMALLOC in the OSS build if we have jemalloc Dec 7, 2016
ssl Enable -Wextra-semi Dec 9, 2016
stats Begin making folly compile cleanly with a few of MSVC's sign mismatch… Dec 2, 2016
test Enable -Wextra-semi Dec 9, 2016
tracing Add USDT header file to folly Nov 23, 2016
ApplyTuple.h Fix applyTuple to work under MSVC again Aug 15, 2016
Arena-inl.h folly copyright 2015 -> copyright 2016 Feb 12, 2016
Arena.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
Array.h Fix Build: folly with -Wmissing-braces Nov 18, 2016
Assume.cpp Remove the glog header include from Assume.h Aug 1, 2016
Assume.h Remove the glog header include from Assume.h Aug 1, 2016
AtomicBitSet.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
AtomicHashArray-inl.h Allow const mapped types in folly::AtomicHash(Array|Map) Jun 9, 2016
AtomicHashArray.h Fix a couple comments Sep 22, 2016
AtomicHashMap-inl.h folly copyright 2015 -> copyright 2016 Feb 12, 2016
AtomicHashMap.h Fix a couple comments Sep 22, 2016
AtomicIntrusiveLinkedList.h Don't attempt to implicitly convert an atomic<T> to bool May 4, 2016
AtomicLinkedList.h Non-intrusive AtomicLinkedList Apr 16, 2016
AtomicStruct.h Allow constexpr construction of AtomicStruct under MSVC Jun 4, 2016
AtomicUnorderedMap.h Switch uses of <unistd.h> to <folly/portability/Unistd.h> May 30, 2016
Baton.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
Benchmark.cpp Make bm_min_iters a 32-bit flag Dec 6, 2016
Benchmark.h force read for doNotOptimizeAway(*ptr_to_small_trivial) Nov 18, 2016
Bits.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
Bits.h prevPowTwo / faster bit operations Oct 25, 2016
CPortability.h folly/portability: move some macro definitions to `CPortability.h` Nov 18, 2016
CachelinePadded.h Add CachelinePadded<T> to folly. Aug 26, 2016
CallOnce.h Add call_once, wrapper around std::call_once with a fast path Feb 17, 2016
Checksum.cpp Use the standard intrinsics for crc32c Jun 16, 2016
Checksum.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
ClockGettimeWrappers.cpp Wrappers folly::chrono::clock_gettime and clock_gettime_ns Jul 19, 2016
ClockGettimeWrappers.h Wrappers folly::chrono::clock_gettime and clock_gettime_ns Jul 19, 2016
ConcurrentSkipList-inl.h Get ConcurrentSkipList functional Dec 3, 2016
ConcurrentSkipList.h Enable -Wextra-semi Dec 9, 2016
ContainerTraits.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
Conv.cpp Start fixing implicit truncations Nov 30, 2016
Conv.h Begin making folly compile cleanly with a few of MSVC's sign mismatch… Dec 2, 2016
CppAttributes.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
CpuId.h Avoid external linkage call inside __ifunc__ Sep 23, 2016
Demangle.cpp Limit symbol length in demangle() Jul 29, 2016
Demangle.h folly copyright 2015 -> copyright 2016 Feb 12, 2016
DiscriminatedPtr.h Added DiscriminatedPtr support to arm64 Aug 3, 2016
DynamicConverter.h Use std::string in folly::dynamic Apr 26, 2016
Enumerate.h Add support in enumerate() for iterators with exotic pointers Oct 12, 2016
EvictingCacheMap.h Add EvictingCacheMap MoveConstructor Dec 7, 2016
Exception.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
ExceptionString.h Get rid of circular dependency when including ExceptionWrapper.h from… Jun 10, 2016
ExceptionWrapper.cpp folly: ExceptionWrapper: remove <iostream> from header Nov 17, 2016
ExceptionWrapper.h folly: ExceptionWrapper: remove <iostream> from header Nov 17, 2016
Executor.cpp Cut some includes from Executor.h Dec 7, 2016
Executor.h Cut some includes from Executor.h Dec 7, 2016
Expected.h fix Expected<..., eUnion> move / copy ctor Oct 25, 2016
FBString.h Reverted commit D3927397 Oct 21, 2016
FBVector.h folly: fbvector: ubsan: avoid memset(nullptr, 0, 0) Nov 16, 2016
File.cpp Switch uses of <unistd.h> to <folly/portability/Unistd.h> May 30, 2016
File.h Switch uses of <unistd.h> to <folly/portability/Unistd.h> May 30, 2016
FileUtil.cpp add a new writeFileAtomic() function Dec 1, 2016
FileUtil.h add a new writeFileAtomic() function Dec 1, 2016
Fingerprint.h Don't declare the extern FingerprintTable specializations under MSVC Nov 1, 2016
FixedString.h add folly::FixedString, a constexpr-usable string with a fixed-size i… Dec 7, 2016
Foreach.h folly/Foreach.h: fix FOR_EACH_R and FOR_EACH_KV to avoid shadowing wa… Nov 11, 2016
Format-inl.h Don't pass the single quote format parameter when formatting things Aug 25, 2016
Format.cpp Start compiling a bit of `-Wshadow` Apr 6, 2016
Format.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
FormatArg.h Mark FormatArg::error as noreturn Aug 10, 2016
FormatTraits.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
Function.h add folly::Function::asSharedProxy Oct 24, 2016
GroupVarint.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
GroupVarint.h Enable GroupVarint on Arm64 Jul 14, 2016
Hash.h fix bug for negative shift value Jun 24, 2016
IPAddress.cpp Start fixing implicit truncations Nov 30, 2016
IPAddress.h Move IPAddress definitions to source files Jul 9, 2016
IPAddressException.h Move IPAddress definitions to source files Jul 9, 2016
IPAddressV4.cpp Move IPAddress definitions to source files Jul 9, 2016
IPAddressV4.h Move IPAddress definitions to source files Jul 9, 2016
IPAddressV6.cpp Move IPAddress definitions to source files Jul 9, 2016
IPAddressV6.h Move IPAddress definitions to source files Jul 9, 2016
Indestructible.h Get MSVC able to construct an Indestructible Jul 26, 2016
IndexedMemPool.h Switch uses of <unistd.h> to <folly/portability/Unistd.h> May 30, 2016
IntrusiveList.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
Lazy.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
LifoSem.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
LifoSem.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
Likely.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
LockTraits.h Adding policies for all the upgrade and downgrade mutex transitions t… Aug 5, 2016
LockTraitsBoost.h Adding support for upgradable mutexes to LockTraits Aug 5, 2016
Logging.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
MPMCPipeline.h folly copyright 2015 -> copyright 2016 Feb 12, 2016
MPMCQueue.h When you read from a default-constructed MPMCQueue, assert instead of… Nov 12, 2016
MacAddress.cpp More iostream removal. Dec 6, 2016
MacAddress.h Move IPAddress definitions to source files Jul 9, 2016
Makefile.am Cut some includes from Executor.h Dec 7, 2016
MallctlHelper.cpp Add helper functions for mallctl Jul 24, 2016
MallctlHelper.h Add helper functions for mallctl Jul 24, 2016
Malloc.h folly: fixes for use with `-fvisibility-inlines-hidden` Oct 18, 2016
MapUtil.h prvalues from get_ref_default()'s default functor Sep 8, 2016
Math.h integer division with controlled rounding in Math.h Sep 7, 2016
Memory.h Kill unneeded dependency on portability/Memory.h Sep 15, 2016
MemoryMapping.cpp Begin making folly compile cleanly with a few of MSVC's sign mismatch… Dec 2, 2016
MemoryMapping.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
Merge.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
MicroLock.cpp Additional changes to MicroLock Aug 12, 2016
MicroLock.h Additional changes to MicroLock Aug 12, 2016
MicroSpinLock.h Assert that MicroSpinLock is a POD type Jun 1, 2016
MoveWrapper.h folly copyright 2015 -> copyright 2016 Feb 12, 2016
Optional.h Silence a couple of warnings for MSVC in Optional.h Nov 1, 2016
PackedSyncPtr.h Pack PackedSyncPtr Jun 8, 2016
Padded.h Don't use ?: Jul 22, 2016
Partial.h Fix folly::Partial copy/move construction Oct 2, 2016
PicoSpinLock.h Fix a typo in PicoSpinLock Aug 3, 2016
Portability.h Don't attempt to separately close the underlying file descriptor in t… Nov 19, 2016
Preprocessor.h Update FB_ONE_OR_NONE in Preproc.h to work with MSVC Jul 22, 2016
ProducerConsumerQueue.h Fix test/ProducerConsumerQueueTest.cpp build break May 28, 2016
RWSpinLock.h update Synchronized to use LockTraits Jul 6, 2016
Random-inl.h Correctly deduce RNG type in folly::Random Apr 15, 2016
Random.cpp Use SingletonThreadLocal in folly::Random Dec 1, 2016
Random.h Use SingletonThreadLocal in folly::Random Dec 1, 2016
Range.h Enable -Wextra-semi Dec 9, 2016
SafeAssert.cpp Let FOLLY_SAFE_DCHECK be erased by the optimizer in release builds Aug 15, 2016
SafeAssert.h Let FOLLY_SAFE_DCHECK be erased by the optimizer in release builds Aug 15, 2016
ScopeGuard.cpp Explain crash when exception is thrown from Scope Guard Nov 18, 2016
ScopeGuard.h Use std::terminate rather than throwing in a noexcept function Nov 29, 2016
SharedMutex.cpp folly: fix clang's -Wundefined-var-template Jun 25, 2016
SharedMutex.h Set a default value for slot in SharedMutex.h Sep 28, 2016
Shell.cpp move `shellQuote` to implementation file Sep 16, 2016
Shell.h move `shellQuote` to implementation file Sep 16, 2016
Singleton-inl.h Disallow folly::Singletons before main() Nov 29, 2016
Singleton.cpp Disallow folly::Singletons before main() Nov 29, 2016
Singleton.h Disallow folly::Singletons before main() Nov 29, 2016
SingletonStackTrace.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
SingletonThreadLocal.h Fix SingletonThreadLocal Feb 29, 2016
SingletonVault_c.cpp SingletonVault_c.cpp is always C++ Jun 1, 2016
SingletonVault_c.h folly copyright 2015 -> copyright 2016 Feb 12, 2016
SmallLocks.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
SocketAddress.cpp Start fixing implicit truncations Nov 30, 2016
SocketAddress.h Expose isFamilyInet() to check if SocketAddress is a valid ipv4 or ipv6 Nov 9, 2016
SparseByteSet.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
SpinLock.h update Synchronized to use LockTraits Jul 6, 2016
SpookyHashV1.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
SpookyHashV1.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
SpookyHashV2.cpp Make Bits.h respect FOLLY_HAVE_UNALIGNED_ACCESS. Mar 9, 2016
SpookyHashV2.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
String-inl.h Faster unhexlify Nov 18, 2016
String.cpp Begin making folly compile cleanly with a few of MSVC's sign mismatch… Dec 2, 2016
String.h Add missing include Oct 13, 2016
StringBase.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
Subprocess.cpp escape `{` in cmd for deprecated `Substring(std::string...)` Sep 16, 2016
Subprocess.h Rename stdin, etc. in Subprocess to work with MSVC Dec 7, 2016
Synchronized.h Don't shadow locals, parameters or fields Dec 9, 2016
ThreadCachedArena.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
ThreadCachedArena.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
ThreadCachedInt.h fix race between StaticMetaBase::destroy() and StaticMetaBase::onThre… Nov 2, 2016
ThreadId.h Add folly::getCurrentThreadID() Nov 17, 2016
ThreadLocal.h Fix ThreadCachedInt race condition Sep 29, 2016
ThreadName.h folly: improve setThreadName for macOS Jul 18, 2016
TimeoutQueue.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
TimeoutQueue.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
TokenBucket.h Fix CLANG compilation: folly/TokenBucket.h Nov 1, 2016
Traits.h Begin making folly compile cleanly with a few of MSVC's sign mismatch… Dec 2, 2016
Try-inl.h Provide a unpackTryTuple function in folly Oct 13, 2016
Try.h Provide a unpackTryTuple function in folly Oct 13, 2016
Unicode.cpp Use std::string in folly::dynamic Apr 26, 2016
Unicode.h Use std::string in folly::dynamic Apr 26, 2016
Unit.h Use structs rather than type aliases for Unit::Lift and Unit::Drop Nov 19, 2016
Uri-inl.h folly copyright 2015 -> copyright 2016 Feb 12, 2016
Uri.cpp Start fixing implicit truncations Nov 30, 2016
Uri.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
VERSION Bump version to 57:0 Aug 31, 2015
Varint.h Add unchecked versions of advance(), subtract(), and subpiece() in Range Sep 28, 2016
Version.cpp folly copyright 2015 -> copyright 2016 Feb 12, 2016
VersionCheck.h folly: replace old-style header guards with "pragma once" Apr 1, 2016
configure.ac USE_JEMALLOC in the OSS build if we have jemalloc Dec 7, 2016
dynamic-inl.h Add default constructor to dynamic, make other constructors simpler a… Oct 26, 2016
dynamic.cpp folly: use std::__throw_out_of_range Sep 30, 2016
dynamic.h Add default constructor to dynamic, make other constructors simpler a… Oct 26, 2016
json.cpp Start fixing implicit truncations Nov 30, 2016
json.h Add recursion limit to folly::parseJson. Apr 27, 2016
libfolly.pc.in Generate a pkg-config file for Folly Jul 19, 2016
memcpy.S folly copyright 2015 -> copyright 2016 Feb 12, 2016
small_vector.h folly: use std::__throw_out_of_range Sep 30, 2016
sorted_vector_types.h Fix sorted_vector_set::erase Dec 9, 2016
stop_watch.h add tryReadUntil and make fixes along the way Nov 8, 2016