1. 15 Nov, 2018 1 commit
    • Andrew Gallagher's avatar
      folly: rename `folly/container/HeterogeneousAccess-pre.h` · 09408821
      Andrew Gallagher authored
      Summary:
      This is meant to be included by other rules, so don't use the `-inl.h` suffix
      which is reserved for rule-private headers.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13056539
      
      fbshipit-source-id: 5c36d4473f041f5e8dea9458fc12f71e1e9ac613
      09408821
  2. 14 Nov, 2018 6 commits
    • Maged Michael's avatar
      hazptr: Batches and tags for managing destruction order. · b2df58ec
      Maged Michael authored
      Summary:
      Add batches and tags for objects protectable by hazard pointers.
      Add fine-grained cleanup of tagged objects (lower overhead than calling hazptr_cleanup).
      
      Design sketch:
      - The domain structure contains an untagged list and one or more tagged lists (more than one to reduce contention).
      - These domain lists support lock-free push and lock-free unlocked pop all. Tagged lists are locked by pop all operations and unlocked by push_unlock operations. Push operations are  lock-free even when a list is locked for pop all operations.
      - Batches are lists of retired objects.
      - Each object contains the address of a batch (or null). The lowest bit indicates if the batch address is used also as a tag.
      - hazptr_cleanup_batch_tag(tag) reclaims all objects with that tag without checking hazard pointers.
      - All objects in a domain tagged list contain tagged objects that hash to the index of the list.
      - Untagged object are those that are safe to reclaim at shutdown time, i.e., their deleter only reclaims memory without other dependencies.
      - For example, retired UnboundedQueue segments do not depend on user-defined destructors and their deleters merely reclaim memory using the default deleter, and therefore can be untagged.
      - On the other hand, the deleters of ConcurrentHashMap buckets and nodes depend on user-defined code and therefore their destruction must be managed explicitly. Therefore they are tagged.
      - Batches can be used even without tagging. For example retired UnboundedQueue segments are collected in batches because they have link-counting interdependencies and batches help keep related segments together.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D10147101
      
      fbshipit-source-id: 8820cf46ad8942c7362d91543bfbd9fe07e27b7a
      b2df58ec
    • Mingtao Yang's avatar
      SSLContext::loadCertificateFromBufferPEM should load entire chain · 77f06ada
      Mingtao Yang authored
      Summary:
      SSLContext::loadCertificate() loads a certificate chain with SSL_CTX_use_certificate_chain_file.
      
      A method named SSLContext::loadCertificateFromBufferPEM() should have the same semantics.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13037752
      
      fbshipit-source-id: da7b150065d2207421c6bba86d44ce5e2c57e1a9
      77f06ada
    • Lee Howes's avatar
      Split folly::futures::map over value and Try forms · df642f04
      Lee Howes authored
      Summary: Splits folly::futures::map over forms that take value continuations and try continuations. This allows the implementation to call Future::thenValue and Future::thenTry correctly.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D10861465
      
      fbshipit-source-id: 31044127f43e574edcc01c6bb173ecc4f0c9c90e
      df642f04
    • Yiding Jia's avatar
      Fix folly/Range.h with c++17 and libc++ again · 90ae95ed
      Yiding Jia authored
      Summary:
      Avoid create StringViewType if value_type is not POD, as with libc++ there is a
      static_assert in the class body which seems to fail.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13015696
      
      fbshipit-source-id: 090e5cd3f5e21aa8c22ea893e894b38fd3d2a745
      90ae95ed
    • Andrew Gallagher's avatar
      folly/executors: fix extraneous semi-colon · faa7f7fb
      Andrew Gallagher authored
      Reviewed By: yfeldblum
      
      Differential Revision: D13056552
      
      fbshipit-source-id: 910296cda7d392972a48c8fa3e425b4bdeaa5d26
      faa7f7fb
    • Yedidya Feldblum's avatar
      Move asm_rdtsc to its own header and rename · aedf6079
      Yedidya Feldblum authored
      Summary: [Folly] Move `asm_rdtsc` to its own header and rename to `hardware_timestamp`.
      
      Reviewed By: aary, Orvid
      
      Differential Revision: D10368436
      
      fbshipit-source-id: 88a6d1d50702e80fb3ebba5035116850c49df6ea
      aedf6079
  3. 13 Nov, 2018 6 commits
  4. 12 Nov, 2018 12 commits
    • Orvid King's avatar
      Convert ShutdownSocketSetTest to use NetworkSocket · 1d27782a
      Orvid King authored
      Summary: Convert the tests as well
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12981682
      
      fbshipit-source-id: b07567802c4ddba0e0d1fbab7ea021b9ea948c42
      1d27782a
    • Orvid King's avatar
      SSLSessionTest now uses NetworkSocket · 17aa81d3
      Orvid King authored
      Summary: Port more things over.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12989142
      
      fbshipit-source-id: 6066978e42080748658cbe6ff94034037af2c656
      17aa81d3
    • Orvid King's avatar
      NetworkSocket support in SocketPair · 95ceac65
      Orvid King authored
      Summary: More!
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818656
      
      fbshipit-source-id: acb269258524ae22bf8761407713b89cf3d57a3a
      95ceac65
    • Orvid King's avatar
      NetworkSocket support for AsyncSSLSocket · 1f1d9662
      Orvid King authored
      Summary: More things.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818556
      
      fbshipit-source-id: 8e839489eb92a3ec3f0ac391c157ad3de42d596b
      1f1d9662
    • Orvid King's avatar
      NetworkSocket support for BlockingSocket · e47087b7
      Orvid King authored
      Summary: Just keep porting, just keep porting.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818498
      
      fbshipit-source-id: 48d404ed17caa79c241e2facc1a3d93715ce02cb
      e47087b7
    • Orvid King's avatar
      NetworkSocket support for AsyncSocket · c7b21fd1
      Orvid King authored
      Summary: This is a big one, but adds support for NetworkSocket to AsyncSocket itself.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818493
      
      fbshipit-source-id: d7b73f356414b006f4fc6b1c380a8fa1c32b9a46
      c7b21fd1
    • Orvid King's avatar
      NetworkSocket support for SocketFastOpen · 083c73bd
      Orvid King authored
      Summary: More support infrastructure.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818441
      
      fbshipit-source-id: b6d3a276ea332eccf8c6f43484fd25ec543bcc08
      083c73bd
    • Orvid King's avatar
      NetworkSocket support for OpenSSLUtils · f4c9e7d2
      Orvid King authored
      Summary: More support means more diffs, as many small ones as possible.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818383
      
      fbshipit-source-id: be364e01d8d6d7b7419a2fc870c93dafcba5d2b1
      f4c9e7d2
    • Orvid King's avatar
      Support NetworkSocket in ShutdownSocketSet · f5cc18a3
      Orvid King authored
      Summary: More places supporting NetworkSocket.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D12818369
      
      fbshipit-source-id: 6ee0ce2dde3283ea7fd8f657329dc55c78c90714
      f5cc18a3
    • Kirk Shoop's avatar
      force newlines and lint · d580d889
      Kirk Shoop authored
      Summary: discovered that trailing single-line comment token will force clang-format to keep a new-line. used this and clang format to get some of the files clang-format clean while still being more-or-less readable
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13016291
      
      fbshipit-source-id: 0c3428e52f3366d9d90b32a551d8853d163b8298
      d580d889
    • Kirk Shoop's avatar
      fix CTAD for receiver · 10da1e9d
      Kirk Shoop authored
      Summary: used the wrong Concept to constrain the receiver CTAD for a value function.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D13027571
      
      fbshipit-source-id: 5478afbb10c5145960cc6107c173da2bf241b9bc
      10da1e9d
    • Matt Glazar's avatar
      Improve assertion messages from Random::secureRandom · 486c6593
      Matt Glazar authored
      Summary:
      When the PCHECK for read() in Random::secureRandom fails, the message is often misleading.
      
      In the following case, bytesRead != size caused the assertion failure. Unfortunately, the message includes an unrelated error message ("No such file or directory"), which can throw people off:
      
        F1031 13:15:26.997059 270573 Random.cpp:69] Check failed: bytesRead >= 0 && size_t(bytesRead) == size : No such file or directory [2]
      
      Improve the message by splitting the PCHECK into a PCHECK (for the read() error) and a CHECK_EQ (for the logic error):
      
        F1108 17:33:31.771008 3185333 Random.cpp:70] Check failed: size_t(bytesRead) == size (112960 vs. 1048576)
      
      Reviewed By: yfeldblum, simpkins
      
      Differential Revision: D12856276
      
      fbshipit-source-id: fe9067972db805a54f2cc290aab11bac425601ef
      486c6593
  5. 11 Nov, 2018 2 commits
  6. 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
  7. 08 Nov, 2018 5 commits
  8. 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