1046 Commits

Author SHA1 Message Date
Andrew Noyes
6446b4c082 WIP 2020-07-09 22:02:43 +00:00
Russell Sears
4ce51c4cce
Merge pull request #2768 from atn34/atn34/arena-cpp
Check for memory errors in arena-allocated memory
2020-07-06 09:43:28 -07:00
Andrew Noyes
42159ccfe0 Add -Wpessimizing-move and -Wredundant-move for clang 2020-06-22 23:45:03 +00:00
Andrew Noyes
10e094c6d7 Address review comments 2020-06-11 15:43:31 +00:00
Steve Atherton
bf072d68ec Workarounds for strange behaviors in Boost ssl sockets on MacOS and Linux. When writing to the ssl socket, write_some() would sometimes return BrokenPipe instead of WouldBlock unless onWriteable on the raw socket was checked first. On MacOS, even with the onWriteable check using a send size greater than 2016 (determined experimentally) would still result in the error. Also consolidated two identical copies of SendBufferIterator. 2020-06-04 01:44:05 -07:00
Andrew Noyes
e772f3a3f1 Separate knob to control valgrind arena instrumentation 2020-05-07 22:07:33 +00:00
Steve Atherton
32f4f013c2 Bug fix: HTTPS requests could hang. HTTP client was using stated contract for IConnection, which was different from the contract assumed by FlowTransport and implemented by SSLConnection. Updated HTTP client, added comments to IConnection to clarify the actual interface contract. 2020-04-24 17:59:32 -07:00
A.J. Beamon
90d29dd432
Merge pull request #2993 from alexmiller-apple/tls-permission-errors
Match 6.2.15's behavior in how invalid/unreadable/non-existent certs are handled.
2020-04-22 16:54:18 -07:00
A.J. Beamon
ed54913973
Merge pull request #2976 from atn34/atn34/thread-local
Prevent main thread from destroying flatbuffers globals
2020-04-22 14:36:51 -07:00
A.J. Beamon
58fbd0e3a1
Merge pull request #2980 from alexmiller-apple/tls-background-eio-thread
Stop background eio threads on Net2::stop()
2020-04-22 08:17:59 -07:00
Alex Miller
c6df20a179
Use nullptr instead of NULL 2020-04-21 20:39:45 -07:00
Alex Miller
a51746b307 Match 6.2.15's behavior in how invalid/unreadable/non-existent certs are handled.
Which is to proceed past Net2 creation, and allow certificate refresh to
try and eventually load valid certs.  Additionally, fix certificate
refeshing dieing if the certificate is not readable when first called.

In testing, I also found and fixed an issue where if a cert went from
unreadable to readable, we wouldn't reload the TLS context, due to not
considering it as a file change.
2020-04-20 21:38:04 -07:00
Alex Miller
20fe068863 Merge branch 'tls-background-eio-thread' into tls-permission-errors 2020-04-20 20:51:05 -07:00
Xin Dong
49c6bb90ef
Merge pull request #2982 from alexmiller-apple/tls-log-settings
Log Net2TLSConfig with paths and settings when using TLS.
2020-04-20 15:46:26 -07:00
Alex Miller
75a4f3b7c9 Remove comment about ignoring runOnMainThread errors.
If we got an exception, it wouldn't be of type `Error` anyway, so
it seems like things would crash regardless.
2020-04-20 13:19:42 -07:00
Alex Miller
da8e47ea25 Merge remote-tracking branch 'upstream/release-6.2' into tls-background-eio-thread 2020-04-20 13:15:05 -07:00
Alex Miller
5c399bf725 Move the callbacks into ::run() right before it exits.
stopped=true doesn't cause the run loop to immediately exit.
2020-04-20 13:14:19 -07:00
A.J. Beamon
c28a843251
Merge pull request #2977 from alexmiller-apple/tls-no-atexit
Fix clients crashing in TLS code on exit.
2020-04-20 08:40:16 -07:00
Alex Miller
2ce539ef6d Respect flow<->fdbrpc module boundaries.
Which fixes a compilation error due to a circular dependency between
flow.a and fdbrpc.a.  However, this is now done at the cost of newNet2
users have to remember to add Net2FileSystem::stop() as a callback.
2020-04-20 02:53:07 -07:00
Alex Miller
cbb6ffb431 Only log OpenSSL error strings for OpenSSL errors.
Normal "connection refused" messages would show up with a long verbose
string that doesn't really provide any useful information otherwise.
2020-04-18 20:39:02 -07:00
Alex Miller
11eebc4a48 Log Net2TLSConfig with paths and settings when using TLS.
There were similar TraceEvents in the FDBLibTLS/LibreSSL TLS
implementaiton that were accidentally dropped in the TLS rewrite.

This makes it so that one does not have to use magic to figure out if a
process was configued with TLS correctly when some of the settings come
from environment variables.
2020-04-18 20:21:10 -07:00
Alex Miller
1398e9a82e Stop background eio threads on Net2::stop().
This will stop eio threads for both the client (`fdb_stop_network()`)
and the server.  This change is being done more for the former, but I
don't see any harm in doing the latter as well.
2020-04-18 19:40:55 -07:00
Alex Miller
94b4f78ea9 Fix clients crashing in TLS code on exit.
If client code initiates an FDB operation to a TLS cluster, and then
immediately exits the main thread, then OpenSSL's atexit handler would
potentially run while the network thread is attempting to do TLS
operations, and thus crash.

