1. 11 Nov, 2018 2 commits
  2. 09 Nov, 2018 5 commits
    • Andrii Grynenko's avatar
      Fix potential use after move in window · cf5b2228
      Andrii Grynenko authored
      Summary:
      The lambda that gets the ctx moved in can be created before the via call.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: spalamarchuk
      
      Differential Revision: D13009656
      
      fbshipit-source-id: 1c89905e544adc829124277465c32958a3489845
      cf5b2228
    • Yunus Rahbar's avatar
      Add copyright headers to fbcode builder source files · 07f3b3df
      Yunus Rahbar authored
      Reviewed By: simpkins
      
      Differential Revision: D12990230
      
      fbshipit-source-id: 58d82299a8fe6aed75115008fe5dfb0f46d847c6
      07f3b3df
    • Andrii Grynenko's avatar
      Use via() in window() · f4397a2e
      Andrii Grynenko authored
      Summary: This makes it work for SemiFutures with deferred work.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12982589
      
      fbshipit-source-id: 9dcd130c72e8df67e8b4773b228041f96da06b10
      f4397a2e
    • Chad Austin's avatar
      clarify when CachelinePadded is appropriate · ef2774e4
      Chad Austin authored
      Summary:
      dschatzberg and I used `folly::CachelinePadded` when
      `alignas(folly::hardware_destructive_interference_size)` would have
      sufficed.
      
      Add a comment clarifying when CachelinePadded is appropriate.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12970571
      
      fbshipit-source-id: 7d9193358a7b1aec78c95b715641396474eaebcf
      ef2774e4
    • Dan Shiovitz's avatar
      Add support for comparing/hashing IOBuf pointers · cd31e875
      Dan Shiovitz authored
      Summary: Seems reasonable to overload IOBufHash/Compare to support pointers, since they already take unique_ptrs.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12963089
      
      fbshipit-source-id: 85124939cef7a18bfd02aeff392732fb93691903
      cd31e875
  3. 08 Nov, 2018 5 commits
  4. 07 Nov, 2018 3 commits
    • Alex Guzman's avatar
      Add SSL session unique ptr type · f327ff50
      Alex Guzman authored
      Summary: As it says on tin
      
      Reviewed By: ngoyal
      
      Differential Revision: D12933389
      
      fbshipit-source-id: 6a0dcfb6aa7ae672dcd8f355bdf88a8dfe930d02
      f327ff50
    • Doron Roberts-Kedes's avatar
      Modify shutdown_race to test LifoSem shutdown vs. wait ordering · 33fed603
      Doron Roberts-Kedes authored
      Summary:
      The shutdown_race test tries to make use of uniformSubset distribution
      to achieve an ordering of shutdown/wait/post in at least 1 of 1000 runs. This
      is unnecessary to test the desired behavior of LifoSem under the possible
      orderings of shutdown/wait/post. Making matters worse, the test relies on the existence of a step size for
      uniformSubset that will a) schedule the child thread between shutdown and post in the
      parent thread, and b) continue to schedule only the child thread until after
      it calls wait. There are seeds for which this fails when new calls to
      beforeSharedAccess are added inside DeterministicSchedule.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12925523
      
      fbshipit-source-id: bf3061ecc8ebf3e8c19ca6ca337dd6c45eab03b1
      33fed603
    • Georgios Bitzes's avatar
      Fix ASan build when folly is embedded as a submodule (#960) · b5ba7c30
      Georgios Bitzes authored
      Summary:
      When folly is used as a submodule, CMAKE_SOURCE_DIR
      will point to the top-level repository, resulting
      in set_source_files_properties not taking effect
      when compiling with ASan.
      
      Replacing CMAKE_SOURCE_DIR with PROJECT_SOURCE_DIR points
      cmake to the intended file.
      Pull Request resolved: https://github.com/facebook/folly/pull/960
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12943633
      
      Pulled By: Orvid
      
      fbshipit-source-id: a73560c5578062282f38dc3ff6c7a3364fb6cf6e
      b5ba7c30
  5. 06 Nov, 2018 1 commit
    • Adam Simpkins's avatar
      add a `detach` option to `Subprocess` to avoid waiting for the child · 2b0923c6
      Adam Simpkins authored
      Summary:
      Add a `Subprocess::Options::detach()` call.  This causes the subprocess to be
      spawned in grandchild process that will be reparented to init.  The
      intermediate child process exits immediately after spawning the grandchild,
      allowing the parent process to `wait()` on it and destroy its `Subprocess`
      object without leaving any zombie children.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10860274
      
      fbshipit-source-id: ac27d77d0033e3c03e27dd3f758ab70fd2dd990f
      2b0923c6
  6. 05 Nov, 2018 3 commits
    • Igor Sugak's avatar
      run clang-format again · d188bd70
      Igor Sugak authored
      Summary: as titled
      
      Reviewed By: Orvid
      
      Differential Revision: D12922934
      
      fbshipit-source-id: b283b905393d93fb41f18553f12ad33f335e1507
      d188bd70
    • Chad Austin's avatar
      Disallow Optional::operator=(nullptr_t) unless T is a pointer · 03f0917a
      Chad Austin authored
      Summary: The old implementation of folly::none inadvertently allowed disengaging an optional by writing `op = nullptr`. Disallow that and require `op = folly::none`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12884724
      
      fbshipit-source-id: b17bcf00b245069d8ea2d9bc3703b0fdcaa85c07
      03f0917a
    • Igor Sugak's avatar
      disable clang-format · 192033c9
      Igor Sugak authored
      Summary: Folly used to be clang-format clean, now it not. Disable clang-format for the violating subdirectory.
      
      Reviewed By: Orvid
      
      Differential Revision: D12922931
      
      fbshipit-source-id: 55dd9684a52b4471aadf18f27658509823f34db4
      192033c9
  7. 03 Nov, 2018 3 commits
    • Orvid King's avatar
      Remove C++11 guard because I want to run the test on Windows · b0b6fc97
      Orvid King authored
      Summary: As-per title.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12908262
      
      fbshipit-source-id: 6a9723add4f19b262b7dae9e105f9967041e31e2
      b0b6fc97
    • Nathan Bronson's avatar
      remove explicit transparent hasher from F14 usages with std::string key · c7188236
      Nathan Bronson authored
      Summary:
      F14 tables with a std::string key now support heterogeneous
      lookup by default (lookup and insert of StringPiece, std::string_view,
      ...).  This diff removes the explicit transparent hasher and equality
      that used to be needed to get this behavior.
      
      folly/experimental/StringKeyedUnorderedSet and Map will be removed later,
      as they are unnecessary.
      
      Reviewed By: ot, luciang
      
      Differential Revision: D12905270
      
      fbshipit-source-id: ecb990bb330866c089ba156f8be0a5b235c5574d
      c7188236
    • Nathan Bronson's avatar
      test auto-heterogeneity for fbstring · 9f56897b
      Nathan Bronson authored
      Summary:
      This extends the unit tests for auto-transparent hash and
      equality to verify that they apply to fbstring.
      
      Reviewed By: froody
      
      Differential Revision: D12908619
      
      fbshipit-source-id: cdff815be6cb8fda6695cf745b20181f81ee0dd9
      9f56897b
  8. 02 Nov, 2018 18 commits
    • Nathan Bronson's avatar
      namespace macro in SanitizeThread.cpp · 69b52db2
      Nathan Bronson authored
      Summary:
      Macro name should not use a name that might also be used
      outside folly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12901055
      
      fbshipit-source-id: a18bc33fdaabb339aa7539da12b5a82b95e282a7
      69b52db2
    • Orvid King's avatar
      Don't hardcode the value of ECONNREFUSED in AsyncSocketExceptionTest · 838f86a2
      Orvid King authored
      Summary: The value of `ECONNREFUSED` is different on different platforms, so we can't hard-code the value.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818063
      
      fbshipit-source-id: 94242a042bef75b391d075a74837b538083d242d
      838f86a2
    • Doron Roberts-Kedes's avatar
      BatonTest: initialize a DeterministicSchedule for tests using DeterministicAtomics · e1b1233a
      Doron Roberts-Kedes authored
      Summary: Using DeterministicAtomic without initializing a DeterministicSchedule doesn't offer determinism, and at the time of the last commit to this test, DeterministicAtomics did not even have atomic operations without a DeterministicSchedule. Initializing a DeterministicSchedule for these tests adds determinism and atomicity to the current DeterministicAtomics. This is will be required once to support atomic history buffers in the future.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D10478718
      
      fbshipit-source-id: f03629ab8683c05eff41eb4886d23d00d42615e8
      e1b1233a
    • Doron Roberts-Kedes's avatar
      Prevent deadlock for DeterministicAtomic in... · 1bab1e54
      Doron Roberts-Kedes authored
      Prevent deadlock for DeterministicAtomic in folly::hazptr_default_domain_helper<DeterministicAtomic>::get()
      
      Summary: Pre-initializing with folly::hazptr_default_domain_helper<DeterministicAtomic>::get() in the test setup avoids deadlock when two threads enter enter __cxa_guard_acquire.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10841885
      
      fbshipit-source-id: 5ed90a4c9a78cb339a37d90b6091870b1dd6a8ae
      1bab1e54
    • Doron Roberts-Kedes's avatar
      DistributedMutexTest: Use std::atomic instead of DeterministicAtomic for tests... · 07ad9800
      Doron Roberts-Kedes authored
      DistributedMutexTest: Use std::atomic instead of DeterministicAtomic for tests that do not initialize a DeterministicSchedule
      
      Summary: operations on DeterministicAtomic may not be atomic without a DeterministicSchedule. Changes planned to DeterministicAtomic to introduce buffering make operations non-atomic with a DeterministicSchedule, but also introduce an assert to explicitly catch this case. This diff changes the tests that will trigger the assert to use std::atomic.
      
      Reviewed By: aary
      
      Differential Revision: D11670861
      
      fbshipit-source-id: 84f4e7874048682728c699c90e987a9a7f15b198
      07ad9800
    • Doron Roberts-Kedes's avatar
      MPMCQueue: Fix anonymous union of T and Atom<T> treatment · d7626a92
      Doron Roberts-Kedes authored
      Summary: The previous code issued stores/loads to the non-atomic anonymous union members from partially specialized Dynamic=true code. This breaks when Atom is a class that doesn't behave like a std::atomic.
      
      Reviewed By: magedm
      
      Differential Revision: D10502987
      
      fbshipit-source-id: 8c4670df98dbc830593b5f0edaaa56e2d8842719
      d7626a92
    • Doron Roberts-Kedes's avatar
      RelaxedConcurrentPriorityQueue: Replace store acq_rel with release · 85cf282f
      Doron Roberts-Kedes authored
      Summary: store with acq_rel is undefined. Found while testing BufferedAtomic.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10509918
      
      fbshipit-source-id: 397381c5f9060be5822bf0977aa0e7ebee1cd836
      85cf282f
    • Doron Roberts-Kedes's avatar
      LifoSem Mem Pool: Avoid deadlock during static initialization · 907063a6
      Doron Roberts-Kedes authored
      Summary:
      There is probably a better solution than this, but wanted to publish this diff to point out the issue.
      
      If DeterministicSchedule has been initialize befored the first invocation of LifoSemRawNode<DeterministicAtomic>::pool(), the thread invoking LifoSemRawNode<DeterminsiticAtomic> will
      enter __cxa_guard_acquire and the DeterministicAtomic constructor.
      
      Implementations of DeterminsticAtomic may be modified to use
      DeterministicSchedule::beforeSharedAccess() in the constructor, which will
      deadlock if a second thread invokes LifoSemRawNode<DeterministicAtomic>::pool()
      before the first thread is rescheduled. For example, BufferedAtomic requires
      shared access during the constructor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10478693
      
      fbshipit-source-id: eeb09be9ad0fa06c0bb957fff4d56d120b31c6ee
      907063a6
    • Doron Roberts-Kedes's avatar
      IndexedMemPool: Initialize and destroy Atom in slots_ · df9c39d7
      Doron Roberts-Kedes authored
      Summary:
      This is only a bug when Atom != std::atomic (for example when Atom = DeterministicAtomic) since the mmap region is zero-intialized, and the std::atomic constructor does no initialization other than zero initialization. However, this assumption does not hold when Atom != std::atomic.
      
      I'm not super familiar with the details of IndexedMemPool, so perhaps there is a more clever way to initialize and destroy the Atom instances in slots_, but I decided to go with this simple solution since it only modifies the construtor and destructor.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10277293
      
      fbshipit-source-id: 1e70a07963117b04e76f341c5b5148602d4ca48d
      df9c39d7
    • Orvid King's avatar
      Bind with refs rather than pointers · c1585ed8
      Orvid King authored
      Summary: This silences HowToEven's nullability warning.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12889459
      
      fbshipit-source-id: c460bf3bbb6c4c10df5a2aabbf99689c31bc2d21
      c1585ed8
    • Andrii Grynenko's avatar
      Improve tail call optimization · 0ec1d370
      Andrii Grynenko authored
      Summary:
      Existing tail call optimization implementation only works if the returned future already had callback set by the time the future returned by .then() callback is completed, which makes it's behavior racy.
      This diff takes a slightly different approach by adding a new mode to Core, which makes it forward callback to another Core, once the callback is set.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12837044
      
      fbshipit-source-id: 13ad822d8dfdcef8bb5a28108c24195ae911550b
      0ec1d370
    • Nathan Bronson's avatar
      move TSAN annotation hook declarations out of header · 20f2b04c
      Nathan Bronson authored
      Summary:
      AnnotateBenignRaceSized is prototyped with a long size arg in
      some third-party libraries and a size_t arg in others.  This diff moves
      folly's prototypes for the TSAN hooks out of a widely-included header
      file so that the incompatible declarations can coexist.  This function
      is declared with C linkage, so the mismatch is not a problem at link time.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12881785
      
      fbshipit-source-id: af1b7404d9c3d9b728105591c112143d7388f4f9
      20f2b04c
    • Orvid King's avatar
      Support NetworkSocket in FileUtil · 89f3eed9
      Orvid King authored
      Summary: As-per title, these functions need NetworkSocket support.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12813114
      
      fbshipit-source-id: cc49aa9478d728ff3d1bd4fcb8957083066f7d8a
      89f3eed9
    • Orvid King's avatar
      Add NetworkSocket support to AsyncUDPSocket · 350de5c9
      Orvid King authored
      Summary: More along the path.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10847193
      
      fbshipit-source-id: 5d946855c00752d23c012f2c91f07d276760d371
      350de5c9
    • Orvid King's avatar
      Add NetworkSocket support to EventHandler · b2208566
      Orvid King authored
      Summary: Add overloads to various places and forward the file descriptor versions to the NetworkSocket forms.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10843917
      
      fbshipit-source-id: f1b6958eac2f23dc788e1a3a3557baeed38284f1
      b2208566
    • Orvid King's avatar
      Add NetworkSocket support to SocketAddress · fbbbcf80
      Orvid King authored
      Summary: The first step on the path
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10355407
      
      fbshipit-source-id: 01eec439ae65484e233d5fe94977643d7ab2ed6d
      fbbbcf80
    • Orvid King's avatar
      Back libevent file descriptor transformation with the fd<->socket map · ceebc296
      Orvid King authored
      Summary: Currently it's just leaking file descriptors, stop that by backing it with the map.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10842827
      
      fbshipit-source-id: 434d7463ede1639e0fa2edf0be438aa561b39b16
      ceebc296
    • Chad Austin's avatar
      Add explicit operator=(None) to Optional · 5ea1ed7e
      Chad Austin authored
      Summary:
      In a minor way, this improves folly::Optional's compliance with std::optional. `op = folly::none` used to work by instantiating an empty optional and passing that in. This is more direct.
      
      The existence of this assignment operator is why folly::None must not have a default constructor to support `op = {}` syntax for disengaging the optional.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12842963
      
      fbshipit-source-id: 757bb66030a667ef0bc1cbe56d150740e712ed45
      5ea1ed7e