1. 02 Jul, 2019 5 commits
    • Miroslav Crnic's avatar
      NotificationQueueBenchmark multi consumer benchmarks · c2cf8102
      Miroslav Crnic authored
      Summary:
      NotificationQueue, although mostly not used as such, is a multi consumer queue and it's missing benchmarks for that part.
      
      There where also a couple of issues with original benchmark which this diff addresses:
      1. Benchamrks used to do N * number of producers number of iterations and didn't report increased iteration count back to benchmark
      2. Benchmark would not run the same case during whole benchmark time as producers where stopped as soon as they produced enough request and consumer would finish without contention
      
      Since these are very tight loops I added a busy loop param which can be varied the same way as batching parameter.
      This param adds some work in a form of a busy loop in both producers and consumer to make benchmarking cases, where producers/consumers are actually doing something except from posting to the queue, easier.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16071580
      
      fbshipit-source-id: c75f2dd9ae8617be09834cdf153a4b4ae06aaaca
      c2cf8102
    • Miroslav Crnic's avatar
      NotificationQueueBenchmark add zero congestion benchmarks · 8bb0525b
      Miroslav Crnic authored
      Summary: While congested throughput is important it is also important not to regress non congested path too much.
      
      Reviewed By: aary
      
      Differential Revision: D16005428
      
      fbshipit-source-id: 7b98a7ef253fc306b3097f7236b57a5d453ed15d
      8bb0525b
    • Yedidya Feldblum's avatar
      Check for max value in test semaphore · 35c941e4
      Yedidya Feldblum authored
      Summary: [Folly] Check for max value in test semaphore, beyond which posts cannot be tolerated.
      
      Reviewed By: aary
      
      Differential Revision: D15938166
      
      fbshipit-source-id: 1f3fee97a9662dafc5b434c0449831147aa3c976
      35c941e4
    • Luca Niccolini's avatar
      Deprecate autoconf · 093067ce
      Luca Niccolini authored
      Summary:
      Remove all the autoconf files.
      And fully switch to the cmake build
      
      Reviewed By: udippant
      
      Differential Revision: D16066986
      
      fbshipit-source-id: 9e3082dded77ce85449cf5a3a03bed31c16b711f
      093067ce
    • brianpl's avatar
      Fix the implementation of max_align_t (#1180) · 72c08f7b
      brianpl authored
      Summary:
      Folly's `folly/lang/Align.h` header defines `folly::max_align_t`, which is usually taken from stdlib. This is to correct an error in legacy implementations of `std::max_align_t`, by logically reconstructing the maximum alignment value in a constexpr context.
      
      `max_align_t` depends on the function `detail::max_align_`, which is supposed to implement a recursive max value function using templates. However, the expression
      
      ```
      !(a < e) ? a : max_align_(e, es...)
      ```
      
      does not recursively compute the maximum value over `a`, `e`, `es...`. This expression actually selects the first value that is followed by a lower value.
      
      This error prevents folly from compiling on newer versions of clang, targeting x86, because `folly/CachelinePadded.h` statically checks `max_align_t` in an assertion, and then fails, because it thinks that `AtomicStruct<LifoSemHead, atomic>` is over-aligned.
      
      This corrects the implementation to:
      
      ```
      !(a < e) ? max_align_(a, es...) : max_align_(e, es...)
      ```
      
      Pull Request resolved: https://github.com/facebook/folly/pull/1180
      
      Reviewed By: Orvid
      
      Differential Revision: D16079107
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 13adbd6d1c117b3c547e7116216ee1069129b3c7
      72c08f7b
  2. 01 Jul, 2019 3 commits
    • Shrikrishna Khare's avatar
      fbcode_builder: getdeps: fboss: fix libmnl source · a8ea86cf
      Shrikrishna Khare authored
      Summary:
      The source we were downloading from (netfilter.org) should work, but
      unfortunately, is donw. This is causing getdeps FBOSS builds to fail. For now,
      download from a mirror which seems to be up.
      
      If this becomes a frequent issue with this repository/others, we can consider a
      different solution.
      
      Also, not sure how lfs pointer edit was missed by previous commit, added here.
      
      Reviewed By: phshaikh
      
      Differential Revision: D16070052
      
      fbshipit-source-id: dd9278254c77e1a5845ca331a9eeb36f2bf03071
      a8ea86cf
    • Mohamed Bassem's avatar
      Add missing test/Semaphore.h to Cmake header files · fbbe00b7
      Mohamed Bassem authored
      Reviewed By: yfeldblum
      
      Differential Revision: D16054275
      
      fbshipit-source-id: 266f2244fd4c28e1726f4f84d32d4f5d6856ec26
      fbbe00b7
    • Christos Stratopoulos's avatar
      Handle noexcept in SignatureOf_ and ArgTypes_, take 2 (#1178) · c0b79371
      Christos Stratopoulos authored
      Summary:
      Second attempt at https://github.com/facebook/folly/pull/1173
      
      This time the class template specializations are guarded with the `__cpp_noexcept_function_type` feature test macro to maintain compatibility with C++14.
      
      Open to replacing the raw macro with something like `FOLLY_POLY_NOEXCEPT_FUNCTION_TYPE` but that was not my first approach since it's more characters and there is not an extra case to test like with `FOLLY_POLY_NTTP_AUTO`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1178
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16057403
      
      Pulled By: Orvid
      
      fbshipit-source-id: 9b538c0f1b0614e69447202d1e4d60ed3fa709cb
      c0b79371
  3. 28 Jun, 2019 3 commits
    • Stiopa Koltsov's avatar
      Fix SSE4.2 detection in F14Table.h · f22119f1
      Stiopa Koltsov authored
      Summary: `_mm_crc32_u64` requires SSE 4.2, not just any SSE.
      
      Reviewed By: vener91
      
      Differential Revision: D16032673
      
      fbshipit-source-id: 13cb6299e14184b30a9a04f2644aee2f0cd1a60e
      f22119f1
    • Stiopa Koltsov's avatar
      Do not define __SSE4_2__ unconditionally in clang · 7af588f6
      Stiopa Koltsov authored
      Summary:
      Clang defines `_MSC_VER` on Windows, but it is not MSC.
      
      ```
      % ./third-party/toolchains/llvm/8.0.0/bin/windows/clang.exe -march=corei7 -dM -E -x c empty | grep MSC
      #define _MSC_BUILD 1
      #define _MSC_EXTENSIONS 1
      #define _MSC_FULL_VER 191225835
      #define _MSC_VER 1912
      ```
      
      We are not allowed to define `__SSE4_2__` in clang when clang assumes older arch, because in that case it refuses to compile SSE intrinsics, there is a couple of places in folly where we assume defined `__SSE4_2__` to use SSE4.2 intrinsics.
      
      On the other hand clang defines `__SSE4_2__` itself when it is available:
      
      ```
      % ./third-party/toolchains/llvm/8.0.0/bin/windows/clang.exe -march=corei7 -dM -E -x c empty | grep SSE
      #define __SSE2_MATH__ 1
      #define __SSE2__ 1
      #define __SSE3__ 1
      #define __SSE4_1__ 1
      #define __SSE4_2__ 1
      #define __SSE_MATH__ 1
      #define __SSE__ 1
      #define __SSSE3__ 1
      ```
      
      This is an example clang error on Windows:
      
      ```
      folly/container/detail/F14Table.h:1098:23: error: always_inline function '_mm_crc32_u64' requires target feature 'sse4.2', but would be inlined into function 'splitHash' that is compiled without support for 'sse4.2'
            std::size_t c = _mm_crc32_u64(0, hash);
      ```
      
      Reviewed By: vener91
      
      Differential Revision: D16038436
      
      fbshipit-source-id: 8728a8d91cadb936c9e244795c9270943fe005ad
      7af588f6
    • Andrii Grynenko's avatar
      Add a workaround for a TSAN atomics bug · e22d96d6
      Andrii Grynenko authored
      Summary: https://github.com/google/sanitizers/issues/970
      
      Reviewed By: yfeldblum
      
      Differential Revision: D16037542
      
      fbshipit-source-id: 8c2feb85454ae582498d38a474e8d5913c9438b1
      e22d96d6
  4. 27 Jun, 2019 4 commits
    • Lee Howes's avatar
      Adds SemiFuture support to futures::retrying · 4df20672
      Lee Howes authored
      Summary: Allows futures::retrying to take a continuation that returns a SemiFuture, and in that case to return a SemiFuture as the result.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D15876742
      
      fbshipit-source-id: da6f1614dd940b83ca048ecedf3d3645aa69b1f0
      4df20672
    • Scott Haskin's avatar
      Adding method getSendBufInUse and getRecvBufInUse to · a0394d84
      Scott Haskin authored
      Summary:
      Adding ability to get the current number of bytes used in the tx
      (transmit/send) socket buffer and the rx (receive) socket buffer.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15966995
      
      fbshipit-source-id: 29a51cd4caad265590baa45385712659fb3f3dac
      a0394d84
    • Kirk Shoop's avatar
      port properties from unifex · 74bf4289
      Kirk Shoop authored
      Summary: ported the properties header from unifex and added some simple compile tests
      
      Reviewed By: ericniebler
      
      Differential Revision: D15144375
      
      fbshipit-source-id: 580f8c8977abd070333779898f3ac47510932f87
      74bf4289
    • Stiopa Koltsov's avatar
      Missing include in fibers · 4f1d8454
      Stiopa Koltsov authored
      Summary: `FiberManagerInternal.h` uses `FOLLY_TLS` and `FOLLY_EXPORT` defines which are defined in `folly/Portability.h`.
      
      Reviewed By: vener91, Orvid
      
      Differential Revision: D16020265
      
      fbshipit-source-id: 7f80b397bd364cc53efb67568293da5c90fe97d9
      4f1d8454
  5. 26 Jun, 2019 1 commit
  6. 25 Jun, 2019 3 commits
    • Kirk Shoop's avatar
      add opt-in support for folly executors and event base · 0bb15ba8
      Kirk Shoop authored
      Summary:
      adds customizations for folly::Executor folly::EventBase and related types.
      The customizations make folly::Executor::KeepAlive<T> model the pushmi Executor, TimeExecutor, and Strand concepts as appropriate
      
      Reviewed By: ericniebler
      
      Differential Revision: D15418629
      
      fbshipit-source-id: d74a777ca743b5fb72664d9c1527837c3fbdb3ba
      0bb15ba8
    • Luca Niccolini's avatar
      enable CMake build (with HTTP/3) -- take 2 · 93b9af64
      Luca Niccolini authored
      Reviewed By: snarkmaster
      
      Differential Revision: D15730421
      
      fbshipit-source-id: 51eaac2ad443aadbab3ba772e651287c6b330408
      93b9af64
    • Kirk Shoop's avatar
      add interval_repeat() and test · 90b51d00
      Kirk Shoop authored
      Summary: interval_repeat is an algorithms for single senders. it repeats the predecessor single at the start time and again on an interval relative to that start time. the last parameter is an optional function that allows the time used for the next schedule to be modified.
      
      Reviewed By: ericniebler
      
      Differential Revision: D15945618
      
      fbshipit-source-id: d03cf079d870ceb65e9502c9ff0edcb87b6fd25e
      90b51d00
  7. 22 Jun, 2019 1 commit
  8. 21 Jun, 2019 5 commits
  9. 20 Jun, 2019 7 commits
    • Nathan Bronson's avatar
      restrict memory_resource to >= c++17 · 52a691fb
      Nathan Bronson authored
      Summary:
      This diff restricts use of memory_resource to C++17 or later,
      to avoid problems with compilation on some MSVC platforms.
      
      Reviewed By: kevinhu88
      
      Differential Revision: D15923470
      
      fbshipit-source-id: 91b2446c096fbcb71c8bf5a0f1967bff4cbd1ce8
      52a691fb
    • Yedidya Feldblum's avatar
      Use the portable test semaphore in DeterministicSchedule · c8f7015f
      Yedidya Feldblum authored
      Summary: [Folly] Use the portable test semaphore in `DeterministicSchedule`, v.s. `sem_t` which is not portable everywhere. The portable test semaphore is implemented purely in terms of `std::mutex` and `std::condition_variable`, and is therefore portable.
      
      Reviewed By: nbronson
      
      Differential Revision: D15909982
      
      fbshipit-source-id: 63b3e5d16864ffee9fad20bd2ad46730fba220dd
      c8f7015f
    • Yedidya Feldblum's avatar
      A test semaphore with no wake policy · 082df133
      Yedidya Feldblum authored
      Summary: [Folly] A test semaphore with no wake policy, and a rename of the existing test semaphore template for clarity that it has a wake policy.
      
      Reviewed By: nbronson
      
      Differential Revision: D15909983
      
      fbshipit-source-id: 291566daab4838030e25fce862d42e15f2a4a8aa
      082df133
    • Matt Glazar's avatar
      Avoid Linux-specific dependency for macOS builds · 7851b439
      Matt Glazar authored
      Summary:
      In Facebook's Buck-based build system, folly/system/MemoryMapping.cpp depends on folly/experimental/io/HugePages.cpp. This works well on Linux, and in theory works well on macOS because HugePages.cpp has no OS-specific code at build time. However, because HugePages.cpp has a transitive dependency on the range-v3 library, and because range-v3 isn't available in Facebook's build system for macOS yet, building HugePages.cpp on macOS fails.
      
      On macOS, avoid MemoryMapping.cpp's dependency on HugePages.cpp (and thus the transitive dependency on range-v3). Use a manual annotation to prevent the Facebook's autodeps tool from forcing the dependency on macOS in Buck. (It looks like autodeps does not interpret `#ifdef __linux__`.)
      
      On Linux (servers), this diff should not change behavior.
      
      This diff does not fix the issue in folly's CMake build system.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15775751
      
      fbshipit-source-id: 612790caab673c0fc52eb3054aa5789f767c7353
      7851b439
    • Zeyi (Rice) Fan's avatar
      check if subclass of AsyncLogWriter called cleanup · b2a27c9d
      Zeyi (Rice) Fan authored
      Summary: This diff adds a check in `AsyncLogWriter`'s destructor that checks if its subclass called `cleanup()` to drain all the pending log messages in the queue during destructing.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15383734
      
      fbshipit-source-id: deca9bdc84d5f514f2d47a250d31a68126d20aad
      b2a27c9d
    • Zeyi (Rice) Fan's avatar
      move `onIoError` to `AsyncFileWriter` · ffdc8a9a
      Zeyi (Rice) Fan authored
      Summary: This diff moves `onIoError` into `AsyncFileWriter` as it is specifically related to writing to file.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15324855
      
      fbshipit-source-id: 3929a53aee7febd9185b71dfdb894990dee73413
      ffdc8a9a
    • Zeyi (Rice) Fan's avatar
      Split asynchronous writing logic out from AsyncFileWriter · 0bf12e84
      Zeyi (Rice) Fan authored
      Summary:
      This diff splits `AsyncFileWriter` into two parts: `AsyncLogWriter` and `AsyncFileWriter`, so we could re-use the asynchronous IO operating logic with other types of log writer. See the following diffs for example use case.
      
      `AsyncLogWriter` is a virtual class that provides the asynchronous logic and manages a queue of incoming log messages. The users can write subclasses with this class to provided their own IO implementation by overriding the virtual method `performIO`.
      
      `AsyncFileWriter` is one implementation of the `AsyncLogWriter` that writes incoming log messages to a file.
      
      Most of this diff is simply moving things around. Substantial changes are placed in next diff.
      
      Reviewed By: chadaustin
      
      Differential Revision: D15228054
      
      fbshipit-source-id: 86c3405755099c59aa2df8a310250fded648e413
      0bf12e84
  10. 19 Jun, 2019 8 commits
    • Dylan Yudaken's avatar
      add a comment to explain non-obvious semantics · 6fe1af4a
      Dylan Yudaken authored
      Summary: It might not be obvious that the parent in Subprocess::Options refers to the parent thread (see man PRCTL(2)).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15873239
      
      fbshipit-source-id: 2a1cc840281d25030708e4d10e633c7d8a9158ed
      6fe1af4a
    • Orvid King's avatar
      Prevent AtomicHashArray being contstructed with 0 elements · 0a310d52
      Orvid King authored
      Summary: An atomic hash array with zero elements isn't useful in any way, not even as an empty set (due to it not being comparable), and there are multiple places that simply crash if you try to use, so just prevent it from being constructed in the first place.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15789540
      
      fbshipit-source-id: a811f70fb0e9e21a83dc9aea79ec017ae2d7e0a5
      0a310d52
    • Scott Pruett's avatar
      clarify documentation for IOBuf::length() · 6f3d4da9
      Scott Pruett authored
      Summary:
      The documentation on length() is somewhat ambiguous
      when dealing with chains of IOBufs -- it is only clear after
      reading implementations that "data" refers to "the data in
      this single IOBuf, potentially only part of a chain".
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15830189
      
      fbshipit-source-id: d3319abd2d53a76665442d1b93b78a7d1a77dcc0
      6f3d4da9
    • Andrii Grynenko's avatar
      Fix waitImpl to detach the future after calling setCallback_ · 5947ad63
      Andrii Grynenko authored
      Summary: It's not safe to access the core after setCallback_ was called, while SemiFuture::operator= may check core_.executor_
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15871436
      
      fbshipit-source-id: 1fe0a6b3fe1638cd8f5bab49572203f7b252c0dd
      5947ad63
    • Prabhakaran Ganesan's avatar
      Perform TOS reflection only if the TOS value in SYN is non-zero · 9074a5ba
      Prabhakaran Ganesan authored
      Summary:
      TOS reflected is implemented in the AsyncServerSocket layer. The way it works is by extracting the TOS value from cached SYN packet and applying a setsockopt() on the accepted socket. But if the TOS value in the cached SYN packet is ZERO, this results in TOS=0 for the accepted socket, resulting in problems.
      
      Made changes to limit TOS reflection only if SYN carries non-zero TOS.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15633518
      
      fbshipit-source-id: 856ba2059145e37fdab580b094349632677a40ba
      9074a5ba
    • Aaryaman Sagar's avatar
      Make DistributedMutex build on mobile ARM · 6829ab70
      Aaryaman Sagar authored
      Summary:
      std::max() is not constexpr for the platform we build with on android for some
      reason
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15848911
      
      fbshipit-source-id: aa8b62514b0b1b23f9a179736c2e79885ddf8689
      6829ab70
    • Orvid King's avatar
      Use checked math when allocating in folly/memory/Arena.h · da41b65e
      Orvid King authored
      Summary: To prevent ultra large allocations from causing out of bounds read & writes.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15610028
      
      fbshipit-source-id: 5adaec121c1fc8a0f0d3d0e56b85fabb2ec89d4c
      da41b65e
    • Nathan Bronson's avatar
      add pmr aliases · b9807709
      Nathan Bronson authored
      Summary:
      Adds folly::pmr::* aliases for all of the F14 map and set types.
      The only missing piece for full pmr support was to tolerate a deleted
      operator= for allocators that are never actually assigned (based on the
      propagate_... properties).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D15572220
      
      fbshipit-source-id: fd9687a73bf67e5e9c7962cc788fae658ccf7d36
      b9807709