1. 15 Jun, 2017 3 commits
    • Maged Michael's avatar
      Add thread caching of hazard pointers. Benchmarks. Minor fixes, optimizations, and refactoring. · 1d83c51f
      Maged Michael authored
      Summary:
      Added support for thread caching of hazard pointers.
      Added thread caching benchmarks.
      Removed function call from hazptr_domain constexpr constructor.
      Optimizations of memory order and code refactoring.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D5249070
      
      fbshipit-source-id: 487fb23abccde228c3c726de4ac8e9f07bfa9498
      1d83c51f
    • Neel Goyal's avatar
      Fix a memory leak in 1.1.0 related to initial_ctx · 4ecd9abf
      Neel Goyal authored
      Summary: We would always up_ref the ctx before setting it as the initial_ctx.  This causes a leak in 1.1.0 since the initial_ctx isn't set in this version of OpenSSL.  We'll move the up_ref for the initial_ctx into the OpenSSLUtils helper.
      
      Reviewed By: anirudhvr
      
      Differential Revision: D5227823
      
      fbshipit-source-id: b4490b317bd4dc8752a8d7e244fd153100a52aa6
      4ecd9abf
    • James Sedgwick's avatar
      fix rest of non-portable includes · 3bade5df
      James Sedgwick authored
      Summary: According to internal linter
      
      Reviewed By: Orvid
      
      Differential Revision: D5051010
      
      fbshipit-source-id: febdeca05ac1cf3ad82617169f90912a445cf173
      3bade5df
  2. 14 Jun, 2017 1 commit
    • Jonathan Kron's avatar
      Fixing opt-asan/ubsan fail for folly contbuild · 5086391b
      Jonathan Kron authored
      Summary: Flag caused compilation error on unused param, asserts optimized out in opt-asan/ubsan builds.  Replaced with DCHECK as per meyering's advice.
      
      Reviewed By: meyering
      
      Differential Revision: D5246089
      
      fbshipit-source-id: dc0abda91f900dd98af31410f4667c52404997f5
      5086391b
  3. 13 Jun, 2017 7 commits
    • Nick Terrell's avatar
      Add fuzz testing · 626f5abb
      Nick Terrell authored
      Summary: `ZSTD_decompress()` doesn't verify the uncompressed length in the frame as I thought, so throw an exception instead of `DCHECK()`.
      
      Reviewed By: meyering
      
      Differential Revision: D5234576
      
      fbshipit-source-id: f72cf085a7267de32ce13553ce7ebbfe3b8a3f05
      626f5abb
    • Sven Over's avatar
      remove misleading comment in Partial.h · 26ca775e
      Sven Over authored
      Summary:
      The removed comment cites a gcc compiler bug as a reason to spell
      out the return type of the three operator() methods. While that
      compiler bug can lead to compiler errors in some situations,
      it is not the only reason why we need the return type arrow
      notation.
      
      If the compiler tries to instantiate operator() with a set of
      parameters that the embedded function does not accept, then the
      substitution failure is inside decltype, which is not a compiler
      error (SFINAE) but just means that the Partial class doesn't define
      operator() for that parameter signature. Without decltype, the body
      of operator() is ill-formed and that is a compiler error.
      
      Reviewed By: meyering
      
      Differential Revision: D5236537
      
      fbshipit-source-id: 7daa0fbcf128a2c7c5c36532a5402deba394e1b8
      26ca775e
    • Nick Terrell's avatar
      Add toFullyQualifiedAppend() methods · 5203b6ba
      Nick Terrell authored
      Summary: A common use case for `IPAddress::toFullyQualified()` is to print a `<ip>:<port>` string. It is faster to reserve enough space for both beforehand than create 2 strings.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5224454
      
      fbshipit-source-id: 4536f89a9d51d39dd9fd970c753ecb8ecced5d22
      5203b6ba
    • Nick Terrell's avatar
      Fix decompression of truncated data · 9883bc37
      Nick Terrell authored
      Summary: During decompression, when the data is truncated, `StreamCodec::doUncompress()` loops forever, since it doesn't check forward progress. `Bzip2Codec` does the same.
      
      Reviewed By: chipturner
      
      Differential Revision: D5233052
      
      fbshipit-source-id: 8797a7f06d9afa494eea292a8a5dc980c7571bd0
      9883bc37
    • Adam Simpkins's avatar
      logging: if folly::format() fails, also log the arguments · ba74a196
      Adam Simpkins authored
      Summary:
      If the folly::sformat() call fails in an FB_LOGF() statement, make a
      best-effort attempt to log the format arguments as well, in addition to the
      format string.  For each argument, folly::to<std::string>() is use if it is
      supported for this argument.
      
      This will help ensure that the arguments that were being logged aren't lost
      even if the format string was incorrect.
      
      Reviewed By: WillerZ
      
      Differential Revision: D5082978
      
      fbshipit-source-id: 0d56030e639cd7e8f2242bb43646ab4248c6a877
      ba74a196
    • Adam Simpkins's avatar
      logging: add support for streaming operators · dc2c2837
      Adam Simpkins authored
      Summary:
      Update the logging library so that FB_LOG() and FB_LOGF() also accept
      streaming style arguments:
      
        FB_LOG(logger) << "logs can be written like this now: " << 1234;
        FB_LOG(logger, "both styles can be used") << " together";
        FB_LOGF(logger, "test: {}, {}", 1234, 5678) << " and with FB_LOGF() too";
      
      Streaming support does make the upcoming XLOG() macros more complicated to
      implement, since the macro has to expand to a single ternary `?` expression.
      However I was able to come up with a solution that works and has minimal
      overhead.
      
      Reviewed By: wez
      
      Differential Revision: D5082979
      
      fbshipit-source-id: 11734e39c02ad28aceb44bbfbd137d781caa30cf
      dc2c2837
    • Adam Simpkins's avatar
      add a new logging library · e9c1c043
      Adam Simpkins authored
      Summary:
      This begins adding a new logging library for efficient, hierarchical logging.
      
      This includes the basic library framework, plus a README file with a brief
      overview and the motivation for creating a new logging library.
      
      Reviewed By: wez
      
      Differential Revision: D4911867
      
      fbshipit-source-id: 359623e11feeaa547f3ac2c369bf806ee6996554
      e9c1c043
  4. 12 Jun, 2017 1 commit
  5. 10 Jun, 2017 3 commits
    • Tianjiao Yin's avatar
      fix FutexTest · c27b2745
      Tianjiao Yin authored
      Summary: 2_ms seems too short. I am not sure whether it's feasible to check whether thread is waiting for an address. We could wait for longer to reduce false alarm.
      
      Reviewed By: nbronson
      
      Differential Revision: D5220819
      
      fbshipit-source-id: 42f31206e9cb7f9addaa049d0e7cd995f6735f6c
      c27b2745
    • Yedidya Feldblum's avatar
      Let SubprocessError inherit std::runtime_error · ee87051b
      Yedidya Feldblum authored
      Summary:
      [Folly] Let `SubprocessError` inherit `std::runtime_error`.
      
      As an added bonus, this gives it `std::runtime_error`'s refcounted string for cheap copies.
      
      Reviewed By: ericniebler
      
      Differential Revision: D5216758
      
      fbshipit-source-id: 43298e06f02cfd88abf2d73f7aa16117a6cb052b
      ee87051b
    • Christopher Dykes's avatar
      Reorganize the stats directory · d8ed7cbc
      Christopher Dykes authored
      Summary: The source and tests for the stats directory was spread across folly/detail and folly/test, move them into folly/stats directly instead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5216810
      
      fbshipit-source-id: 00a8bb95a4f7830d0bc46b3f914f256a37833b78
      d8ed7cbc
  6. 09 Jun, 2017 7 commits
    • Victor Gao's avatar
      apply clang-tidy modernize-use-override · b367f0fa
      Victor Gao authored
      Summary: Use clang-tidy to mechanically add missing `override` and remove redundant `virtual`.
      
      Reviewed By: igorsugak
      
      Differential Revision: D5211868
      
      fbshipit-source-id: 6a85f7c4a543a4c9345ec5b0681a8853707343dc
      b367f0fa
    • Victor Gao's avatar
      apply clang-tidy modernize-use-override · 16723809
      Victor Gao authored
      Summary: Use clang-tidy to mechanically add missing `override` and remove redundant `virtual`.
      
      Reviewed By: igorsugak
      
      Differential Revision: D5211868
      
      fbshipit-source-id: 4118c4c72f8ec3485507f69679f7e852b3eaeb73
      16723809
    • Yedidya Feldblum's avatar
      Saner test exception in ExceptionWrapperTest.cpp · 6da8593f
      Yedidya Feldblum authored
      Summary:
      [Folly] Saner test exception in `ExceptionWrapperTest.cpp`.
      
      Make construction do the work and make `what()` free.
      
      Reviewed By: andrewjcg
      
      Differential Revision: D5216707
      
      fbshipit-source-id: bfb4c2473a61ff7da7a3a01adc85facae30d6586
      6da8593f
    • Anirudh Ramachandran's avatar
      Some more OpenSSL 1.1.0 compat APIs · d3e8b83f
      Anirudh Ramachandran authored
      Summary: Add a few more compatibility wrappers for pre-1.1.0 APIs
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5194164
      
      fbshipit-source-id: ae8db08c31370eca729df2927798b6f4d99ee70c
      d3e8b83f
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/gen/ (template decls) · adb8559d
      Yedidya Feldblum authored
      Summary: [Folly] Apply `clang-format` to `folly/gen/` (template decls).
      
      Reviewed By: Orvid
      
      Differential Revision: D5216229
      
      fbshipit-source-id: 1659f1944ccde4de39bccd189bb6490395cf29c2
      adb8559d
    • Christopher Dykes's avatar
      Fix OpenSSLUtils to not include headers the wrong way · 1b0c0d91
      Christopher Dykes authored
      Summary: This is entirely the wrong way to include these headers, and is being included within an anon namespace so just wrong.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5215065
      
      fbshipit-source-id: 499df58c0202f7a1d4482eaa6a0e8b2e1535c763
      1b0c0d91
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/experimental/exception_tracer/ (headers) · f34d96eb
      Yedidya Feldblum authored
      Summary:
      [Folly] Apply `clang-format` to `folly/experimental/exception_tracer/` (headers).
      
      With some manual rearrangement in the places where `clang-format` does awkward things, with the result that `clang-format` over the listed directory becomes a no-op.
      
      Reviewed By: Orvid
      
      Differential Revision: D5215212
      
      fbshipit-source-id: 5570f02c238b1874adbc2ff4150f465c947ad0e6
      f34d96eb
  7. 08 Jun, 2017 5 commits
    • Yedidya Feldblum's avatar
      Apply clang-format to folly/fibers/ · 811c6c33
      Yedidya Feldblum authored
      Summary:
      [Folly] Apply `clang-format` to `folly/fibers/`
      
      With some manual rearrangement in the places where `clang-format` does awkward things, with the result that `clang-format` over `folly/fibers/` becomes a no-op.
      
      Reviewed By: igorsugak
      
      Differential Revision: D5178118
      
      fbshipit-source-id: ae65ff1902666ba9106e18f916bb1d10e6406bf4
      811c6c33
    • Christopher Dykes's avatar
      Switch unguarded #pragmas to use portability macros · 146c24b7
      Christopher Dykes authored
      Summary: Otherwise downstream Windows users have to explicitly disable MSVC's warnings about unknown pragmas.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5211415
      
      fbshipit-source-id: 42871e03895010818c7e1cb6e57c1885970e98c2
      146c24b7
    • Christopher Dykes's avatar
      Refer to nullptr not NULL · 55af3d19
      Christopher Dykes authored
      Summary:
      Folly is a C++ library not a C library, and (almost) universally uses `nullptr` everywhere, so refer to `nullptr` rather than `NULL`.
      This also fixes the 1 place in our actual code where we were using `NULL` rather than `nullptr`.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5204766
      
      fbshipit-source-id: 2a5d5011a28d7d5dd48789f60643a656f51b9732
      55af3d19
    • Eric Niebler's avatar
      Extend the -Warray-bounds workaround in FixedString.h to gcc-5. · 16f34c7d
      Eric Niebler authored
      Summary: FixedString.h has a workaround for a gcc bug regarding erroneous -Werror=array-bounds errors. This commit extends the workaround to the gcc-5 series, which sadly is still broken. Life gets better with gcc-6.
      
      Reviewed By: luciang
      
      Differential Revision: D5210633
      
      fbshipit-source-id: 4fcf080d18ddc573636a3e58b61a97167a8c06ce
      16f34c7d
    • Qi Wang's avatar
      make extent_hooks static. · 7c9e64a0
      Qi Wang authored
      Summary:
      Make extent hooks static and avoid calling arena_destroy, in case there are
      alive allocations not freed yet.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5208102
      
      fbshipit-source-id: 612c772347cd90227fa303fd0b059edbaeb7d4e2
      7c9e64a0
  8. 07 Jun, 2017 12 commits
    • Christopher Dykes's avatar
      Implement __builtin_popcount under MSVC · 4929771e
      Christopher Dykes authored
      Summary:
      I thought I had already implemented this, but apparently I had only implemented the ll variable. Whoops.
      This implements the 32-bit version which fixes the build on Windows.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5203680
      
      fbshipit-source-id: 02b133db59e232cac586944b0ffc0e8bbf5f533a
      4929771e
    • Christopher Dykes's avatar
      Exclude experimental/hazptr/bench from the globs used in the CMake build · 86c0ed4e
      Christopher Dykes authored
      Summary: The directory contains benchmarks and multiple `main`'s so shouldn't be included as part of the main folly library.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5204132
      
      fbshipit-source-id: 7289cb9c2ec292c13df39c9e7b48eca4166ca951
      86c0ed4e
    • Yedidya Feldblum's avatar
      Pass Try by rvalue ref in onError implementation · 4aa6bf94
      Yedidya Feldblum authored
      Summary:
      [Folly] Pass `Try` by rvalue ref in `onError` implementation.
      
      As is done in other overloads and in `thenImplementation`. For consistency.
      
      Reviewed By: spacedentist
      
      Differential Revision: D5199302
      
      fbshipit-source-id: c78db0c36fc7a0b846ca5e44fc237422c9203a24
      4aa6bf94
    • Sonia Mar's avatar
      Uri: switch to std::string over fbstring take 2 · 3d6d4933
      Sonia Mar authored
      Summary: Update tuple generated for hash/equal_to for `folly::Uri` to also use std::string
      
      Reviewed By: Orvid
      
      Differential Revision: D5199266
      
      fbshipit-source-id: bcd619dae01ffbf82fbb5c8987b0e87103572452
      3d6d4933
    • Kyle Nekritz's avatar
      Add OpenSSLCertUtils functions for DER encoding/decoding. · ba690cad
      Kyle Nekritz authored
      Reviewed By: anirudhvr
      
      Differential Revision: D5193205
      
      fbshipit-source-id: 5b427ee4f31008518078f5e54e85c0f0f2201da5
      ba690cad
    • Yedidya Feldblum's avatar
      Shrink the implementations of then and onError · 7dc11fbd
      Yedidya Feldblum authored
      Summary:
      [Folly] Shrink the implementations of `then` and `onError`.
      
      Just a small refactor.
      
      Reviewed By: spacedentist
      
      Differential Revision: D5180784
      
      fbshipit-source-id: a399d18500a2b4c5d8f24dee54891cca802b4461
      7dc11fbd
    • Yedidya Feldblum's avatar
      Try::tryGetExceptionObject · 717713f2
      Yedidya Feldblum authored
      Summary:
      [Folly] `Try::tryGetExceptionObject`.
      
      If the `Try` has a `std::exception` for the non-template overload or a `From` where `is_convertible<From*, Ex*>` for the template overload parameterized by `typename Ex`, returns a pointer to it. Otherwise returns `nullptr`.
      
      Reviewed By: spacedentist
      
      Differential Revision: D5180848
      
      fbshipit-source-id: b7593b7459259f9a1e1e78b36d548e55d086e722
      717713f2
    • Yedidya Feldblum's avatar
      Remove exception_wrapper::throwException · 3c7ee0d0
      Yedidya Feldblum authored
      Summary:
      [Folly] Remove `exception_wrapper::throwException`.
      
      It has been renamed to `throw_exception`.
      
      Reviewed By: Orvid
      
      Differential Revision: D5181005
      
      fbshipit-source-id: 442b3fd9bdaa8170db504a81651cbb085ea50624
      3c7ee0d0
    • Nick Terrell's avatar
      Add zlib/gzip streaming support · 641ad8da
      Nick Terrell authored
      Summary:
      Add streaming interface to the ZlibCodec.
      Implement ZlibStreamCodec::doCompress() and ZlibStreamCodec::doUncompress() using the streaming interface. fbgs CodecType::ZLIB and check that no caller requires thread-safety.
      I found one caller, but it was fixed in D5090855.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5169338
      
      fbshipit-source-id: 40478e162143623ad28fd8bc937d0195521f13fe
      641ad8da
    • Christopher Dykes's avatar
      Switch folly::Uri to use std::string rather than fbstring · 8dd0e3e9
      Christopher Dykes authored
      Summary: Using fbstring directly is not really worthwhile in the vast majority of cases, especially when most places just convert it into an `std::string` immediately.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5187835
      
      fbshipit-source-id: 6f7d71612d3765e8b501d2432cd6281369bfe0fa
      8dd0e3e9
    • Anirudh Ramachandran's avatar
      Add a version of async_test using openssl 1.1.0 · ae1594ea
      Anirudh Ramachandran authored
      Summary:
      Now that it's possible, let's add some 1.1.0 tests to avoid regressing
      1.1.0 support
      
      Reviewed By: yfeldblum
      
      Differential Revision: D5167246
      
      fbshipit-source-id: ba12414504131697d4e0757c9c340a66f810acd4
      ae1594ea
    • Giuseppe Ottaviano's avatar
      Fix destruction order problem in getCoreAllocator · 55791684
      Giuseppe Ottaviano authored
      Summary: We cannot guarantee the correct destruction order of the Meyers singleton owning the allocator, and the objects allocated with it, so we just leak it using `Indestructible`.
      
      Reviewed By: djwatson
      
      Differential Revision: D5196227
      
      fbshipit-source-id: ec07ab1e21af7814194883b252d45aa36d2a04b1
      55791684
  9. 06 Jun, 2017 1 commit
    • Yedidya Feldblum's avatar
      Rename exception_wrapper::get_object to get_exception · 03c1142d
      Yedidya Feldblum authored
      Summary:
      [Folly] Rename `exception_wrapper::get_object` to `get_exception`.
      
      This will be a template overload of the existing non-template member `get_exception`, but it should just work.
      
      Reviewed By: spacedentist
      
      Differential Revision: D5180845
      
      fbshipit-source-id: 28e16e039ec6a7939b38f217b4ad5c6bc803f515
      03c1142d