1. 13 Oct, 2021 1 commit
    • Misha Shneerson's avatar
      Capture correct TID passed to deadlock detector · 7d707de4
      Misha Shneerson authored
      Summary:
      we are currently capture the ID of the thread that is spawning IO threads, not
      the ids of the IO threads themselves. Fix it.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31577084
      
      fbshipit-source-id: 869f9ad20ad379327db513501392bd6bc1ced7e8
      7d707de4
  2. 12 Oct, 2021 2 commits
    • Alan Frindell's avatar
      Fix readable in Async*Socket · f704135e
      Alan Frindell authored
      Summary: I'm not sure this API is actually used anywhere, but the implementations don't account for cases where the underlying socket is unreadable but setting a read callback would immediately provide data.
      
      Reviewed By: simpkins
      
      Differential Revision: D25324200
      
      fbshipit-source-id: 4176432feea09a4d1387b9025f485e537a5b8da5
      f704135e
    • Shai Szulanski's avatar
      Use fold expression in CancellationToken::merge · e3f57750
      Shai Szulanski authored
      Summary: Avoids temporary array
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31547083
      
      fbshipit-source-id: e8c8246145428079a00999da7b3d2c4f59105300
      e3f57750
  3. 08 Oct, 2021 3 commits
    • Fred Qiu's avatar
      Parse and capture client alpns from client hello info · c47d0c77
      Fred Qiu authored
      Summary:
      Add code to capture client alpns from client hello packet and store them in
      ssl socket object for later logging.
      
      Reviewed By: AjanthanAsogamoorthy
      
      Differential Revision: D31176714
      
      fbshipit-source-id: 888fd9949ede5209234bb3ab1959a6f9c14043b2
      c47d0c77
    • Misha Shneerson's avatar
      fix deadlock folly::RequestContext::try_get() · dfe13560
      Misha Shneerson authored
      Summary:
      `folly::RequestContext::try_get()` might deadlock if accessor to all threads is
      held alive.
      
      Reviewed By: amlannayak
      
      Differential Revision: D31496646
      
      fbshipit-source-id: 6edfd0a54f8bfaf72218d78ba1a6c09dc92a8e63
      dfe13560
    • Andrew Smith's avatar
      Remove custom equality/hash function for ChannelBridge · c3bb66ae
      Andrew Smith authored
      Summary:
      Currently, both Merge and MergeChannel use a folly::F14FastSet of channel bridge unique pointers. In order to look up items inside this hash set by raw pointer, a custom equality and hash function are provided. These functions just check for equality of the underlying raw pointers (and run std::hash on the raw pointers).
      
      This has turned into a large performance bottleneck. For some reason, folly::F14FastSet's performance tanks when using custom equality/hash functions. The performance seems to get worse as more items are added. In tests I was running, a single lookup took over 5ms with a set of 200k items.
      
      This diff removes the custom equality/hash functions for ChannelBridge. Merge and MergeChannel are changed to use hash sets of raw pointers. Lifetime is managed outside of the F14FastSet (by explicitly deleting the raw pointers after items are removed from the set).
      
      Reviewed By: aary
      
      Differential Revision: D31426627
      
      fbshipit-source-id: 1ce7fd1b431704f6353b9ea3d689cee002dd9bdc
      c3bb66ae
  4. 07 Oct, 2021 2 commits
    • Mingtao Yang's avatar
      portability/OpenSSL: Don't assume 1.1.1 implies blake2 availability · 24759fc8
      Mingtao Yang authored
      Reviewed By: yfeldblum
      
      Differential Revision: D31414552
      
      fbshipit-source-id: 0a814de998d88950f5e6e61c23b20f40c2eb0a37
      24759fc8
    • Kenny Yu's avatar
      ensure next stack frame address is valid when walking async stacks · cb895545
      Kenny Yu authored
      Summary:
      We have cases where the C++ -> Lua calls are not properly following the calling convention and the pointer to the previous normal stack frame is not correctly pushed after the lua call. This results in segfaults when we try to walk the normal stack.
      
      Stack frame addresses for the normal stack frames should always be increasing. A simple fix is check whether the next stack frame address <= starting stack frame address. If it is, this indicates the end fo the stack (nullptr) or likely stack corruption, as in the case above.
      
      This means that we might miss out on the stack frames right before the stack frame that breaks the calling convention, but we should correctly get the rest of the async stack trace before this frame, and the stack frames after this frame.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D30907903
      
      fbshipit-source-id: 7d78b53570fd24dbb23b4fc49afa995d44c9e549
      cb895545
  5. 06 Oct, 2021 5 commits
    • Emanuele Altieri's avatar
      Fix flaky unit test for ThreadPoolExecutor CPU counter · e6c19c13
      Emanuele Altieri authored
      Summary:
      Using a per-thread CPU clock when burning CPU time (instead of the system
      clock), so measurements should be accurate independently of the load on the
      system.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31436995
      
      fbshipit-source-id: 3e732e2f4d2c04846dcafef32b00a87617c940b8
      e6c19c13
    • Yedidya Feldblum's avatar
      fix MSVC C5219 in to_ascii · 4bd3e4e0
      Yedidya Feldblum authored
      Summary:
      Fixes the following warning:
      
      ```
      folly/lang/ToAscii.h(224): warning C5219: implicit conversion from 'T' to 'double', possible loss of data
              with
              [
                  T=size_t
              ]
      folly/lang/ToAscii.h(236): note: see reference to function template instantiation 'size_t folly::detail::to_ascii_size_clzll<10>(uint64_t)' being compiled
      folly/lang/ToAscii.h(349): note: see reference to function template instantiation 'size_t folly::detail::to_ascii_size_route<10>(uint64_t)' being compiled
      folly/lang/ToAscii.h(358): note: see reference to function template instantiation 'size_t folly::to_ascii_size<10>(uint64_t)' being compiled
      ```
      
      Reviewed By: luciang
      
      Differential Revision: D31314625
      
      fbshipit-source-id: b32a566b67d2f04225b59ee682931d5f8d9ede1e
      4bd3e4e0
    • Orvid King's avatar
      Support libdwarf prior to 5 · 4dbcd7ba
      Orvid King authored
      Summary:
      Not all systems have a libdwarf that supports dwarf 5. We only need a single tag from it, so just define it when needed.
      Fixes: https://github.com/facebook/folly/issues/1654
      
      Reviewed By: luciang
      
      Differential Revision: D31423305
      
      fbshipit-source-id: 89fecccb5ac68830a33b1fad51210cbaa9754bf8
      4dbcd7ba
    • Andrew Huang's avatar
      Add TLS 1.3 ciphersuites to SSLCommonOptions and SSLServerOptions · c15766d0
      Andrew Huang authored
      Reviewed By: AjanthanAsogamoorthy
      
      Differential Revision: D31399112
      
      fbshipit-source-id: ea98963536de42136642809d2bd07b9567464f68
      c15766d0
    • Giuseppe Ottaviano's avatar
      Add IOBuf convenience methods to convert to std::string · a79234f0
      Giuseppe Ottaviano authored
      Summary:
      Getting an `std::string` out of the data in a `IOBuf` chain is a common operation in tests, logging, and at interface boundaries. Currently there isn't an easy way to do it, so either the same boilerplate is replicated everywhere, or people resort to `coalesce().str()`, which is inefficient (it can end up copying the data twice) and non-`const`.
      
      Add methods to append and convert to any char container, like `string`, `fbstring`, `vector<char>`, ...
      
      Reviewed By: philippv
      
      Differential Revision: D31385345
      
      fbshipit-source-id: 8a331771786f7bf1043b59d5c36ac4051e442531
      a79234f0
  6. 05 Oct, 2021 1 commit
    • Saar Gross's avatar
      Further changes to support building over XROS · 45082113
      Saar Gross authored
      Summary: Include the xr_socket compatibility header in multiple places in folly (net_net_ops, network_address etc.) to have these parts of folly build-able over XROS
      
      Reviewed By: yfeldblum, luciang
      
      Differential Revision: D31057430
      
      fbshipit-source-id: 2aceaa1c1c50da2b1a6a1aa9d401df050d68cef1
      45082113
  7. 02 Oct, 2021 2 commits
    • Yedidya Feldblum's avatar
      unique_lock_guard, shared_lock_guard · 5b38d6fa
      Yedidya Feldblum authored
      Reviewed By: iahs
      
      Differential Revision: D31183931
      
      fbshipit-source-id: e97fcc99bbe6271def731916321eaf081d82d942
      5b38d6fa
    • Saar Gross's avatar
      Minor fixes for supporting a build of network_address over XROS · 6e0b7ffe
      Saar Gross authored
      Summary:
      1. sockaddr, sockaddr_in and sockaddr_in6 are all the same at XROS, so we should have only one version of setFromSockaddr() when running over XROS
      2. Since AF_UNIX is not really a supported address family on XROS, add a cast to (int) when checking the family. This will suppress a compilation warning
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31057427
      
      fbshipit-source-id: ef5af0aed6800c9beadfbb217795416afab9e08c
      6e0b7ffe
  8. 01 Oct, 2021 6 commits
  9. 30 Sep, 2021 5 commits
    • Emanuele Altieri's avatar
      Expose total CPU time used by a ThreadPoolExecutor · 57de05c8
      Emanuele Altieri authored
      Summary: New method to return the cumulative CPU time consumed by the pool. Requires support for per-thread CPU clocks.
      
      Reviewed By: yfeldblum, iahs
      
      Differential Revision: D30685002
      
      fbshipit-source-id: ac103e581585832bcda245e8f034bbc71489c831
      57de05c8
    • Cameron Pickett's avatar
      Do not swallow child exceptions on cancellation · 118a3923
      Cameron Pickett authored
      Summary:
      Aligns `collectAll` and `collectAny` behaviour and simplifies the logic for propagating child exceptions on cancellation.
      
      Prior to this change, we were conditionally setting `firstException` dependent on whether cancellation was requested or not. Additionally, `collectAny` was unconditionally returning `co_cancelled` even if all the child tasks completed successfully.
      
      Now, the behaviour is consistent between general errors and cancellation: If any child task completes in error (including folly::OperationCancelled), then the parent `collectAll`/`collectAny` will propagate that failure. Otherwise, if no child fails, then `collectAll`/`collectAny` will propagate that success.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: iahs
      
      Differential Revision: D31266586
      
      fbshipit-source-id: b6eba6ab2a0a3634b112318b1810819d7916acdb
      118a3923
    • Dmytro Stechenko's avatar
      Add ssl sha512/blake2b wrappers · ff7c3177
      Dmytro Stechenko authored
      Summary: Adding sha512/blake2b evp wrappers for digest/hmac.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31220261
      
      fbshipit-source-id: af190fef5d269dda6e7fed549641a6cffb3ce08d
      ff7c3177
    • Orvid King's avatar
      Spellcheck · eecfd465
      Orvid King authored
      Summary: Spellcheck everything in the root and docs directory.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31228715
      
      fbshipit-source-id: 3c5ace5d8879fbca17ebacf4fb6edee5e28a1b42
      eecfd465
    • Yedidya Feldblum's avatar
      let SharedMutexToken export a nice interface · bc254c2a
      Yedidya Feldblum authored
      Summary: Basically it needs a nice constructor and `operator bool`.
      
      Reviewed By: iahs
      
      Differential Revision: D31188190
      
      fbshipit-source-id: ec64d944674b0879e045aa92df95c592f66c3be4
      bc254c2a
  10. 29 Sep, 2021 5 commits
    • Cameron Pickett's avatar
      Cleanup CollectTest to use `EXPECT` instead of `CHECK` · e652b1b2
      Cameron Pickett authored
      Reviewed By: iahs
      
      Differential Revision: D31266293
      
      fbshipit-source-id: 99edca2496fd3764906e1c8483ff7cb1d3af0721
      e652b1b2
    • Nicholas Ormrod's avatar
      Rm non-const ctor for not_null · 9cad4956
      Nicholas Ormrod authored
      Summary:
      D22214468 added a non-const copy constructor override. This does not compile on all platforms.
      
      The reasoning in D22214468 pertains to overload resolution for copies. The specifics for adding the non-const copy constructor (in addition to having the const version) are lost. (If only we could ask the author... but past me does not have the answers that present me needs.) It is possible that later changes have obviated the need. Try removing.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31218444
      
      fbshipit-source-id: 307030df044b4413125365782064066c99570f02
      9cad4956
    • Zeyi (Rice) Fan's avatar
      cmake: build edenfsctl Rust · ed110c19
      Zeyi (Rice) Fan authored
      Summary: This diff adds the Rust edenfsctl to our open source build.
      
      Reviewed By: xavierd
      
      Differential Revision: D30788685
      
      fbshipit-source-id: 603caa933ecfc5af0ede7e22f6c7911462da3a65
      ed110c19
    • Cameron Pickett's avatar
      Implement range-accepting versions of collectAny* · ea7aeab5
      Cameron Pickett authored
      Reviewed By: iahs
      
      Differential Revision: D31233377
      
      fbshipit-source-id: c61de3936ad2c3d573ef71aca385dda023b38ee7
      ea7aeab5
    • Yedidya Feldblum's avatar
      Use relaxed_atomic in ShutdownSocketSet · 8ccd13f0
      Yedidya Feldblum authored
      Summary:
      [Folly] Use `relaxed_atomic` in `ShutdownSocketSet`.
      
      It currently uses a slab of `std::atomic` states, every operation on which uses `std::memory_order_relaxed`. Which is what `folly::relaxed_atomic` is for.
      
      Reviewed By: ot, magedm
      
      Differential Revision: D6290453
      
      fbshipit-source-id: a6b4df115b0de429dd544a97fdf97c088459a6d9
      8ccd13f0
  11. 28 Sep, 2021 3 commits
    • Zhengchao Liu's avatar
      upgrade to VC++ 2019 · 1a0ac04b
      Zhengchao Liu authored
      Summary:
      Allow a Facebook-specific vcvarsall to be used. The getdeps default of
      MSVC 2017 had at least one annoying bug fixed in 2019.
      
      Reviewed By: chadaustin
      
      Differential Revision: D31188039
      
      fbshipit-source-id: 1f569fe1c5f4ceb68f0ddd339e6de3c8ca07588b
      1a0ac04b
    • Yedidya Feldblum's avatar
      relaxed_atomic, atomic with assumed memory_order_relaxed · c7e3550f
      Yedidya Feldblum authored
      Summary:
      [Folly] `relaxed_atomic`, `atomic` with assumed `memory_order_relaxed`.
      
      This is useful for values which are themselves atomics but which do not guard other non-atomic data, such as counters. In such cases, there is no required sequencing between the atomic value and other memory locations, just between concurrent accesses to the same atomic value, so relaxed operations are sufficient.
      
      Reviewed By: ot
      
      Differential Revision: D6206542
      
      fbshipit-source-id: c820d7fcf189350a1feda4b012cb6a6342e32104
      c7e3550f
    • Yedidya Feldblum's avatar
      portability tweaks to ShutdownSocketSet · 8516df37
      Yedidya Feldblum authored
      Summary:
      `NetworkSocket::data` may not always be integral; for XROS, it is `void*` instead (as a sort of no-op). Portably handle this.
      
      Now, treat the vector and the capacity more like a vector and capacity, using `size_t` for capacity and positions. Convert explicitly where required.
      
      Reviewed By: Orvid
      
      Differential Revision: D31220216
      
      fbshipit-source-id: 47db6ed72ff9124e30dacc31c6ec0427c29b3c99
      8516df37
  12. 27 Sep, 2021 2 commits
    • Constantin Dolghier's avatar
      Move isWaitForAll_ from ThreadPoolExecutor to IOThreadPoolExecutor · bc1365d3
      Constantin Dolghier authored
      Summary:
      I randomly ran into this while working on something else: ThreadPoolExecutor has a field `isWaitForAll_` which:
      * is only used in its subclass, `IOThreadPoolExecutor`
      * has a comment referencing evbs, which ThreadPoolExecutor doesn't have relationship to but the subclass does.
      
      Looks like this is an artefact of some old refactoring
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31117228
      
      fbshipit-source-id: ea7d1753a0d75ab8911cec68f3b6fb8c1f07c569
      bc1365d3
    • Ravindra Sunkad's avatar
      Have OSS build pick 'fizz' from 'main' (instead of 'master') · 5c748c42
      Ravindra Sunkad authored
      Summary: Have OSS build pick 'fizz' from 'main' (instead of 'master')
      
      Reviewed By: knekritz
      
      Differential Revision: D31173527
      
      fbshipit-source-id: a223768b8d6568a6f979683d612c2bf36e1faafb
      5c748c42
  13. 26 Sep, 2021 1 commit
    • Maged Michael's avatar
      hazptr_test: Fix test and microbenchmark · d96d961f
      Maged Michael authored
      Summary:
      Fix reclamation_without_calling_cleanup test to wait for the start of asynchronous reclamation which is done on a different thread.
      
      Fix list_protect_all_bench. The node links in the list must be immutable since the List destructor retires each node in the list, whereas nodes with mutable links automatically unlink their children and retire them if a child's last link is unlinked.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D31101932
      
      fbshipit-source-id: 3afa4b07cd56e07eccab9be69bfe895e4f54aee8
      d96d961f
  14. 23 Sep, 2021 2 commits
    • Keivaun Waugh's avatar
      Add callback for single EVB loop duration violators · a2792966
      Keivaun Waugh authored
      Summary:
      Context for motivation is in
      https://fb.workplace.com/groups/560979627394613/permalink/2194915787334314.
      This solution is different than the one we discussed in that post. I considered
      implementing a set of post-evb-loop function callbacks that all took in the
      ebv loop_time, but that was a bigger change than expected since currently the
      callbacks are designed to not take any variables, and modifying/adding classes
      like `FunctionLoopCallback` to either take a param or not seemed like overkill.
      I instead implemented the callback basically the same as setMaxLatency
      exception that the duration is a single-loop duration with no exponential
      smoothing or backoffs.
      
      Differential Revision: D30916498
      
      fbshipit-source-id: 27cc7edf919ab11d2ee75a7f722b6a48b193c445
      a2792966
    • Yedidya Feldblum's avatar
      revisions to win32 SocketFileDescriptorMap · bb46a529
      Yedidya Feldblum authored
      Summary:
      Make the map and the mutex leaky singletons, grouping them together.
      
      Tweak variable names.
      
      Avoid double work in overloads of `close`.
      
      Reviewed By: Orvid
      
      Differential Revision: D31065456
      
      fbshipit-source-id: eec1474909706df3330bd3464ebeb90ad768607b
      bb46a529