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