Commit Graph

7 Commits

Author SHA1 Message Date
Adam Simpkins
aa5e6c7295 update license headers in C++ files
Summary:
Update the copyright & license headers in C++ files to reflect the
relicensing to GPLv2

Reviewed By: wez

Differential Revision: D15487078

fbshipit-source-id: 19f24c933a64ecad0d3a692d0f8d2a38b4194b1d
2019-06-19 17:02:45 -07:00
Adam Simpkins
1f2523ce3b increase the default send timeout on UnixSocket
Summary:
Increase the default send timeout from 100ms to 250ms.
Increse the timeout in the `UnixSocket.sendDataAndFiles` test to 10s.

We have seen some failures in the `UnixSocket.sendDataAndFiles()` test on
our continuous build infrastructure when testing debug builds on Mac OS.
These failed due to hitting the send timeout on the 4MB and 32MB sends.  Bump
up the timeout for this test to 10s.  (I initially tried 250ms, and this was
still not sufficient.)

I increased the default send timeout to 250ms just to help ensure that we
don't hit it unexpectedly during real production code when running on Mac OS.

Reviewed By: wez

Differential Revision: D15401154

fbshipit-source-id: c8be68a77231e90d37c9b5b4f349379bdf2b15ed
2019-05-20 11:49:24 -07:00
Adam Simpkins
163d92d617 add attachEventBase()/detachEventBase() to UnixSocket
Summary:
Add methods to UnixSocket and FutureUnixSocket to attach and detach from an
EventBase.  This makes it possible to construct a UnixSocket object without
having an EventBase yet and then attach it to an EventBase later.

Reviewed By: bolinfest

Differential Revision: D8053423

fbshipit-source-id: c4de00166dbc0e075b4e4cd81c3dd5b377ea9a52
2018-05-23 11:51:59 -07:00
Chad Austin
865f938cf4 bump maximum UnixSocket message size
Summary:
The takeover data for a fully-loaded monorepo was 20 MB.  Two
monorepos was 40 MB, exceeding the previous 32 MiB limit and causing
takeover to fail.  Bump to 512 MiB to minimize the chance of
allocating too much given bogus data while still supporting large
numbers of checkouts.

Reviewed By: simpkins

Differential Revision: D7661637

fbshipit-source-id: 1dc54055e7ac3ce0f6cdbf4a7e5d372c2674dfee
2018-04-18 11:53:01 -07:00
Chad Austin
75b32848c6 refactor UnixSocket in prep for iovec limits
Summary:
UnixSocket traverses the IOBuf chain twice.  Refactor that
into a common function because the next diff caps the size of
individual iovecs.

Reviewed By: simpkins

Differential Revision: D7659062

fbshipit-source-id: 88b7d63669d8189b96434c38a6e499ed3b5ebbe6
2018-04-18 11:31:02 -07:00
Adam Simpkins
9bd173054b fix incorrect deallocation size in UnixSocket::SendQueueDestructor
Summary:
In some cases we could call `delete` with the wrong size in
`UnixSocket::SendQueueDestructor` when `__cpp_sized_deallocation` is available.

In particular, if the input message data contained some empty buffers in the
IOBuf chain we would allocate room for these elements when initially performing
the allocation in `createSendQueueEntry()`, but we would skip over them in the
`SendQueueEntry` constructor, so `iovCount` did not include them.  The
`SendQueueDestructor` code used `iovCount` to calculate how much space had been
allocated, and so it would undercount the amount of allocated space in this
case.

This updates `createSendQueueEntry()` to also avoid allocating an iovec entry
for the empty buffers, so that `iovCount` should always accurately reflect how
many entries were originally allocated.

Reviewed By: chadaustin

Differential Revision: D7190579

fbshipit-source-id: 422cc737f146adeb1c133b9f3b500038e05bad10
2018-03-08 17:45:57 -08:00
Adam Simpkins
db1f93b2aa add new UnixSocket and UnixSocketFuture helper classes
Summary:
Add new classes that help send data, file descriptors, and credential
information over unix domain sockets.

UnixSocket provides a low-level, raw callback API, similar to that provided by
the classes in folly/io/async/.  UnixSocketFuture is a slightly higher-level
wrapper class that provides a Future-based API on top of this.  I expect that
most places in eden will probably use the UnixSocketFuture API, but callers
that repeatedly wait for new messages (like the privhelper server) may want to
use the raw callback API instead.

This will help simplify several places in eden that communicate over unix
domain sockets.  Both the privhelper code and the takeover code needs to send
file descriptors over unix domain sockets.  They currently each use their own
separate message handling logic for this.  We currently communicate with the
hg_import_helper.py script over a pipe, but this could easily be switched to
use this new UnixSocket class as well.

Reviewed By: wez

Differential Revision: D6494981

fbshipit-source-id: 80bd7f06e5b884fc4148162e1a8a3b478acce209
2018-01-05 13:35:46 -08:00