1. 08 May, 2020 5 commits
    • Lukas Piatkowski's avatar
      rust: remove abandoned heapsize crate · 9285064e
      Lukas Piatkowski authored
      Summary: This also unblocks the MacOS Mononoke builds, so enabling them back
      
      Reviewed By: farnz
      
      Differential Revision: D21455422
      
      fbshipit-source-id: 4eae10785db5b93b1167f580a1c887ee4c8a96a2
      9285064e
    • Lukas Piatkowski's avatar
      mononoke/fbcode_builder: bring back mononoke manifests for getdeps build · a0458616
      Lukas Piatkowski authored
      Summary:
      The breakage has been fixed, so bring back the manifest, but only the Linux one, because the Mac version is failing due to another issue.
      
      Also to make it easier to debug issues on GitHub Actions separate out the dependencies build from Mononoke and rust-shed builds.
      
      Reviewed By: krallin
      
      Differential Revision: D21448412
      
      fbshipit-source-id: 68d89c858d1692727a7fd66bca114920e6dfb4dc
      a0458616
    • Nathan Bronson's avatar
      callWithExtractedKey fix for pair of lvalue ref, improvements · 7d618e4f
      Nathan Bronson authored
      Summary:
      callWithExtractedKey previously incorrectly translated
      std::pair<X&,Y&>&& into X&&, Y&&, when reference collapsing rules call
      instead for X& and Y&.  This diff fixes the problem, adds unit tests,
      and also targets the 2-argument std::pair constructor when possible.
      This means that callWithExtractedKey can be safely used on top of
      libc++'s std::unordered_map::emplace without disabling the key-finding
      optimization in that method.  (That lib's emplace is clever enough to
      be able to search on the key before constructing a node, but does not
      include the logic to unwrap the std::pair 3-arg piecewise constructor.)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21419822
      
      fbshipit-source-id: d3c61e45d7fe7d8c6805342bbe63a8c866f4e306
      7d618e4f
    • Maged Michael's avatar
      ConcurrentHashMap: Add clarifying comments · fa2e7912
      Maged Michael authored
      Summary: Add comments about the performance of frequent removal and mention clear() in the comment about the timing of destruction of removed key-value pairs.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D21455366
      
      fbshipit-source-id: be9f80136260f2de3b68d6fff54ccdadc5544046
      fa2e7912
    • Lewis Baker's avatar
      Add folly::coro::AsyncScope · b7457e50
      Lewis Baker authored
      Summary:
      This class makes it easier to spawn an unbounded number of tasks
      over time within a given scope and then later wait for all of
      those tasks to complete. e.g. during shutdown.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D21391413
      
      fbshipit-source-id: c91c66aa61a8ae30e04d0608426037d8adba14d7
      b7457e50
  2. 07 May, 2020 7 commits
    • Adam Simpkins's avatar
      update AsyncFileWriter to avoid writevFull() on Windows · 8c357b33
      Adam Simpkins authored
      Summary:
      Change folly/logging's AsyncFileWriter code to avoid calling writevFull() on
      Windows.  On POSIX system we use this function to minimize the number of
      system calls we make.  However, on Windows there is no `writev()` function
      provided by the system, so folly emulates this by performing multiple separate
      `write()` calls.  Given that we are just going to perform multiple `write()`
      calls there is no reason to construct the iobuf data structure here.
      
      Differential Revision: D21367424
      
      fbshipit-source-id: 8f6ba9d5fb36318a33d293a416008cd7fa03cb70
      8c357b33
    • Adam Simpkins's avatar
      update AsyncLogWriter::performIO() to take the vector by reference · f121101a
      Adam Simpkins authored
      Summary:
      Update the `AsyncLogWriter::performIO()` API to take the vector of messages by
      const reference, rather than by modifiable pointer.  This parameter is purely
      an input parameter, and shouldn't be modified by the `performIO()` code, so it
      makes more sense to take this as const reference.
      
      Differential Revision: D21367425
      
      fbshipit-source-id: 4bbf3a58dd48bb620101ec3982b189bea656b301
      f121101a
    • Andrii Grynenko's avatar
      Fix blockingWait to schedule task on the DrivableExecutor · 439c7b22
      Andrii Grynenko authored
      Summary: The first portion of the task (before the first suspension point) was run inline.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21460275
      
      fbshipit-source-id: 31d50e15d5890fbc7127dfff424a4e814dcb2320
      439c7b22
    • Yedidya Feldblum's avatar
      copy_to_unique_ptr, copy_to_shared_ptr · 34ea33d2
      Yedidya Feldblum authored
      Summary: [Folly] `copy_to_unique_ptr`, `copy_to_shared_ptr` - type-deducing wrappers around `make_unique` and `make_shared`.
      
      Reviewed By: vitaut
      
      Differential Revision: D21332222
      
      fbshipit-source-id: f41dac0fcfa972118d3a721194c941e14511a80c
      34ea33d2
    • Ravindra Sunkad's avatar
      Update FBOSS OSS build to link with v4.12.0 of iproute2 · 4fffe6ad
      Ravindra Sunkad authored
      Summary:
      fboss-oss build links to hash that corresponds to tag v4.4.0 released on Jan 11 2016
      
      ```
      repo_url = https://git.kernel.org/pub/scm/linux/kernel/git/shemminger/iproute2.git
      rev = 92a0236a3cdf3438000834121b7ea8a09f1f52b1
      ```
      
      The change is to update the iproute2 version to ```v4.12.0``` (July 5 2017) to match with the version used internally to Facebook
      
      Reviewed By: shri-khare
      
      Differential Revision: D21411714
      
      fbshipit-source-id: fac606396e284193bb7199cf60d2601594bfa5f0
      4fffe6ad
    • Hasnain Lakhani's avatar
      Add manifest for fatal · 15cf7e67
      Hasnain Lakhani authored
      Reviewed By: wez
      
      Differential Revision: D21417542
      
      fbshipit-source-id: f7f0726e84db3dc903bf11c9045a9975a3e90234
      15cf7e67
    • Adam Simpkins's avatar
      define FOLLY_XLOG_STRIP_PREFIXES correctly for all targets · 2c064a01
      Adam Simpkins authored
      Summary:
      The `FOLLY_XLOG_STRIP_PREFIXES` macro tells folly::logging how to strip off
      the absolute portion of the path when automatically computing log category
      names from the source file name.
      
      Previously this was set in FollyCompilerUnix.cmake, which caused it to only be
      applied on Linux/Mac platforms, and only for targets that explicitly used
      `apply_folly_compile_options_to_target()`.
      
      This changes the code to apply this definition with a directory property, so
      it affects all targets under the top-level directory, and it is also applied
      on Windows.
      
      Reviewed By: wez
      
      Differential Revision: D21333014
      
      fbshipit-source-id: 9256e14ab4fd03d19f28957e7ca298c930a22b18
      2c064a01
  3. 06 May, 2020 7 commits
    • Kyle Nekritz's avatar
      Back out "Give ownership of new session callbacks to SSLContext" · 82070c96
      Kyle Nekritz authored
      Summary:
      Original commit changeset: f1dc8bd17150
      
      This accidentally enabled the openssl internal session cache which can use
      excessive memory.
      
      Reviewed By: jalopezsilva, mingtaoy
      
      Differential Revision: D21433514
      
      fbshipit-source-id: 91358f6fd2decc0d18eff7ca8194b677f3c8629c
      82070c96
    • Adam Simpkins's avatar
      build and run FileUtilTest in CMake builds · 6808eb56
      Adam Simpkins authored
      Summary:
      Remove the `HANGING` tag from this test, so that it is run by default in the
      CMake build.
      
      Differential Revision: D21367512
      
      fbshipit-source-id: 4bb707c83005ee8cd39ed2ce6b82b7f0c53f2c88
      6808eb56
    • Adam Simpkins's avatar
      disable the writeFileAtomic() function on Windows · 06302af7
      Adam Simpkins authored
      Summary:
      This puts the `writeFileAtomic()` function behind and `#ifndef _WIN32` check,
      to disable it on Windows.
      
      While this function currently compiles on Windows, it does not behave
      correctly: it often fails with "Permission denied" errors when trying to use
      folly's emulated `fchmod()` function.  Additionally, even the `fchmod()`
      succeeds (or is skipped) it fails if the destination path already exists, as
      `rename()` on Windows does not allow replacing an existing file.  While we
      could attempt to replace the existing file, doing so would not be atomic.  We
      might be able to achieve this with transactional NTFS features if the
      underlying file system is NTFS, but according to Microsoft these APIs are
      discouraged and may be removed in future versions of Windows.
      
      Therefore for now simply disable `writeFileAtomic()` on Windows.
      
      Differential Revision: D21367511
      
      fbshipit-source-id: 50a5a1004feacc8bdb0a24421bea339962e1d546
      06302af7
    • Adam Simpkins's avatar
      build the logging example in CMake builds · 6af9edb3
      Adam Simpkins authored
      Summary:
      Add a CMakeLists.txt file to build the logging example program in CMake
      builds.
      
      This also disables the `AsyncFileWriter.fork` test on Windows, since `fork()`
      isn't available on Windows.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21332968
      
      fbshipit-source-id: b578df92576e79d34b7fe2bf79dc8f30e0fd6d6b
      6af9edb3
    • Adam Simpkins's avatar
      update the logging example to reflect the current default level · 282cc3f6
      Adam Simpkins authored
      Summary:
      D8941725 changed the default log level from WARNING to INFO.  This updates the
      comments in the example logging program to reflect that.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21332969
      
      fbshipit-source-id: 88b206bf4dc891d8868a34ea02d91cc79b7c5c48
      282cc3f6
    • Wez Furlong's avatar
      getdeps: fix builds with cached project downloads · aef5dd9e
      Wez Furlong authored
      Summary:
      D21364132 accidentally broke this; we can't run the fetcher
      for projects for which we pulled the build out of cache, because there
      is no source to update in that case.
      
      This commit adjusts the logic so that we write out a marker file
      to indicate that we installed a build from cache and to look for
      that file being present to gate the new update logic.
      
      Reviewed By: lnicco
      
      Differential Revision: D21419122
      
      fbshipit-source-id: 304670848add22531d88549d66f22c40ff255140
      aef5dd9e
    • Dan Melnic's avatar
      Return 0 from PollIoBackend::eb_event_add if the event type is not set · 911311ab
      Dan Melnic authored
      Summary: Return 0 from PollIoBackend::eb_event_add if the event type is not set
      
      Reviewed By: danobi
      
      Differential Revision: D21416811
      
      fbshipit-source-id: 5825e473dca06d33017785e4d73947aade5f554c
      911311ab
  4. 05 May, 2020 18 commits
    • Maged Michael's avatar
      hazptr: Add warnings for pathological performance. · 831d84b5
      Maged Michael authored
      Summary:
      Add warnings for pathological cases:
      - Too large retired lists
      - Thread cache overflow
      
      Move the warning for executor backlog to a separate function for clearer profiling.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D21314798
      
      fbshipit-source-id: e07d6182309a0940adbdf76774a9c44fb1aa200c
      831d84b5
    • Andrew Huang's avatar
      Give ownership of new session callbacks to SSLContext · 2ee65365
      Andrew Huang authored
      Summary: Giving SSLContext ownership over the new session callback attached to SSL_CTX, so that it may do additional work with the new session (i.e. forward the session to its corresponding abstracted SSLSession).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21021333
      
      fbshipit-source-id: f1dc8bd17150d45498ae1c22ef4eed1d2ca00c01
      2ee65365
    • Andrew Huang's avatar
      Add SSLContext to OpenSSL SSL_CTX ex data · d908fe0b
      Andrew Huang authored
      Summary: Adding SSLContext members to SSL_CTX ex data to access them inside callbacks attached to SSL_CTX (e.g. session callbacks)
      
      Reviewed By: yfeldblum, mingtaoy
      
      Differential Revision: D21021353
      
      fbshipit-source-id: 6aa3995f7d719ca7e87bad798876a92dd5765b86
      d908fe0b
    • Lewis Baker's avatar
      Clarify documentation in folly::coro::Task about when RequestContext is captured · aee68ea3
      Lewis Baker authored
      Summary:
      Clarify that the RequestContext is captured at the time the coroutine is
      started (e.g. due to co_awaiting it or calling .start()) rather than at
      the time the coroutine is called.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D21353947
      
      fbshipit-source-id: 40ec7b25d84e96a611a1f63b6184a0d6a016948d
      aee68ea3
    • Shannon Zhu's avatar
      Convert type check targets in folly to use configuration · c230732e
      Shannon Zhu authored
      Summary:
      Migrating buck integration to use configurations, which is more performant and is the primary supported way to run Pyre.
      Mypy is no longer supported at Facebook, so mypy buck integration is covered in this migration as well.
      
      Reviewed By: grievejia
      
      Differential Revision: D21398810
      
      fbshipit-source-id: 12c0cd395e243703f4380b31527d0c202d58cec2
      c230732e
    • Adam Simpkins's avatar
      implement readvFull() and writevFull() using read()/write() on Windows · b88ccd9e
      Adam Simpkins authored
      Summary:
      On Windows, implement `readvFull()` and `writevFull()` by calling `read()` and
      `write()` repeatedly, rather than `readv()` and `writev()`.
      
      Windows does not provide native implementations of `readv()` and `writev()`,
      so the code was previously using implementations provided by folly in
      `folly/portability/SysUio.cpp`.  The folly implementations attempted to lock
      the file to provide similar atomicity guarantees that `readv()` and `writev()`
      provide on POSIX.  However, callers of `readvFull()` and `writevFull()` don't
      care about this atomicity (since they are willing to do multiple `readv()` and
      `writev()` calls if necessary).  Therefore this locking behavior is not
      needed.  Locking in this case is undesirable because it adds extra overhead,
      and fails in some cases.  For instance, attempting to lock stderr blocks for 9
      seconds before eventually failing.
      
      Differential Revision: D21367446
      
      fbshipit-source-id: b2ae3c9c5da977402336c750d3d21ba9825527d9
      b88ccd9e
    • Dan Melnic's avatar
      Use zerocopy only if all the IOBufs in the chain have a SharedInfo · e5c56348
      Dan Melnic authored
      Summary: Use zerocopy only if all the IOBufs in the chain have a SharedInfo
      
      Reviewed By: knekritz
      
      Differential Revision: D21342852
      
      fbshipit-source-id: 458c32ef336b76ed0dc226ea670b7c04c1427bee
      e5c56348
    • Andrew Huang's avatar
      Handle session resumption with abstracted SSLSession · 3bd6e353
      Andrew Huang authored
      Summary: Add session resumption functionality in AsyncSSLSocket for the new abstracted SSLSession. Add logic to resume sessions correctly no matter which API is used, allowing for a piecewise transition to using the abstracted SSLSession.
      
      Reviewed By: mingtaoy
      
      Differential Revision: D20600380
      
      fbshipit-source-id: bb81d5be95ccaa6486a7431391676f3e5c0b5b8e
      3bd6e353
    • Nate Stedman's avatar
      Fix some broken documentation comments · 1972a4b5
      Nate Stedman authored
      Summary: I temporarily enabled Clang's `-Wdocumentation` flag, which reports things like using an `param` for a parameter that doesn't exist. [Full explanation with examples here](https://clang.llvm.org/docs/DiagnosticsReference.html#wdocumentation).
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21396362
      
      fbshipit-source-id: d7b34bc14af7bb1b0901a8f195c02674eb587fbc
      1972a4b5
    • Lukas Piatkowski's avatar
      mononoke/opensource: temporarily remove mononoke manifest · 7c383d4e
      Lukas Piatkowski authored
      Summary: The oss jobs are causing problems to the developers now, lets disable them temporarily.
      
      Reviewed By: StanislavGlebik
      
      Differential Revision: D21400898
      
      fbshipit-source-id: f7a3567056633d9eef98a8d05a37cd029c9e506c
      7c383d4e
    • Xavier Deguillard's avatar
      windows: default to c++17 · 6fad3d5a
      Xavier Deguillard authored
      Summary:
      While compiling EdenFS on Windows, for every single file being compiled,
      cl.exe complains that 2 incompatible /std option are being passed in on the
      command line, a c++latest, and a c++17. The former is added by this file,
      while the later is added by cmake via CMAKE_CXX_STANDARD.
      
      I'm not exactly sure why the default is set to c++latest, but it's guaranteed
      to always force cl.exe to generate a warning, as it simply cannot be set via
      CMAKE_CXX_STANDARD.
      
      A better fix to this would be to set CMAKE_CXX_STANDARD to 17, but since
      folly still supports cmake 3.0, that didn't know about c++17, this can't
      be done.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21392360
      
      fbshipit-source-id: fc0e29ed89adf0a2c0b0193e7bd5f033463ed376
      6fad3d5a
    • Ilya Maykov's avatar
      add support for VAES and VPCLMULQDQ CPUID flags · 6f06ca66
      Ilya Maykov authored
      Summary: Add support for detecting x86_64 vectorized AES (VAES) and vectorized carry-less multiplication (VPCLMULQDQ) CPU flags.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21271564
      
      fbshipit-source-id: 08be20c07d6dfb562b8a0c1e86b77a9a416445fb
      6f06ca66
    • Wez Furlong's avatar
      getdeps: fix an fbsource invalidation problem · 257e0716
      Wez Furlong authored
      Summary:
      When the commit hash changed in fbsource, we would correctly decide
      that we'd need to rebuild first-party projects but we would incorrectly skip
      running the fetcher.update method.  This would mean that we'd not perform the
      shipit run and that our shipit tree would diverge from the source tree.
      
      This commit resolves this by performing the fetcher.update but ignoring
      the source update status in this case.
      
      Reviewed By: xavierd
      
      Differential Revision: D21364131
      
      fbshipit-source-id: b4001e549c7d3f27aa4a21b19893c9bb7c0f6d1f
      257e0716
    • Wez Furlong's avatar
      getdeps: improve build invalidation for dependencies · 2c34ec09
      Wez Furlong authored
      Summary:
      We didn't do a great job of recognizing that we'd need to
      build a project when one of its dependencies had changed: we relied
      chiefly on the dependency hash for this and could fail to handle
      changes in individual source files.
      
      This commit helps to improve this situation by checking to see if
      any installed files in the dependencies of a manifest are newer than
      the most recent built time of a given manifest.  If so, we'll trigger
      a build.  We try to be reasonably smart about deciding when to trigger
      a cmake reconfigure if it looks like cmake files in the deps have
      been changed.
      
      Reviewed By: xavierd
      
      Differential Revision: D21364132
      
      fbshipit-source-id: 7534496e10d1f532aa9cf865900ace84a8785327
      2c34ec09
    • Wez Furlong's avatar
      getdeps: refine makefiles matcher for cmake reconfigure · d8168ba9
      Wez Furlong authored
      Summary:
      Only run cmake reconfigure for .cmake, .cmake.in and CMakeLists.txt
      files changes.
      
      Previously we would reconfigure for any change to a file with a path that
      matched `cmake` which could result in false positives in cases where
      you may be iterating on .py or .c files in shared cmake directories.
      
      This also reclassifies non-cmake files under fbcode_builder/CMake as source
      files so that we run cmake for those; previously they would cause a
      reconfigure and build, now they just cause a build.
      
      Reviewed By: xavierd
      
      Differential Revision: D21364133
      
      fbshipit-source-id: a1231f657d6c6056b269656c677d3449d8715cf6
      d8168ba9
    • Wez Furlong's avatar
      getdeps: code formatting · 99536b53
      Wez Furlong authored
      Summary:
      Our linter really wants to include formatting changes unrelated
      to my diff stack.
      
      This is a formatting only change to avoid clouding my diffs; no functional
      effect.
      
      Reviewed By: xavierd
      
      Differential Revision: D21364519
      
      fbshipit-source-id: 7670dd4154e788f593f256aabdfdeef6d17aeec4
      99536b53
    • Adam Simpkins's avatar
      getdeps: avoid blowing away too much data when invalidating the CMake cache · 4fbb7cf2
      Adam Simpkins authored
      Summary:
      Previously getdeps would remove the entire top-level `CMakeFiles` directory
      from the build output when it wanted to invalidate the CMake cache.  This
      directory is used to keep all of the compiled object files for any libraries
      or executables defined in the top-level CMakeLists.txt file.  Blowing away
      this directory forces all of these sources to be re-compiled, even if this was
      not necessary.  This is particularly problematic for folly, which compiles all
      of its source files via rules in the top-level CMakeLists.txt target file.
      
      I did have the code still blow away the CMake error and output logs in this
      directory: in the past I have seen situations where CMake would not update
      these files on new CMake runs if they already existed.
      
      Reviewed By: wez
      
      Differential Revision: D21360668
      
      fbshipit-source-id: 6fcd1a8e371d756114fbab60d8636be8cd5f8978
      4fbb7cf2
    • Adam Simpkins's avatar
      getdeps: indicate that folly depends on lz4 · 97a2fc14
      Adam Simpkins authored
      Summary:
      Update the manifest file for folly to indicate a dependency on lz4.
      folly does not require lz4 be available, but it will use it if it is found at
      configure time.
      
      getdeps is unfortunately not strict about providing projects only with the
      dependencies that they require at build time.  This causes it to sometimes
      make lz4 available to folly (if you are also building another project that
      requires lz4), and sometimes not.  This ends up causing changes in
      folly-config.h depending on which projects you are building, forcing all of
      the folly sources to be recompiled.
      
      In the future we perhaps should update getdeps to consistently only pass in
      include directories for dependencies actually listed in the manifest file.
      However, specifying that folly depends on lz4 also works to mitigate this
      particular issue for now, and it is also generally desirable to build folly
      with lz4 support.
      
      Reviewed By: wez
      
      Differential Revision: D21359995
      
      fbshipit-source-id: aaf61671b7750d6c47e3613c732d220b3311b5ba
      97a2fc14
  5. 04 May, 2020 2 commits
    • Yedidya Feldblum's avatar
      c_array · d7d48e47
      Yedidya Feldblum authored
      Summary: [Folly] `c_array`, a container for returning C arrays from `constexpr` functions. May be used until C++17 may be assumed, since C++17 specifies `constexpr` member functions of `std::array` which make `std::array` suitable for the purpose and a better choice since it  can house zero-sized arrays.
      
      Reviewed By: markisaa
      
      Differential Revision: D21382680
      
      fbshipit-source-id: 56a6528bb05988c1f1c8916f9267575783dc6276
      d7d48e47
    • Misha Shneerson's avatar
      fix SharedPtr initialization · c518e9ec
      Misha Shneerson authored
      Summary: fix D21371986's sadness (SEGV  for `folly::make_exception<TException>().class_name()`)
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21373766
      
      fbshipit-source-id: 0dd951fd9393e73c5c38670167312c3d2e619fb5
      c518e9ec
  6. 01 May, 2020 1 commit
    • Andrew Doran's avatar
      Back out "Disable TSAN instrumentation across StaticMetaBase::onThreadExit()." · 98419a68
      Andrew Doran authored
      Summary:
      Sorry about the churn (& time spent on this), but this backs out the change in D20671620.
      
      Despite best efforts it seems I've missed something and the issue runs deeper than TSAN observing thread exit.
      
      My change has possibly only altered the timing of events, and has exposed another related failure during testpilot runs that didn't occur before, so I think it's best to return to baseline.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D21310561
      
      fbshipit-source-id: 369865f185415123ea8fddf6007115b87ea8fe82
      98419a68