1. 03 Dec, 2018 1 commit
    • Nathan Bronson's avatar
      split JSON gmock helpers into a separate header · 747f6e3c
      Nathan Bronson authored
      Summary:
      This diff splits the gmock helpers out of JsonTestUtil.h into
      JsonMockUtil.h so that JsonTestUtil.h doesn't introduce a dependency on
      gmock that is problematic for some platforms.
      
      (Note: this ignores all push blocking failures!)
      
      Differential Revision: D13293728
      
      fbshipit-source-id: 2a0e7f4a7c96fc05495b56fb02e848e92edc90d8
      747f6e3c
  2. 01 Dec, 2018 4 commits
  3. 30 Nov, 2018 4 commits
    • Subodh Iyengar's avatar
      change default for REUSEADDR to false · 21be7c3d
      Subodh Iyengar authored
      Summary:
      A default value of true for SO_REUSEADDR is dangerous.
      SO_REUSEADDR has several issues. For example if SO_REUSEADDR
      is used to bind to a socket which is already bound but not connected,
      the kernel will allow this operation to complete. This can cause overlapping
      data. https://www.spinics.net/lists/netdev/msg206437.html
      
      Looking at use cases of AsyncUDPSocket it does not look like people depend
      on this behavior of AsyncUDPSocket and this was first introduced in thrift for
      no reason.
      
      This changes the behavior back to false.
      
      Reviewed By: yfeldblum, djwatson
      
      Differential Revision: D13274704
      
      fbshipit-source-id: 391cf1bdd3f633bee38c230fcd9f1403ea950c3b
      21be7c3d
    • Nathan Bronson's avatar
      randomize folly::dynamic and most F14 map and set insert order in debug builds · 44e30c29
      Nathan Bronson authored
      Summary:
      It's easy to accidentally rely on the relationship between
      insert and iteration order in unordered containers.  This diff adds some
      randomization to the insertion order within an F14 chunk when compiled in
      debug mode.  This isn't full randomization of the order, but is enough to
      break tests that rely on the iteration order of F14 maps and sets as small
      as two elements.
      
      This diff applies randomization to folly::dynamic object, F14NodeSet,
      F14NodeMap, F14ValueSet, F14ValueMap, F14FastSet for small (< 24 bytes)
      value_type, and F14FastSet for small value_type.
      
      The long-term plan is to randomize insertion order for all F14FastSet
      and F14FastMap, leaving iteration order deterministic only for explicit
      uses of F14VectorSet and F14VectorMap.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13099681
      
      fbshipit-source-id: 35b3174a8afbc6cef27d2080adc5a01e85154dcd
      44e30c29
    • Doron Roberts-Kedes's avatar
      DeterministicSchedule: Introduce BufferedAtomic · 140f6df7
      Doron Roberts-Kedes authored
      Summary:
      Mimic the atomic history buffers in relacy. This diff allows older values for atomics to be returned as long as the memory model is respected. Enforce the memory model with vector clocks (ThreadTimestamps).
      
      Depends on D10418223
      
      Reviewed By: djwatson
      
      Differential Revision: D10418450
      
      fbshipit-source-id: 0556259e96d512030ff9924bbd5aa0f79a38dfff
      140f6df7
    • Nathan Bronson's avatar
      fix heterogeneous lookup for non-transitive is_convertible · e1766e5e
      Nathan Bronson authored
      Summary:
      In most cases two implicit conversions can be chained to perform
      an explicit construction, but that is not the case when the intermediate
      type has a template parameter that can't be deduced. This interferes
      with heterogeneous lookup when the transparent hasher or equality functor
      work by implicit conversion to a base type (like folly::Range). This diff
      disables heteregeneous find in cases where the hash functor or equality
      functor are not invocable.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13264397
      
      fbshipit-source-id: 082c3215e81ab58f3fa9519da872642e45b16245
      e1766e5e
  4. 29 Nov, 2018 10 commits
    • Scott Wolchok's avatar
      Don't include FBVector.h in String.h · 179e9a12
      Scott Wolchok authored
      Summary: No need for String to import fbvector.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13007715
      
      fbshipit-source-id: c61639a04273f14dd3daf230ee6ed9ade93d058e
      179e9a12
    • Nathan Bronson's avatar
      improve sorted_vector_{map,set} compatibility with std::{map,set} · cb838d11
      Nathan Bronson authored
      Summary:
      This diff fixes a few rough edges in the folly::sorted_vector_set
      and folly::sorted_vector_map APIs. It makes the default constructor
      implicit; it adds emplace to sorted_vector_set; and it adds bulk insertion
      via std::initializer_list to sorted_vector_set and sorted_vector_map.
      This doesn't fix all incompatibilities. It also changes sorted_vector_set
      and sorted_vector_map insertion so that they do not copy a value_type
      const& argument if the key is already in the container.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13255279
      
      fbshipit-source-id: dc5a16ea729e2a32a77f82ec0eacaeaf7854cd1a
      cb838d11
    • Andrii Grynenko's avatar
      Fix Executor::KeepAlive use in thenError · 0895c3af
      Andrii Grynenko authored
      Summary: onError destroys the Core, which holds a Executor::KeepAlive, so we have to capture it before calling onError.
      
      Differential Revision: D13250857
      
      fbshipit-source-id: 5f458765f0b8ccb225502c26413ff7bfdd46fe15
      0895c3af
    • Nathan Bronson's avatar
      silence false-positive compiler warning · a9a8d1d0
      Nathan Bronson authored
      Summary:
      Add static casts near memcpy to silence a compiler warning
      for a memcpy call site whose control flow is correctly guarded by the
      appropriate type_traits check.
      
      Reviewed By: yfeldblum, shixiao
      
      Differential Revision: D13241617
      
      fbshipit-source-id: 747b6cd1bb32c0971e805d1a4a9cdc5da6c73ea9
      a9a8d1d0
    • Yedidya Feldblum's avatar
      Extract getSingletonStackTrace · 6b1fb6fa
      Yedidya Feldblum authored
      Summary:
      [Folly] Extract `getSingletonStackTrace` to its own detail library.
      
      For now, just do conditional definition, avoiding the atomic and the global constructor.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13213446
      
      fbshipit-source-id: 95af5701d1c29e0ef24ba48e9bcec9ec565b31b4
      6b1fb6fa
    • Yedidya Feldblum's avatar
      Let SingletonThreadLocal creator return derived type · da7f6959
      Yedidya Feldblum authored
      Summary: [Folly] Let `SingletonThreadLocal` creator return derived type. This is a different interface for the creator type, and means supporting non-moveable/non-copyable types with an extra pointer indirection pre-C++17.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13165769
      
      fbshipit-source-id: 39f2b5fed48342dd3178a20838af50c43aabee86
      da7f6959
    • Yedidya Feldblum's avatar
      Let createGlobal return a reference · ed0cacef
      Yedidya Feldblum authored
      Summary: [Folly] Let `createGlobal` return a reference rather than a pointer, since it always returns non-`nullptr`.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13116591
      
      fbshipit-source-id: 5618c2e8a5a04b158ac45a3e43b02eb37c6af8c1
      ed0cacef
    • Yedidya Feldblum's avatar
      A small inline fast path for StaticSingletonManager::create · ec8d84ff
      Yedidya Feldblum authored
      Summary: [Folly] A small inline fast path for `StaticSingletonManager::create`.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13114824
      
      fbshipit-source-id: b72b6066b7ff5401e37e75aa1c8102e6536e9740
      ec8d84ff
    • Yedidya Feldblum's avatar
      Remove StaticSingletonManager support for creator function · 592b2621
      Yedidya Feldblum authored
      Summary: [Folly] Remove `StaticSingletonManager` support for creator function. In general, derived types may be used instead.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13114823
      
      fbshipit-source-id: ecd781a1e11f1726e5e8689874e7f4473d21ecb0
      592b2621
    • Yedidya Feldblum's avatar
      Let SingletonHolder call createGlobal with no args · 60c9115b
      Yedidya Feldblum authored
      Summary: [Folly] Let `SingletonHolder` call createGlobal with no args. This was the only non-test call-site calling it with an argumnet.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D13114710
      
      fbshipit-source-id: 55205a69d25966ee9fb09d5daefed1f9ecad80b9
      60c9115b
  5. 28 Nov, 2018 2 commits
    • Jon Maltiel Swenson's avatar
      Remove incorrect call to dcheckIsInEventBaseThread · 9aede428
      Jon Maltiel Swenson authored
      Summary: The point of this diff is that `AsyncSocket::closeNow()` should be able to be called on a socket that is not attached to an event base. Removing an overly protective `dcheckIsInEventBaseThread()` enables this.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13219611
      
      fbshipit-source-id: ca57995e1a96d2b937bccf311d3f6b903abc33b7
      9aede428
    • Orvid King's avatar
      Just define STATUS_HANDLE_NOT_CLOSABLE · 8c7e748d
      Orvid King authored
      Summary: Multiple windows headers define a subset of the full list of status types and it's a mess, so just define the only extra one we need manually to avoid the warning spew.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13225857
      
      fbshipit-source-id: e963194a8c14046e7884abb4bcb265442b6978f7
      8c7e748d
  6. 27 Nov, 2018 9 commits
    • Kirk Shoop's avatar
      change abort to terminate · 77e5e1b5
      Kirk Shoop authored
      Summary: search replace abort with terminate to fix build errors
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13106734
      
      fbshipit-source-id: 146367a7fdbed9c945cb32cfdcb5ac521a1c861b
      77e5e1b5
    • Abhay Bothra's avatar
      FunctionScheduler: Fix typo in comment · f3260585
      Abhay Bothra authored
      Summary: Fixes minor typo and word re-ordering in comment
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13122529
      
      fbshipit-source-id: b713099dc06be8fdd525ba9d9e2fafd5511bd7f1
      f3260585
    • David Rothera's avatar
      Define macro for disabling thread and address sanitizer and use on range SSE methods · 7b82832d
      David Rothera authored
      Summary: [folly] Define macro for disabling thread sanitizer and use on range SSE methods
      
      Reviewed By: yfeldblum, pixelb
      
      Differential Revision: D13192417
      
      fbshipit-source-id: 23774f8e0227c4c557d51f557b4df5e79f641386
      7b82832d
    • Yedidya Feldblum's avatar
      Use static constexpr WaitOptions in UnboundedQueue · 79c28f03
      Yedidya Feldblum authored
      Summary: [Folly] Use `static constexpr WaitOptions` in `UnboundedQueue` to save one store-word-to-stack instruction in the inlined fast path with gcc.
      
      Reviewed By: magedm
      
      Differential Revision: D13187890
      
      fbshipit-source-id: 79a4f4ba585ed8abaebef344081bd364144f6cf8
      79c28f03
    • Yedidya Feldblum's avatar
      Some functions to look at UnboundedQueue inlined code · 875819ab
      Yedidya Feldblum authored
      Summary: [Folly] Some functions to look at `UnboundedQueue` inlined native code. Doing everything runs into the combinatorial explosion wall, but do USPSC and UMPMC dequeue variants.
      
      Reviewed By: magedm
      
      Differential Revision: D13187510
      
      fbshipit-source-id: 676e00c770682d44a87d0f8d81b050629bc05820
      875819ab
    • Yedidya Feldblum's avatar
      UnboundedQueue::dequeue overload returning value type · 31c7bffd
      Yedidya Feldblum authored
      Summary:
      [Folly] `UnboundedQueue::dequeue` overload returning value type.
      
      For completeness.
      
      Reviewed By: magedm
      
      Differential Revision: D13176745
      
      fbshipit-source-id: 9ab7ee36539924b2f9dbd401ec4730151ebf712b
      31c7bffd
    • Yedidya Feldblum's avatar
      More constexpr in WaitOptions · 9a0d63ca
      Yedidya Feldblum authored
      Summary: [Folly] More `constexpr` in `WaitOptions`.
      
      Reviewed By: magedm
      
      Differential Revision: D13176175
      
      fbshipit-source-id: 34f5300be29ba5903c9d9d2fb630d9f34ea094ac
      9a0d63ca
    • Andrew Gallagher's avatar
      folly/Preprocessor.h: fix `FB_ANONYMOUS_VARIABLE` in modular builds · d94318a5
      Andrew Gallagher authored
      Summary:
      Modular builds build each module with its own preprocessor state, meaning
      `__COUNTER__` no longer provides a unique number across a TU.  Instead of
      calling back to just `__LINE__`, use a mix of `__COUNTER__` and `__LINE__`
      to try provide as much uniqueness as possible.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13152221
      
      fbshipit-source-id: e1728d56f793d2f2cc7992056f6049c4c3566c94
      d94318a5
    • Krishna Kondaka's avatar
      folly::json does not increment lineNum_ when skipping whitespace · 6dbd476b
      Krishna Kondaka authored
      Summary:
      folly::json does not increment lineNum_ when skipping whitespace
      It shows wrong line number when reporting errors.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13038266
      
      fbshipit-source-id: b424690c50f039695458ec7a7b83816e64ab9c38
      6dbd476b
  7. 26 Nov, 2018 4 commits
    • Yedidya Feldblum's avatar
      Add std dev to UnboundedQueue bench for flavor · 83b6dc7a
      Yedidya Feldblum authored
      Summary: [Folly] Add std dev to `UnboundedQueue` bench for flavor.
      
      Reviewed By: magedm
      
      Differential Revision: D13192196
      
      fbshipit-source-id: c702c0c6b5a788d4f02e6b87220f8a63b55f22cc
      83b6dc7a
    • Yedidya Feldblum's avatar
      Avoid gtest expectations in UnboundedQueue benchmark · 147a597e
      Yedidya Feldblum authored
      Summary: [Folly] Avoid gtest expectations in `UnboundedQueue` benchmark; prefer `DCHECK` so assumptions may be validated without `NDEBUG` but so measurements may be taken with `NDEBUG`.
      
      Reviewed By: magedm
      
      Differential Revision: D13192005
      
      fbshipit-source-id: 133cf0b8ed0e924e5c9ad3e7b85035fa061ccc40
      147a597e
    • Yedidya Feldblum's avatar
      Avoid measuring thread::join in UnboundedQueue benchmark · 49838bbf
      Yedidya Feldblum authored
      Summary:
      [Folly] Avoid measuring `thread::join` in `UnboundedQueue` benchmark.
      
      Use a single `barrier` which also replaces the technique which avoids measuring thread start.
      
      Reviewed By: magedm
      
      Differential Revision: D13192004
      
      fbshipit-source-id: 9b86bed2efb110dc863994e1114b4e7c40f9f225
      49838bbf
    • Yedidya Feldblum's avatar
      No need to annotate SSE noasan decls · c892be25
      Yedidya Feldblum authored
      Summary: [Folly] No need to annotate SSE noasan decls - it's the defns which need annotation.
      
      Reviewed By: davidrothera
      
      Differential Revision: D13198964
      
      fbshipit-source-id: 97af85c6a593dcd4043b650f824b037f74092839
      c892be25
  8. 22 Nov, 2018 2 commits
    • Andrii Grynenko's avatar
      Fix ObserverManager::waitForAllUpdates() to not deadlock · 4c291582
      Andrii Grynenko authored
      Summary: Make sure waitForAllUpdates returns if there are no updates in flight.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13165909
      
      fbshipit-source-id: d48c1f3b7df451fed4aec54ab6d9c9cedb1d7470
      4c291582
    • Yedidya Feldblum's avatar
      Fix SharedPromise move-ctor, move-assign · 30af28c6
      Yedidya Feldblum authored
      Summary: [Folly] Fix `SharedPromise` move-ctor, move-assign. Some fields really should be zero'd.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D13152287
      
      fbshipit-source-id: 1ab2da8016cbd736541a98ff32f32c30f6452209
      30af28c6
  9. 21 Nov, 2018 4 commits
    • Adam Simpkins's avatar
      update the CMake files to set FOLLY_HAVE_PIPE2 · 5f5230ff
      Adam Simpkins authored
      Summary:
      Update the CMake build to define `FOLLY_HAVE_PIPE2` correctly.  This macro is
      used in folly/Subprocess.cpp but was not previously set by the CMake build
      files.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13151341
      
      fbshipit-source-id: 463e9ed0bad694397e33841441698029f186d30b
      5f5230ff
    • Adam Simpkins's avatar
      fix finding gflags in the CMake build (#957) · 57fa54ca
      Adam Simpkins authored
      Summary:
      This reverts D7505908 (github commit ad317726 / issue #805), which broke
      finding gflags through it's installed CMake configuration file.
      
      The comment from the original diff indicates that they thought this line was
      supposed to find folly's `CMake/FindGFlags.cmake` file.  However, this line is
      intended to find the `gflags-config.cmake` file installed by gflags.
      The `find_package(GFlags MODULE)` check several lines later will be used to
      find folly's `FindGFlags.cmake` module if no installed configuration file is
      found.
      
      The change in D7505908 caused the code to never use the cmake config file
      installed by gflags, due to the case mistmatch with the `gflags_FOUND` check
      on the line below.
      
      Closes https://github.com/facebook/folly/pull/957
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13151340
      
      fbshipit-source-id: 0c7234d264dd26ae028a0ae1155c9ddc3f04ea1e
      57fa54ca
    • Adam Simpkins's avatar
      remove PlatformConfig.h · 696338da
      Adam Simpkins authored
      Summary:
      Eliminate the custom PlatformConfig.h header that could be included by
      defining `FOLLY_PLATFORM_CONFIG` with a command line compiler flag.  This
      separate header was only used to control one setting (`FOLLY_HAVE_PIPE2`), and
      can easily be done in the normal `folly-config.h` header.
      
      Including this file with a compiler command-line macro made it not behave
      nicely when using clang modules.
      
      Reviewed By: andrewjcg, yfeldblum
      
      Differential Revision: D13151079
      
      fbshipit-source-id: ae3cc98b7494d409d87bc3e47d740d844c42a940
      696338da
    • Andrii Grynenko's avatar
      waitForAllUpdates() · ec519fc5
      Andrii Grynenko authored
      Summary: This is useful for unit tests which need to wait for observer updates.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13133404
      
      fbshipit-source-id: ff36f55ec537490a763865cea2125617b58dc9c0
      ec519fc5