1. 01 Feb, 2020 2 commits
    • Andrew Krieger's avatar
      Use extended alignment safe allocator in CPUThreadPoolExecutor · d8b4f2ff
      Andrew Krieger authored
      Summary:
      Until C++17 types with extended alignment need special handling
      in eg. std::vector and also std::unique_ptr. CPUThreadPoolExecutor has a
      default queue that requires extended alignment, but also allows the user
      to provide their own blocking queue. To handle this we move the private
      member to a shared_ptr which supported type erased destructors, and then
      use allocate_shared for the default queue type with a custom allocator
      that will satisfy alignment constraints.
      
      ```
      .../unique_ptr.h:825:34: runtime error: constructor call on misaligned address 0x613000000040 for type 'folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask>', which requires 128 byte alignment
      0x613000000040: note: pointer points here
       02 00 00 1c  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                    ^
          #0 0x75b35e in std::_MakeUniq<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >::__single_object std::make_unique<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >() .../unique_ptr.h:825:30
          #1 0x75602f in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long, std::shared_ptr<folly::ThreadFactory>) xplat/folly/executors/CPUThreadPoolExecutor.cpp:66:18
          #2 0x756c6c in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long) xplat/folly/executors/CPUThreadPoolExecutor.cpp:84:7
      ```
      
      Differential Revision: D19669832
      
      fbshipit-source-id: 7fb60a06dbb6a04edddb6b619af7a8cef4995fd2
      d8b4f2ff
    • Adam Simpkins's avatar
      fix the CMake build · 5adba359
      Adam Simpkins authored
      Summary:
      D19222635 added a `ReentrantAllocatorTest.cpp` test file but in the
      CMakeLists.txt file it listed `MmapAllocatorTest.cpp` instead.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19650216
      
      fbshipit-source-id: 794ced255de6781a05da7114eb7f8b3258f90a8c
      5adba359
  2. 31 Jan, 2020 8 commits
    • Mingtao Yang's avatar
      ssl: Fix SSLContext initialization test relying on undefined behavior · 3cdc99f2
      Mingtao Yang authored
      Summary:
      The context initialization test was testing undefined behavior by asserting that
      OpenSSL will return 0 (and consequently, result in SSLContext throwing) after
      a SSL_CTX is freed. That is to say, it is exercising control flow based on
      memory that is already freed.
      
      This diff alters the logic to detect an SSL_CTX free via EX_DATA.
      
      Reviewed By: igorsugak
      
      Differential Revision: D19306728
      
      fbshipit-source-id: cc3a94dbb0b2ab614fa72b099c585467b7156613
      3cdc99f2
    • Igor Sugak's avatar
      fix MSAN errors in InlineFunctionRefTest · 10067433
      Igor Sugak authored
      Reviewed By: aary
      
      Differential Revision: D19403185
      
      fbshipit-source-id: 02ebbda5b9500413920d7225b6fbe29cf5d73237
      10067433
    • Lee Howes's avatar
      Add heap-allocating version of getStackTrace · dea72424
      Lee Howes authored
      Summary: In stack-constrained environments, primarily fibers, the context state allocated by getStackTrace can be problematic. getStackTraceHeap gives the opposite guarantee from getStackTraceSafe - there is no significant stack allocation and we explicitly heap allocate instead.
      
      Reviewed By: terrelln
      
      Differential Revision: D19575634
      
      fbshipit-source-id: 2ec86eccec55d1044bd2532324c648c791df5a07
      dea72424
    • Jasmeet Bagga's avatar
      Fix spelling · 72c71129
      Jasmeet Bagga authored
      Summary: s/assiciated/associated
      
      Reviewed By: ericniebler
      
      Differential Revision: D19645433
      
      fbshipit-source-id: 844f3f782a083030dbab5b8196c98fb562f0f7de
      72c71129
    • Spencer Baumgardner's avatar
      add common interface for loop controllers with publicly accessible executor · e50c78af
      Spencer Baumgardner authored
      Summary: add common interface for loop controllers with publicly accessible executor
      
      Reviewed By: A5he
      
      Differential Revision: D19626108
      
      fbshipit-source-id: 07884726d7fce273dd56bdcf454be70051a4f62b
      e50c78af
    • Yedidya Feldblum's avatar
      Fix gcc-specific problem in reentrant_allocator test · 97c2cdd4
      Yedidya Feldblum authored
      Summary:
      [Folly] Fix gcc-specific problem in `reentrant_allocator` test.
      
      ```
      folly/memory/test/ReentrantAllocatorTest.cpp: In member function ‘virtual void ReentrantAllocatorTest_large_Test::TestBody()’:
      folly/folly/memory/test/ReentrantAllocatorTest.cpp:68:22: error: no matching function for call to ‘std::vector<ReentrantAllocatorTest_large_Test::TestBody()::type, folly::reentrant_allocator<ReentrantAllocatorTest_large_Test::TestBody()::type> >::push_back(<brace-enclosed initializer list>)’
           vec.push_back({i});
                            ^
      ```
      
      Reviewed By: simpkins
      
      Differential Revision: D19652353
      
      fbshipit-source-id: ca72a80002096e1d35c61a219f9af271fa79a4a7
      97c2cdd4
    • generatedunixname89002005287564's avatar
      Remove dead includes in folly/io · b206a6bd
      generatedunixname89002005287564 authored
      Reviewed By: yfeldblum
      
      Differential Revision: D19641278
      
      fbshipit-source-id: 2631056c6852de3b1e8b972e8b20b26283ea1070
      b206a6bd
    • Adam Simpkins's avatar
      allow creation of a Subprocess from an existing child pid · 2498dba8
      Adam Simpkins authored
      Summary:
      Add a static method to Subprocess that allows creating a `Subprocess` object
      from an existing child process ID.  This allows creating `Subprocess` objects
      for children processes that were originally spawned through other APIs than
      Subprocess itself.
      
      This allows using the Subprocess `wait()` and `poll()` APIs for these child
      processes, and allows passing them to existing parts of the code that expect
      to work with `Subprocess` objects.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19588079
      
      fbshipit-source-id: e29b56be4def659cedfd007ddb3a85e826c0a44c
      2498dba8
  3. 30 Jan, 2020 3 commits
    • László Várady's avatar
      Fix building async_io_test (#1313) · 44fd32d7
      László Várady authored
      Summary:
      Since 60da8ef5, typed tests have been moved to a separate unit (`AsyncBaseTestLib`), which is not the part of `folly` or `folly_test_support`.
      
      This commit adds `AsyncBaseTestLib` to `async_io_test`'s sources.
      
      Alternatively, the test lib could be added to `folly_test_support` with an additional check on `LIBAIO_FOUND`, but `AsyncBaseTestLib` has a specific `TemporaryFile` implementation that conflicts with the one in `experimental/TestUtil.h`.
      Pull Request resolved: https://github.com/facebook/folly/pull/1313
      
      Reviewed By: simpkins
      
      Differential Revision: D19648091
      
      Pulled By: yfeldblum
      
      fbshipit-source-id: 27881b464dc3c84aa20ffee1ffd3320e0a67eb27
      44fd32d7
    • Yedidya Feldblum's avatar
      Use cacheline_aligned in small-locks benchmark · 7a83deaa
      Yedidya Feldblum authored
      Summary: [Folly] Use `cacheline_aligned` in small-locks benchmark.
      
      Reviewed By: aary
      
      Differential Revision: D19614282
      
      fbshipit-source-id: d5ec3e9d970654cc532a880de951ac20c898c90a
      7a83deaa
    • Tianjiao Yin's avatar
      fix InlineFunctionRefTest by eliminating padding · 4273a65c
      Tianjiao Yin authored
      Summary: std::memcmp is only meaningful for trivially-copyable objects with no padding. Before this diff, `func` is empty class and the check can fail since padding byte is undetermined.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19460552
      
      fbshipit-source-id: 1b98876a12053c1e7d342e4d8a5fcb25d94f77f3
      4273a65c
  4. 29 Jan, 2020 4 commits
    • Lewis Baker's avatar
      Fix potential deadlock in AsyncGenerator when used with blockingWait() · c05ce04c
      Lewis Baker authored
      Summary:
      The AsyncGenerator was not clearing its Executor::KeepAlive when it ran to completion.
      
      This meant that when you call `blockingWait(gen.next())` and this would result in the end-of-stream (error or done) then `blockingWait()` would never return because the destructor of the local executor created in the call was blocked waiting for all KeepAlive instances to be destroyed - but this would not happen until the AsyncGenerator was destroyed.
      
      AsyncGenerator now clears the caller context (which includes the KeepAlive) when the coroutine runs to completion.
      
      Reviewed By: kirkshoop
      
      Differential Revision: D19625741
      
      fbshipit-source-id: f3254181af14828b32bfa8f7ef5d400d53c04efa
      c05ce04c
    • Yedidya Feldblum's avatar
      reentrant_allocator · 05fe3c7b
      Yedidya Feldblum authored
      Summary:
      [Folly] `reentrant_allocator`, a multi-thread-safe and async-signal-safe allocator.
      
      Based on `mmap` for dynamic allocation. While, technically, `mmap` is not documented to be async-signal-safe, in practice it is so at least on Linux. Take advantage.
      
      Details:
      * Large allocations are handled directly by `mmap` and deallocations by `munmap`, where large-size is 2^12 (1 page) by default; they are not tracked; they are aligned only to page boundaries.
      * Small allocations are handled by an `mmap`-backed refcounted arena list. Arena sections are block-size bytes less overhead by default, where block-size is 2^16 (16 pages) by default; they are allocated on demand; and they are linked together to allow for `munmap` when the allocator refcounted arena list is destroyed.
      
      Reviewed By: nbronson, luciang
      
      Differential Revision: D19222635
      
      fbshipit-source-id: adf30580c1bf3dd7f8dab13b1d4ac1e10b2f5c52
      05fe3c7b
    • Gabriel Russo's avatar
      Ignore `-Wnullability-extension` in FOLLY_NULLABLE · d64b36b8
      Gabriel Russo authored
      Summary:
      clang has the warning `-Wnullability-extension` to avoid unportable code. Folly correctly handles it, so let's
      ignore the warning if it is set.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: stepancheg
      
      Differential Revision: D19580470
      
      fbshipit-source-id: 59ddb5377a98d907a62df5d480b1ea0a65645a6b
      d64b36b8
    • Nathan Bronson's avatar
      fix compilation issues on MSVC · 06d2acdf
      Nathan Bronson authored
      Summary:
      MSVC seems to have a bug when handling private classes that
      are both part of the inheritence hierarchy (private superclass of a
      superclass) and available as a template parameter, incorrectly claiming
      that the class is inaccessible due to private inheritance. This diff
      works around the issue. It also adds an explicit case to avoid a narrowing
      warning generated by MSVC.
      
      (Note: this ignores all push blocking failures!)
      
      Reviewed By: yfeldblum, mjoras
      
      Differential Revision: D19561643
      
      fbshipit-source-id: 494d1611ce662a0eb6c441c64479d3c5d2bbd5b6
      06d2acdf
  5. 28 Jan, 2020 4 commits
    • Andrii Grynenko's avatar
      Fix AsyncioExecutor shutdown · f85959d8
      Andrii Grynenko authored
      Summary: It's unsafe to destroy the object before keepAlive reaches 0. We can still skip running the scheduled functions if those are unsafe to run.
      
      Reviewed By: nanshu
      
      Differential Revision: D19605152
      
      fbshipit-source-id: b99c28dc65da2a5621ce5260491c13754fca03ad
      f85959d8
    • Chad Austin's avatar
      mark SYNCHRONIZED macros deprecated · 36d628a1
      Chad Austin authored
      Summary: Produce a -Wdeprecated-declarations warning in code that uses the old SYNCHRONIZED macros.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19567088
      
      fbshipit-source-id: b0637c06cbd125d09e1b39eec1e82a71ddca2324
      36d628a1
    • Gabriel Russo's avatar
      Fix warnings · b4e3be33
      Gabriel Russo authored
      Summary:
      `-Wrange-loop-analysis` complains about the unnecessary copy.
      
      ```
      In file included from servicerouter/common/InstanceCount.h:9:
      folly/experimental/SingletonRelaxedCounter.h:77:21: error: loop variable 'kvp' of type 'const std::pair<std::atomic<long> *const, unsigned long>' creates a copy from type 'const std::pair<std::atomic<long> *const
      , unsigned long>' [-Werror,-Wrange-loop-analysis]
          for (auto const kvp : tracking->locals) {
      
      ...
      
      folly/experimental/SingletonRelaxedCounter.h:77:10: note: use reference type 'const std::pair<std::atomic<long> *const, unsigned long> &' to prevent copying
          for (auto const kvp : tracking->locals) {
      ```
      
      Reviewed By: stepancheg
      
      Differential Revision: D19554423
      
      fbshipit-source-id: 742dd4e7d144dd2dd0c888236b85f222373e9e54
      b4e3be33
    • generatedunixname89002005287564's avatar
      Remove dead includes in folly/synchronization · 135cff30
      generatedunixname89002005287564 authored
      Reviewed By: yfeldblum
      
      Differential Revision: D19579433
      
      fbshipit-source-id: ab63d21e679a8f73547d27200e738558fc69a15b
      135cff30
  6. 27 Jan, 2020 1 commit
    • Pedro Eugenio Rocha Pedreira's avatar
      Fix signed to unsigned conversion · 94dfdc55
      Pedro Eugenio Rocha Pedreira authored
      Summary:
      `folly::to<uint32_t>()` and `folly::to<uint64_t>()` were silently failing
      and truncating the input when negative values were passed:
      
      ```
      int8_t x = -1;
      folly::to<uint8_t>(x); // THROWS
      
      int16_t x = -1;
      folly::to<uint16_t>(x); // THROWS
      ```
      
      all throw folly::ConversionError, but
      
      ```
      int32_t x = -1;
      folly::to<uint32_t>(x); // DOES NOT THROW
      
      int64_t x = -1;
      folly::to<uint64_t>(x); // DOES NOT THROW
      ```
      
      The actual bug is in `less_than<>()`, from Traits.h, which in these cases relies that `(uint32)0 <= std::numeric_limits<int32_t>::min()`, which doesn't hold according to the standard.
      
      The fixes in this diff are:
      
      - Fix `less_than<>()` to properly support signed to unsigned conversions
      - Fix `less_than<>()` to properly support unsigned to signed conversions
      - Fix `greater_than<>()` to properly support signed to unsigned conversions
      - Fix `greater_than<>()` to properly support unsigned to signed conversions
      - Add unit tests to cover all these cases.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19511557
      
      fbshipit-source-id: 48649dfcdadeaa652c8f57f7b11481de44a88927
      94dfdc55
  7. 25 Jan, 2020 2 commits
    • Dan Melnic's avatar
      Suppress header-hygiene warnings · 9b21248f
      Dan Melnic authored
      Summary:
      [Folly] Suppress `header-hygiene` warnings.
      
      (Note: this ignores all push blocking failures!)
      
      Differential Revision: D19529773
      
      fbshipit-source-id: a4e0f49010ad17b72a55cd462a7a7c3e43b72c2a
      9b21248f
    • Dan Melnic's avatar
      Add support for sendmmsg GSO option · 68154677
      Dan Melnic authored
      Summary: Add support for sendmmsg GSO option
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19521628
      
      fbshipit-source-id: 5611074a5cfb626ce42ffe99d1de78b8e57238c2
      68154677
  8. 24 Jan, 2020 4 commits
    • Gabriel Russo's avatar
      Fix warnings · e12b7c2a
      Gabriel Russo authored
      Summary:
      Extra `;`, shadowed declarations and unitialised variables
      were causing warnings to callers.
      
      Reviewed By: stepancheg
      
      Differential Revision: D19537831
      
      fbshipit-source-id: 259cf9974592191c84d424bbdf3bd1c68425a76c
      e12b7c2a
    • Mohamed Bassem's avatar
      Move CheckAtomic cmake module out of the shared cmake dir · 86322be2
      Mohamed Bassem authored
      Summary: Remove the shared CheckAtomic cmake module out of the shared dir and back to the projects that need it.
      
      Reviewed By: lukaspiatkowski
      
      Differential Revision: D19553656
      
      fbshipit-source-id: 5e89b5b9448ef6d6c57ef904a652e9f9a1d5dbb3
      86322be2
    • Dan Melnic's avatar
      Handle __clang__ warnings under Windows · 6884ecfc
      Dan Melnic authored
      Summary: Handle __clang__ warnings under Windows
      
      Differential Revision: D19529853
      
      fbshipit-source-id: 936f4acaaf0f601fc09e5e7de447b9c9b4c34151
      6884ecfc
    • Jason Fried's avatar
      memory leak fix · e95c0a25
      Jason Fried authored
      Summary:
      release() returns ptr contained and thus we never actually call the destructor :|
      
      .reset() is what we wanted, call the destructor NOW.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19548008
      
      fbshipit-source-id: be904a7b5fb84aae5deef408e9d8e05fcd930a4c
      e95c0a25
  9. 23 Jan, 2020 12 commits
    • Andrew Krieger's avatar
      Back out "Use extended alignment safe allocator in CPUThreadPoolExecutor" · 4e91e1ca
      Andrew Krieger authored
      Differential Revision: D19539438
      
      fbshipit-source-id: 88c536a72a9b54d36ead2215d935745710d1d3db
      4e91e1ca
    • Paul McKenney's avatar
      Add documentation header for Folly::rcu_retire as well as call and retire member functions. (#1308) · c94486da
      Paul McKenney authored
      Summary:
      Pull Request resolved: https://github.com/facebook/folly/pull/1308
      
      The current documentation for the various Folly::Rcu retire functions is lacking, so this commit adds comment headers.
      
      Reviewed By: magedm
      
      Differential Revision: D18631443
      
      fbshipit-source-id: 690d3c6f0d7c3142d74c97b3388fd973ca2abaac
      c94486da
    • Paul McKenney's avatar
      Add documentation header for Folly::rcu_reader and Foly::rcu_reader_domain (#1307) · 10d2951e
      Paul McKenney authored
      Summary:
      Pull Request resolved: https://github.com/facebook/folly/pull/1307
      
      The current documentation for Folly::rcu_reader and Foly::rcu_reader_domain is lacking, so this commit adds comment headers.
      
      Reviewed By: ot, magedm
      
      Differential Revision: D18620267
      
      fbshipit-source-id: 98d26aa2f54fccf85de1fc5fda99a1843739bee0
      10d2951e
    • Mohamed Bassem's avatar
      Update the CheckAtomic CMake module to check for __atomic_fetch_add_4 instead... · 99c5b866
      Mohamed Bassem authored
      Update the CheckAtomic CMake module to check for __atomic_fetch_add_4 instead of __atomic_is_lock_free
      
      Summary:
      When building with clang, the build fails with:
      
      ```
      -- Looking for __atomic_is_lock_free in atomic
      -- Looking for __atomic_is_lock_free in atomic - not found
      CMake Error at cmake/CheckAtomic.cmake:90 (message):
        Host compiler appears to require libatomic, but cannot find it.
      Call Stack (most recent call first):
        CMakeLists.txt:75 (include)
      ```
      
      And the error is:
      
      ```
      /usr/share/cmake-3.10/Modules/CheckFunctionExists.c:7:3: error: conflicting types for '__atomic_is_lock_free'
        CHECK_FUNCTION_EXISTS(void);
        ^
      <command line>:1:31: note: expanded from here
      #define CHECK_FUNCTION_EXISTS __atomic_is_lock_free
                                    ^
      /usr/share/cmake-3.10/Modules/CheckFunctionExists.c:7:3: note: '__atomic_is_lock_free' is a builtin with type 'int (unsigned long, const volatile void *)'
      <command line>:1:31: note: expanded from here
      #define CHECK_FUNCTION_EXISTS __atomic_is_lock_free
                                    ^
      /usr/share/cmake-3.10/Modules/CheckFunctionExists.c:17:25: error: too few arguments to function call, expected 2, have 0
        CHECK_FUNCTION_EXISTS();
        ~~~~~~~~~~~~~~~~~~~~~ ^
      ```
      
      LLVM's CheckAtomic (https://fburl.com/bk14shjt) uses `__atomic_fetch_add_4` so I'm modifying the configs to use it as well to check for the existence of the library.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D19497168
      
      fbshipit-source-id: 64f77487efd16dba49055f6c4cb1cdd0fc4ae6da
      99c5b866
    • Maged Michael's avatar
      hazptr: Rename hazptr_obj_batch to hazptr_obj_cohort · 2c1539c1
      Maged Michael authored
      Summary: Rename hazptr obj batch to obj cohort, a more accurate description.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D19518771
      
      fbshipit-source-id: f50a8a481f260dde4fce10fb9664d4f86c263b60
      2c1539c1
    • Nathan Bronson's avatar
      fix tests for platforms with small std::string · 8221b02b
      Nathan Bronson authored
      Summary:
      F14MapTest's continuousCapacitySmall test implicitly assumed
      that folly::F14FastMap<std::size_t, std::string> uses the vector storage
      policy, but this is not the case if std::string is 8 bytes.  Remove the
      assumption.
      
      Differential Revision: D19431446
      
      fbshipit-source-id: 6e6f0cbe7f57b23b2df38c87bb36a6532ab97a14
      8221b02b
    • Lucian Grijincu's avatar
      Revert D19384064: Support inline class member functions in stack trace. · ad8ac4d9
      Lucian Grijincu authored
      Differential Revision:
      D19384064
      
      Original commit changeset: a2a6397b94aa
      
      fbshipit-source-id: e8ba1e8f6b3c3d3840a912e4c094b570b23ccbcf
      ad8ac4d9
    • Lucian Grijincu's avatar
      Revert D19437477: Prefer linkage name to name for inline function frames. · 96349f7f
      Lucian Grijincu authored
      Differential Revision:
      D19437477
      
      Original commit changeset: 1755a71678cb
      
      fbshipit-source-id: 7fce386def631d1cf217de528b15d37aee5e921b
      96349f7f
    • Lucian Grijincu's avatar
      Revert D19444082: Get the correct file name for inline functions. · 40883f36
      Lucian Grijincu authored
      Differential Revision:
      D19444082
      
      Original commit changeset: 5a5524046090
      
      fbshipit-source-id: ecb9b9048af9c00c951cb6e540433b5a3cecaf71
      40883f36
    • Lucian Grijincu's avatar
      Revert D19438098: Support debug_ranges lookup when matching address for inline functions. · 3c7f1b3a
      Lucian Grijincu authored
      Differential Revision:
      D19438098
      
      Original commit changeset: 12f1d5c60067
      
      fbshipit-source-id: de234114216abf243256fa7ac8c1faf7b0b4bb0b
      3c7f1b3a
    • Andrew Krieger's avatar
      Use aligned allocation for hazptr_rec<Atom> · cf917cf0
      Andrew Krieger authored
      Summary:
      The default allocator for `new` does not apparently respect the extended alignment requirement for `hasptr_rec<Atom>`. We use folly's AlignedSysAllocator for these cases, which will then pass UBSan checks for alignment.
      
      ```
      xplat/folly/synchronization/HazptrDomain.h:572:20: runtime error: constructor call on misaligned address 0x60c0000004c0 for type 'hazptr_rec<atomic>', which requires 128 byte alignment
      0x60c0000004c0: note: pointer points here
       02 00 00 7f  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                    ^
          #0 0x77949e in folly::hazptr_domain<std::atomic>::acquire_new_hprec() xplat/folly/synchronization/HazptrDomain.h:572:16
          #1 0x7791cc in folly::hazptr_domain<std::atomic>::hprec_acquire() xplat/folly/synchronization/HazptrDomain.h:227:35
          #2 0x766a7f in folly::hazptr_holder<std::atomic>::hazptr_holder(folly::hazptr_domain<std::atomic>&) xplat/folly/synchronization/HazptrHolder.h:71:21
          #3 0x766a7f in void folly::UnboundedQueue<folly::CPUThreadPoolExecutor::CPUTask, false, false, false, 6ul, 7ul, std::atomic>::enqueueImpl<folly::CPUThreadPoolExecutor::CPUTask>(folly::CPUThreadPoolExecutor::CPUTask&&) xplat/folly/concurrency/UnboundedQueue.h:374
      ```
      
      Reviewed By: magedm
      
      Differential Revision: D19237973
      
      fbshipit-source-id: 0edea12bb3f028d21830689d52f7e0290d187ff9
      cf917cf0
    • Andrew Krieger's avatar
      Use extended alignment safe allocator in CPUThreadPoolExecutor · d2bc79c0
      Andrew Krieger authored
      Summary:
      Until C++17 types with extended alignment need special handling
      in eg. std::vector and also std::unique_ptr. CPUThreadPoolExecutor has a
      default queue that requires extended alignment, but also allows the user
      to provide their own blocking queue. To handle this we move the private
      member to a shared_ptr which supported type erased destructors, and then
      use allocate_shared for the default queue type with a custom allocator
      that will satisfy alignment constraints.
      
      ```
      .../unique_ptr.h:825:34: runtime error: constructor call on misaligned address 0x613000000040 for type 'folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask>', which requires 128 byte alignment
      0x613000000040: note: pointer points here
       02 00 00 1c  be be be be be be be be  be be be be be be be be  be be be be be be be be  be be be be
                    ^
          #0 0x75b35e in std::_MakeUniq<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >::__single_object std::make_unique<folly::UnboundedBlockingQueue<folly::CPUThreadPoolExecutor::CPUTask> >() .../unique_ptr.h:825:30
          #1 0x75602f in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long, std::shared_ptr<folly::ThreadFactory>) xplat/folly/executors/CPUThreadPoolExecutor.cpp:66:18
          #2 0x756c6c in folly::CPUThreadPoolExecutor::CPUThreadPoolExecutor(unsigned long) xplat/folly/executors/CPUThreadPoolExecutor.cpp:84:7
      ```
      
      Differential Revision: D19237477
      
      fbshipit-source-id: c88b26e2ca17e168f124ba27c0989f787b1ce4fd
      d2bc79c0