This commit removes the OpenSSL atexit hander, and instead relies on a
client intentionally ending the network thread to do TLS cleanup.  If
the client code exits without stopping the network thread, then we'll
never free OpenSSL data structures, which is the safer thing to do.
2020-04-18 15:48:02 -07:00
Andrew Noyes
cb6389d42d Prevent main thread from destroying flatbuffers globals
We recently witnessed (using tsan) the main thread exiting without first
joining the network thread, and this caused data races and
heap-use-after-free's

Now the lifetime of these globals will be tied to the network thread
itself (and I guess every thread, but the one that actually uses memory
will be owned by the network thread.)
2020-04-17 23:34:28 +00:00
A.J. Beamon
903128a36f Fix boost error trace event fields to match other trace events by the same name. 2020-04-01 08:18:50 -07:00
Andrew Noyes
c0bae64105 Use sigaction, _exit if anything fails 2020-03-20 12:50:31 -07:00
Andrew Noyes
bed5d4733a Fix syntax 2020-03-18 11:00:02 -07:00
Andrew Noyes
0d4f49f02f Run default signal handler after custom signal handler 2020-03-18 10:54:47 -07:00
Evan Tschannen
787a5caaca
Merge pull request #2805 from ajbeamon/localized-allocation-trace-depth
Don't disallow allocation tracking when a trace event is open
2020-03-16 16:21:09 -07:00
Steve Atherton
c7a9d184f0
Merge pull request #2790 from tclinken/ignore-create-directory-errors
Ignore createDirectory error if directory already exists
2020-03-16 16:13:47 -07:00
Evan Tschannen
c197520fa7
Merge pull request #2810 from alexmiller-apple/fdbcli-tlsinfo
Add a `tlsinfo` command to fdbcli that prints the certificate chain.
2020-03-16 15:47:32 -07:00
A.J. Beamon
f1523bd472 Setting the network thread more than once is a no-op 2020-03-16 15:37:06 -07:00
A.J. Beamon
96187618a0 Fix condition to check whether allocation tracing is enabled 2020-03-16 15:12:50 -07:00
Evan Tschannen
ed4d02a3e4
Merge pull request #2812 from etschannen/feature-proxy-mem-limit
Limit the amount of requests the proxy can queue up in memory
2020-03-16 14:56:56 -07:00
A.J. Beamon
7769218303 Move an increment after an ASSERT. 2020-03-16 14:11:07 -07:00
A.J. Beamon
d8cfabe73b Extend the allocation tracing disabling flag to cover more parts of trace logging as a precaution. Make it possible to disable via knob. 2020-03-16 13:59:31 -07:00
A.J. Beamon
ee3cde0b0d
Merge pull request #2815 from etschannen/feature-timeout-tlog-create
Treat a tlog which takes a long time to create its disk queue as failed
2020-03-16 12:49:33 -07:00
Alex Miller
72326fe8af Fix the build. 2020-03-16 12:46:13 -07:00
Alex Miller
db5863145a Merge remote-tracking branch 'upstream/release-6.2' into fdbcli-tlsinfo 2020-03-16 12:33:50 -07:00
Evan Tschannen
a068d4063f renamed ProxyGetConsistentReadVersion 2020-03-16 12:11:32 -07:00
Evan Tschannen
77dde00da7
Merge pull request #2818 from ajbeamon/increase-metrics-priority
Increase priority of the logging of various metrics trace events
2020-03-16 11:57:37 -07:00
Evan Tschannen
ea98c7a40a added additional timeout on initPersistentState 2020-03-16 11:38:14 -07:00
A.J. Beamon
5f4373c200
Merge pull request #2811 from alexmiller-apple/tls-failures-status
Add TLS Policy Failure count to ProcessMetrics and status json
2020-03-16 11:11:30 -07:00
A.J. Beamon
031b579ede Increase priority of the logging of various metrics trace events. 2020-03-13 16:20:23 -07:00
Alex Miller
a5568b2fc6 Rewrite tlsinfo into --debug-tls, and print out configuration. 2020-03-13 15:46:03 -07:00
Evan Tschannen
243c268d9d Limit the amount of requests the proxy can queue up in memory 2020-03-13 10:17:49 -07:00
Alex Miller
04498cbc0e Make policy failures be reported as per 1s and not over 5s. 2020-03-13 02:49:06 -07:00
Alex Miller
75e2fffe5a Add a ProcessMetrics.TLSPolicyFailures metric
This reports the number of policy failures over the past 5s interval.
It also is step 1 towards getting this information into status json.
2020-03-13 02:24:37 -07:00
Alex Miller
0c558efcfe Add a tlsinfo command to fdbcli that prints the certificate chain.
This requires the certificate chain to load successfully, otherwise
fdbcli will error out at an earlier point due to Net2 not being able to
configure TLS.
2020-03-13 00:11:53 -07:00
A.J. Beamon
2466749648 Don't disallow allocation tracking when a trace event is open because we now have state trace events. Instead, only block allocation tracking while we are in the middle of allocation tracking already to prevent recursion. 2020-03-12 11:17:49 -07:00