1. 08 Sep, 2021 2 commits
    • Maged Michael's avatar
      hazard pointers: Extend cleanup to cover cohort objects · 8ecee58a
      Maged Michael authored
      Summary:
      Extend cleanup to cover retired cohort objects.
      
      The change includes incrementing num_bulk_reclaims_ before invoking do_reclamation either directly or in an executor. The corresponding decrement is done at the completion of do_reclamation, which may happen on a different thread if reclamation is done in an executor.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D30513628
      
      fbshipit-source-id: 80227e85301274c66cc200ee5228654f1ca07d08
      8ecee58a
    • Adam Simpkins's avatar
      update the branch name for the fb303-source manifest · 58f83287
      Adam Simpkins authored
      Summary:
      The primary branch in the fb303 github repository was renamed from `master` to
      `main`.  Update the `fb303-source` manifest to reflect this.
      
      The main `fb303` manifest was already updated in D30700180 (https://github.com/facebook/folly/commit/60d9f5d791d7c6afb5f044538ae45fbe91a043e5).  The
      `fb303-source` manifest is a separate manifest that only fetches the fb303
      source code without building it.  This is only used by the `eden_scm`
      manifest.
      
      Reviewed By: fanzeyi
      
      Differential Revision: D30794650
      
      fbshipit-source-id: 0e7790f8ceb737ce2f26ab213e1f0f94c5b3f045
      58f83287
  2. 07 Sep, 2021 1 commit
    • Logan Evans's avatar
      Add a coinflip library. · d2643855
      Logan Evans authored
      Summary:
      The naive coinflip algorithm generates a random variable each time the function
      is called. We can avoid many of these calls to a random number generator by
      doing some tricky business with math stuff.
      
      See https://fb.workplace.com/groups/135724786501553/permalink/5767297086677600/
      for some discussion on the topic.
      
      The intention behind this code is that we will use it in HHVM. That's why it provides the static methods that allow the caller to supply their own storage space for the counter and their own random number generator.
      
      Reviewed By: bmaurer
      
      Differential Revision: D30440295
      
      fbshipit-source-id: ee0c3e49da3ec82a9fd6c8854b15ef107755ff39
      d2643855
  3. 05 Sep, 2021 1 commit
  4. 04 Sep, 2021 2 commits
    • Lucian Grijincu's avatar
      folly: symbolizer: tests: switch from qsort to lfind -- ASAN in LLVM12 adds an... · 69100695
      Lucian Grijincu authored
      folly: symbolizer: tests: switch from qsort to lfind -- ASAN in LLVM12 adds an __interceptor_qsort.part.0 which makes stacks differ between ASAN and non-ASAN
      
      Summary:
      LLVM 12's ASAN intercepts qsort and adds a new stack frame for the intercetor `__interceptor_qsort.part.0`.
      
      That can be solved by switching offsets between mode/dev & mode/opt, but it only makes tests harder to read.
      
      So switch to `lfind` which also lives in a separate `.so` (feature used in tests), but is simple enough that ASAN doesn't need to intercept it.
      
      Differential Revision: D30665575
      
      fbshipit-source-id: ba540aede33c37bea8e1f4777bd7325699f9a8d2
      69100695
    • Lucian Grijincu's avatar
      folly::symbolizer: add support for DWARF5 · 490b287c
      Lucian Grijincu authored
      Summary:
      folly::symbolizer now supports both DWARF4 and DWARF5 debug info
      - http://www.dwarfstd.org/doc/DWARF4.pdf
      - http://www.dwarfstd.org/doc/DWARF5.pdf
      
      Split DWARF (Debug Fission)
      - with `-fsplit-dwarf-inlining`: folly::symbolizer will use the debug info from the skeleton CU.
      - without `-fsplit-dwarf-inlining`: folly::symbolizer won't read .dwo sections and can't symbolize it (yet).
      
      Major things that changed between the standards that affect folly::symbolizer:
      - new forms DW_FORM_addrx*, DW_FORM_loclistx, DW_FORM_rnglistx, DW_FORM_strx*, whose values are interpreted against new CU attributes DW_AT_addr_base, DW_AT_loclists_base, DW_AT_rnglists_base, DW_AT_str_offsets_base
      - The .debug_line line header format is completely re-written and the constraint that the file register must be >= 1 was lifted.
      - DWARF5 `.debug_loclists` replaces DWARF4 `.debug_ranges`
      
      Differential Revision: D25521092
      
      fbshipit-source-id: 5b48e8abed495f379d8b119177913f55ae11bd2b
      490b287c
  5. 02 Sep, 2021 2 commits
    • Zeyi (Rice) Fan's avatar
      add support to custom main branch name · 0c8f7e29
      Zeyi (Rice) Fan authored
      Summary: This diff adds support to customize main branch name when generating GitHub Actions.
      
      Differential Revision: D30679305
      
      fbshipit-source-id: 0fc7eb1c97c27e2b42e60cc1ab69a48ab93b93fa
      0c8f7e29
    • Anuradha Weeraman's avatar
      Changes for building in Debian (#943) · 60d9f5d7
      Anuradha Weeraman authored
      Summary:
      Some changes that had to be done in Debian for the build to work:
      
      * Installation of system deps failed as it was not detecting the OS correctly
      * Updated the CMake manifest to uncomment the deb dependency as the CMake versions are newer
      * fb303 was not getting cloned as it was looking for a non-existent master branch
      
      Pull Request resolved: https://github.com/facebook/watchman/pull/943
      
      Differential Revision: D30700180
      
      Pulled By: fanzeyi
      
      fbshipit-source-id: 62eb9f8ba57510eb98d6bd56e40384bf38a74d8c
      60d9f5d7
  6. 01 Sep, 2021 1 commit
  7. 31 Aug, 2021 2 commits
    • Jolene Tan's avatar
      Remove vformat and svformat from folly/Format.md · a782676b
      Jolene Tan authored
      Summary: Part of folly vformat and svformat deprecation
      
      Reviewed By: vitaut
      
      Differential Revision: D30656958
      
      fbshipit-source-id: 0cccb7b2294fada3c61e36cd527af2ef05bb5a0a
      a782676b
    • Maged Michael's avatar
      ConcurrentHashMap: Fix cloning of non-copyable items · b765365d
      Maged Michael authored
      Summary:
      Fix an algorithm bug that occurs when the Key or Value types are not nothrow copy constructible.
      - Nodes (the entities protectable by iterators) may be cloned as a result of rehashing.
      - Key-value item objects are unique (because they are not copyable).
      - Multiple nodes may point to the same key-value item.
      - In the incorrect algorithm, each node has a bool member that indicates if it owns the key-value item or not (i.e., if it is responsible for deleting it).
      - When a node is cloned, its bool member is cleared.
      - The problem is that if the key is erased and the clone (or  descendant clone) may be reclaimed (because it is unprotected by iterators) then the key value item will be reclaimed, even if a cloned-from node is still protected by iterators.
      - The failure happens when an iterator holder to a cloned-from node tries to access the already-reclaimed key-value, expecting it (correctly) to be still protected.
      
      The fix:
      - Eliminate the bool owned member in the node structure.
      - Add a link counter to the key-value item structure.
      - Increment (atomically) the link counter when the (latest) node to the key-value item is cloned.
      - Decrement (atomically) the link counter when a node pointing to the item is reclaimed.
      - Reclaim the item only when its last link is released.
      - Note that atomic increments  and decrements are used only if the node pointing to an item is cloned.
      
      Added a test to detect the incorrect behavior.
      This change fixes only the regular (non-SIMD) version.
      Currently, the SIMD version fails the added test, therefore (for now) the test is enabled only for the regular version.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D30371519
      
      fbshipit-source-id: 29e143712afb3ef794f9f6f4d99919d5b4688416
      b765365d
  8. 26 Aug, 2021 2 commits
  9. 25 Aug, 2021 1 commit
    • Erich Graham's avatar
      Fix Folly issues with -Wcovered-switch-default compiler flag · 02a4b200
      Erich Graham authored
      Summary:
      When compiled with `-Wcovered-switch-default`, Folly fails to build because it adds `default` to switches which are already exhaustive. For C++ safety, these switches are intentionally including a default, so wrap them in a pragma block to indicate that and locally disable the warning.
      
      Causes -fmodules import issues for upstream library in D30379442.
      
      Still remaining issues with C++ definition: P445339268
      
      Reviewed By: ispeters
      
      Differential Revision: D30397871
      
      fbshipit-source-id: adead9e01d0ba3b21c2e1446150cc6fed0f58602
      02a4b200
  10. 24 Aug, 2021 1 commit
  11. 20 Aug, 2021 1 commit
    • Maged Michael's avatar
      ConcurrentHashMapSIMD: Return iterator to new inserted item · 2c7411fe
      Maged Michael authored
      Summary:
      Fix SIMD version to return iterator to new item in insertion operations.
      
      Added a test to detect the incorrect behavior.
      
      Changed existing tests that di not test the SIMD version to do so. Three of these tests fail without the fix.
      
      Reviewed By: davidtgoldblatt
      
      Differential Revision: D30435627
      
      fbshipit-source-id: 20ba400be9213fa138fda06e0e7bd84cf9d8cf12
      2c7411fe
  12. 19 Aug, 2021 3 commits
    • Brett Chik's avatar
      Fix a typo. · dc843dad
      Brett Chik authored
      Summary: I noticed two mispellings while reading through the code.  This fixes them.
      
      Reviewed By: Orvid
      
      Differential Revision: D30429734
      
      fbshipit-source-id: b976cc4ae4534a9f065b8a7e6fee5a39d7241a28
      dc843dad
    • Jason Fried's avatar
      expose make_optional to cython · 2906e83c
      Jason Fried authored
      Summary: This definition is the same cython uses for make_shared and make_unique
      
      Reviewed By: yfeldblum
      
      Differential Revision: D30232407
      
      fbshipit-source-id: 6a0cf4637721bc9d5e5f7f87f3c0f2b031810a5f
      2906e83c
    • Felix Handte's avatar
      Back out "Change Context Pool Stripes from 4 to 128" · 23133cdb
      Felix Handte authored
      Summary:
      Original commit changeset: 7b10cb9dd2c4
      
      `configerator_proxy2` reports a big memory regression. Reverting until we understand what's going on and have a plan to address it.
      
      (Note: this ignores all push blocking failures!)
      
      Differential Revision: D30401909
      
      fbshipit-source-id: 28443ba08b75c634021965319fead2f8a36b7235
      23133cdb
  13. 18 Aug, 2021 1 commit
  14. 16 Aug, 2021 2 commits
    • Cristian Lumezanu's avatar
      Add a AsyncSocket::LifecycleObserver->connectError() callback · e460690d
      Cristian Lumezanu authored
      Summary:
      The LifecycleObserver already tracks connect() but does not notify on
      connectError().  Follow the same pattern.
      
      Note that we intentionally added this to AsyncSocket's LifecycleObserver
      rather than AsyncTransport b/c AsyncTransport is not supposed to have
      a concept of a 'connection'.  This is counter to the 'connect()' callback
      that already exists in AsyncTransport::LifecycleObserver so marked a quick
      TODO to remember to move that.
      
      Reviewed By: bschlinker
      
      Differential Revision: D28612132
      
      fbshipit-source-id: cefa650bd007d48e38f9cb67bc9a82d322036d4c
      e460690d
    • Mahesh Balakrishnan's avatar
      Setting up basic build for delos_core · 0d7f79c2
      Mahesh Balakrishnan authored
      Summary: This diff adds the manifest file for delos_core so we can build using getdeps.
      
      Reviewed By: hanm
      
      Differential Revision: D26011286
      
      fbshipit-source-id: becb1a665a95f0d593072885c3ddfcf5c4403f51
      0d7f79c2
  15. 14 Aug, 2021 1 commit
    • Nikita Lutsenko's avatar
      folly | CppAttributes | Add portable version of FOLLY_ATTR_MAY_ALIAS, to allow... · 6ce98b52
      Nikita Lutsenko authored
      folly | CppAttributes | Add portable version of FOLLY_ATTR_MAY_ALIAS, to allow for usage across compilers.
      
      Summary: This attribute is GCC/Clang specific, allow portable usage, well, via portability header and custom define.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D30296807
      
      fbshipit-source-id: bf496574139f42b07a11d582dedf6bac733318ec
      6ce98b52
  16. 13 Aug, 2021 3 commits
  17. 12 Aug, 2021 2 commits
    • Cristian Lumezanu's avatar
      Move fd_ to the initializer list in AsyncSocket constructor · d365f9e4
      Cristian Lumezanu authored
      Summary: When constructing a new AsyncSocket, we can use an already connected file descriptor, which we assign to the `fd_` member variable. We move this assignment from the constructor body to the constructor initializer list to avoid a situation where an observer is unaware of an attached fd because `fd_` was assigned after the observer was created.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D30261699
      
      fbshipit-source-id: 5adbc744715355fba08f5430a77c9094e246899d
      d365f9e4
    • Igor Sugak's avatar
      add copy assignment operator to BasicDynamicTokenBucket · 2e2e7af8
      Igor Sugak authored
      Summary: `BasicDynamicTokenBucket` declares a copy constructor, but not copy assignment operator.
      
      Differential Revision: D30258099
      
      fbshipit-source-id: c993177e11023d13d01884e5060269c4d5813088
      2e2e7af8
  18. 11 Aug, 2021 1 commit
    • Maged Michael's avatar
      hazard pointers: Fix flaky test · 559c679d
      Maged Michael authored
      Summary:
      Fix flaky test. Without this fix it is possible for the background asynchronous reclamation thread to be too slow in pushing p1 into the cohorts safe list before the main thread checks for p1's reclamation.
      
      This fix lets the main thread wait for p1 to be reclaimed before checking that p2 was not reclaimed. Since p1 is considered for reclamation before p2, it is possible that this check would pass even if p2 was about to be reclaimed in error. So the test then retires p3 and waits for it to be reclaimed before checking again that p2 was not reclaimed.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D30248673
      
      fbshipit-source-id: 268edb299681ab4b7256dac591d8cacbb960a7cc
      559c679d
  19. 10 Aug, 2021 6 commits
    • Igor Sugak's avatar
      fix nullptr-with-nonzero-offset in folly/io/IOBuf.cpp · 00c5c00f
      Igor Sugak authored
      Reviewed By: yfeldblum
      
      Differential Revision: D30232471
      
      fbshipit-source-id: 1137e306fca34f687c99c7f2155a03515926da45
      00c5c00f
    • Shai Szulanski's avatar
      Add warning when using TaskWithExecutor + InlineLikeExecutor · 7e6bdbbd
      Shai Szulanski authored
      Summary: This is unsafe and leads to all kinds of bugs. It is unfortunately too late to ban it, but we can at least print a warning to help debugging and maybe discourage new uses.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D29972469
      
      fbshipit-source-id: 1534bcc69eaf8f105998d65c0a6503740924cffa
      7e6bdbbd
    • Maged Michael's avatar
      hazptr_obj_cohort: Fix reclamation of safe list · cda1e77c
      Maged Michael authored
      Summary:
      Fix a bug in hazptr_obj_cohort handling of children of reclaimed nodes during reclamation of the safe list. When the cohort is active, the children nodes should be pushed to the domain (to be checked against hazard pointers) and not reclaimed immediately because it is possible that a child node is protected by hazard pointers.
      
      Added test that catches the bug.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D30170939
      
      fbshipit-source-id: e5bfe46b6fa5d4e5ce5cef02a3934ced424138f0
      cda1e77c
    • Cristian Lumezanu's avatar
      Update TcpInfo namespaces · ae4ddebe
      Cristian Lumezanu authored
      Summary: We update the TcpInfo namespace to `folly` (previosuly `folly::tcpinfo`) to avoid introducing unnecessary namespaces and to make it slightly easier to refer to. We also move the structs in the `TcpInfoTypes.h` file to the `folly::detail` namespace and move `LookupOptions` to the `TcpInfo` class, following comments in D22134355 (https://github.com/facebook/folly/commit/68a78d99d10743b54d38a550b2f0ebdc5c872f76).
      
      Reviewed By: bschlinker
      
      Differential Revision: D30159429
      
      fbshipit-source-id: 7260fc80c2e76b3439c539b65cc188b2e5517b24
      ae4ddebe
    • Srivatsan Ramesh's avatar
      Add TerminateCancellationToken utility · 416d85c5
      Srivatsan Ramesh authored
      Summary: `getTerminateCancellationToken()` is the public API that can be used to get a cancellation token that'll be cancelled when any of the registered signal (SIGTERM or SIGINT) is received.
      
      Reviewed By: andriigrynenko
      
      Differential Revision: D29883069
      
      fbshipit-source-id: 4270c42316b80afb2c75f54de7e720dcb7a083ca
      416d85c5
    • Johan Schuijt-Li's avatar
      move to common shared directory · 957741d5
      Johan Schuijt-Li authored
      Summary: Allow this to be used by more utilities.
      
      Reviewed By: DurhamG
      
      Differential Revision: D29958512
      
      fbshipit-source-id: b6a1a7017102a4ff4ad252246d3252903bbb793f
      957741d5
  20. 09 Aug, 2021 4 commits
    • Yedidya Feldblum's avatar
      let FOLLY_TYPE_INFO_OF always use its arg · 4f9b8292
      Yedidya Feldblum authored
      Summary: Even when RTTI is disabled, to avoid unused-arg warnings. Then use `FOLLY_TYPE_INFO_OF` to simplify the conditional compilation in `UniqueInstance`.
      
      Reviewed By: praihan
      
      Differential Revision: D30183405
      
      fbshipit-source-id: 040d90751822dedb8faca561a89dcf35da25119b
      4f9b8292
    • Ruslan Sayfutdinov's avatar
      include <optional> in Channel-fwd.h · bf6d3e57
      Ruslan Sayfutdinov authored
      Reviewed By: yfeldblum
      
      Differential Revision: D30191509
      
      fbshipit-source-id: 00e782bf381bd5cb126fd7b18ee3454c6b9d13a7
      bf6d3e57
    • Cristian Lumezanu's avatar
      add fdAttach callback · 2360b227
      Cristian Lumezanu authored
      Summary: The fdAttach callback notifies all AsyncSocketLifecycleObservers attached to the socket that a file descriptor has just been associated with the socket. In AsyncSocket, the file descriptor is created when connect() is **called**, not when it succeeds. This callback lets observers know about the fd immediately; otherwise, observers would have to wait until the connect succeeds to learn about the file descriptor attached event.
      
      Reviewed By: bschlinker
      
      Differential Revision: D29910574
      
      fbshipit-source-id: c452f1091c657a7d118b1e06546555aa04a34bf1
      2360b227
    • Dave Kurtzberg's avatar
      Add a parameterized ctor and m2 getter · 15ffb9b0
      Dave Kurtzberg authored
      Summary: Allows us to serialized and unserialize StreamingStats.
      
      Reviewed By: yfeldblum
      
      Differential Revision: D30108179
      
      fbshipit-source-id: 7a920acfa10e6c16613e9059049b8550478e81f0
      15ffb9b0
  21. 08 Aug, 2021 1 commit