- 28 May, 2020 6 commits
-
-
Lewis Baker authored
Make collectAll, collectAllRange, collectAllWindowed consistently rethrow exception from first failure Summary: The void-returning variants of collectAllRange() and collectAllWindowed() were previously failing with the error from the first task to fail whereas the other variants of collectAll() were failing with an arbitrary error (typically first by argument order) in the case of multiple errors. This was problematic because after the first task failed it requests cancellation of the other tasks, which then often will complete with an 'OperationCancelled' error. This mean that, unless the original error occurred on the first failed task in argument order, the error that caused the cancellation would be discarded and instead, the collectAll() operation would result in an 'OperationCancelled' error. This change updates those algorithms to now consistently fail with the error from the first task to fail (in time) as this error will typically be the most useful in determining the root cause of the failure. Also it now discards any errors that occur in child tasks if they fail after cancellation was requested on the parent task. In this case the collectAll() will complete with an 'OperationCancelled' error. Also made a few drive-by changes to avoid rethrowing exceptions where possible by using `co_yield co_error(e)`. Reviewed By: yfeldblum Differential Revision: D21681812 fbshipit-source-id: dfe15d0672dcbdeb4e156962cdffe767ddf91a0b
-
Lewis Baker authored
Summary: Adds the ability to request cancellation of the folly::coro::UnboundedQueue's dequeue() operation by injecting a CancellationToken using co_withCancellation(). Most of the work for supporting this was implemented in the change to Semaphore::co_wait() to support cancellation. This diff just adds some tests for cancellation of UnboundedQueue::dequeue() and provides a more efficient code-path for the cancellation-case that does not involve throwing an exception. Reviewed By: yfeldblum Differential Revision: D21555325 fbshipit-source-id: 7fbae8aa426b40bbea4d0d6dec85df4bad813733
-
Lewis Baker authored
Summary: The `Semaphore::co_await()` method now response to requests for cancellation communicated through the awaiting context's CancellationToken. This allows interrupting a wait-operation if the result is no longer required, in which case the co_wait() task completes with the OperationCancelled exception. Reviewed By: yfeldblum Differential Revision: D21655946 fbshipit-source-id: 8c7f862580ddebd2b4d3eb3cc3ab5e01ad5ee289
-
Lewis Baker authored
Summary: Now use an intrusive list structure to store the list of waiters waiting for the semaphore to be signalled. This is primarily motivated by the need to support efficient cancellation, which requires the ability to efficiently remove a specific element from the waiter list without having to scan the list like we would for the existing `std::deque`-based list storage. Another beneift of this change is that it now eliminates memory allocations that were previously required by the std::deque container. The `Semaphore::future_wait()` implementation should now also have one fewer allocations as the allocation of the Baton and the Baton::Waiter are now fused. Reviewed By: yfeldblum Differential Revision: D21692257 fbshipit-source-id: 9beff176b250ae3f37df9e2138f93b15d2607353
-
Kyle Nekritz authored
Summary: These only had a 1 month expiration after D21271202. Reviewed By: xybu, mingtaoy Differential Revision: D21765601 fbshipit-source-id: 18b9f400e96b2ba39df650db9e6627f1cf917250
-
Matt Ma authored
Summary: If inline functions are enabled, actual frames used can be larger than the address count. Reviewed By: luciang Differential Revision: D21371112 fbshipit-source-id: c1e602b62b6af427f11701bf25894a99f554ec47
-
- 27 May, 2020 2 commits
-
-
Pranav Thulasiram Bhat authored
Summary: Baton is the primitive that allows fibers to block. The goal of this diff is to provide an `Async` interface to blocking calls that operate on Batons. Overloading `await` directly was one option, however, there are 3 blocking baton APIs (wait, try_wait_for and try_wait_until). Morover these APIs can accept arguments (something async::await doesn't do so far) So, this diff adds a bunch of wrappers that return Async<> results that must be 'awaited' on. This keeps static-analysis happy, and performs the onFiber check. Reviewed By: yfeldblum Differential Revision: D21667887 fbshipit-source-id: 774c19d223ebb0932c043e4c09635c5e85cc8241
-
Maged Michael authored
Summary: Fix race condition between releaseRefClearDelete and releaseRefDeleteOnly by fixing handling in releaseRefClearDelete of the case where the clear count is 1 and the delete count is > 1. The correct behavior of releaseRefClearDelete when delete count > 1 is to release the clear count first and then release the delete count, instead of releasing the two counts in one step. The following sequence of events demonstrates the problem in the absence of the fix: - clear count == 1 and delete count == 2 - Thread 1 calls releaseRefClearDeleteCount - Thread 2 calls releaseRefDeleteOnly - Thread 1 atomically decrements the counts to 0 and 1 - Thread 2 atomically decrements the delete count to 0 - Thread 2 deletes the RequestData object - Thread 1 call to onClear accesses deleted object Reviewed By: yfeldblum, davidtgoldblatt Differential Revision: D21705266 fbshipit-source-id: 8ec2151c4e98968beaef7e9ccec0a786ca5ae267
-
- 26 May, 2020 4 commits
-
-
Jon Maltiel Swenson authored
Summary: This diff factors out some of the logic needed in the stacked diff D21628842. We want `RocketClientChannel::sendRequestResponse` to work without a fiber if the caller is not already on a fiber, which means we cannot only use `Baton::TimeoutHandler` for the request's timeout callback. Reviewed By: iahs Differential Revision: D21628871 fbshipit-source-id: 2e739f205fcb0a255108fa88f94107378a1bab49
-
Chad Austin authored
Summary: In order to use the Python 3 streaming thrift client on platforms that don't support coroutines, conditionally define anything that depends on coroutines. Reviewed By: yfeldblum Differential Revision: D21692900 fbshipit-source-id: 9f26d598097181ae43d1ff377a22b1c2f789321e
-
Yedidya Feldblum authored
Summary: Add missing includes of `folly/synchronization/Baton.h`. Differential Revision: D21716396 fbshipit-source-id: 8c8fb818f3083b4fe04fd1c62923d7ba698dcedd
-
Dan Melnic authored
Summary: Add AsyncUDPSocket::maxReadsPerEvent_ support Reviewed By: yfeldblum Differential Revision: D21509991 fbshipit-source-id: 5c4f939c1cfdda8711864df3b5f5c58439f8d7bf
-
- 25 May, 2020 1 commit
-
-
Yedidya Feldblum authored
Summary: [Folly] Compare `exception_wrapper::class_name()` to `demangle(typeid(...))` in tests v.s. comparing it to string literals since the actual result of `...::class_name()` depends on the platform and whether `libiberty-dev` is available. Differential Revision: D21711569 fbshipit-source-id: b2289d89923d6775c7e806eff9c3732ad37a0218
-
- 24 May, 2020 1 commit
-
-
Yedidya Feldblum authored
Summary: [Folly] Prefer `EndsWith` matcher in `exception_wrapper` test so that, in case of failure, the non-matching input will be shown. Differential Revision: D21708674 fbshipit-source-id: 022f7d64a030417b80b8796ae3d78534295509fc
-
- 23 May, 2020 2 commits
-
-
Yedidya Feldblum authored
Summary: [Folly] Comments in `folly/synchronization/Lock.h`. Differential Revision: D21689050 fbshipit-source-id: 65ffa2cf9bf3afe8740ae0c4a0d529c706397dae
-
Yedidya Feldblum authored
Summary: [Folly] Extract utf-16 surrogate-pair helpers from `folly/json.cpp` into `folly/Unicode.h`. Reviewed By: luciang Differential Revision: D21634400 fbshipit-source-id: 64d15e79fe19cce5f5c9c38837d4663209b5f888
-
- 22 May, 2020 2 commits
-
-
Lee Howes authored
Summary: Add tracing to SemiFuture destruction that is potentially work-dropping. Reviewed By: yfeldblum Differential Revision: D21671142 fbshipit-source-id: 8e3e733d9a0845b00fe7ccf465e9c817a10fee59
-
Wez Furlong authored
Summary: Now that we've deployed the new eden build with globfiles support, we can enable the use of eden prefetch in the getdeps build when running inside an EdenFS mount on Windows. Reviewed By: fanzeyi Differential Revision: D21692689 fbshipit-source-id: b42e778901976cf0385ec31056c227b2049162dc
-
- 21 May, 2020 7 commits
-
-
Ian Petersen authored
Summary: `folly::expected_detail::Promise<Value, Error>` won't build with exceptions turned off (e.g. by passing `-fno-exceptions` on Clang's command line) because its `unhandled_exception()` says `throw;`. This diff replaces the `throw;` with a call to `folly::rethrow_current_exception();`. Reviewed By: yfeldblum Differential Revision: D21682605 fbshipit-source-id: 294752590d54b0671395982ccdeb0386a742c01e
-
Yedidya Feldblum authored
Summary: [Folly] Use `RequestToken` in `RequestEventBase` to speed up lookup. Reviewed By: zhxchen17 Differential Revision: D21529465 fbshipit-source-id: eaaef7b48be2c5a8d76fb5f4a5293f7db7e68bed
-
Yedidya Feldblum authored
Summary: [Folly] Fix technical typo in checking hw checksum support, but which makes no practical difference. Differential Revision: D21689112 fbshipit-source-id: 8ad71d20a561f4bbf5c413ce94e7bec227d9d940
-
Amir Livneh authored
Reviewed By: yfeldblum Differential Revision: D21666740 fbshipit-source-id: 96975e777df0745f343c5b722f1d8c05bb8ac32e
-
Yedidya Feldblum authored
Summary: [Folly] Tweak `BlockingContext` in various ways. Differential Revision: D21657789 fbshipit-source-id: 4b03b3b43dddc0e9011a7594001994f2594a1a5b
-
Yedidya Feldblum authored
Summary: [Folly] Lock utilities: `upgrade_lock`, `transition_to_shared_lock`, `transition_to_upgrade_lock`, `transition_to_unique_lock`, `try_transition_to_unique_lock`. Note: `std::shared_mutex` does not have an upgrade state or any atomic transitions; there is no `std::upgrade_lock`; and `std::shared_lock` does not have a constructor from `std::unique_lock`. Reviewed By: simpkins, nbronson Differential Revision: D15532568 fbshipit-source-id: d32f387b26b57539857922c3090dc75ffcaaa538
-
Lee Howes authored
Summary: Migration from Future-returning executor-erasing collectX forms to SemiFuture-returning forms, that are less risky in particular with coroutines. Earlier changes added collectXSemiFuture and collectXUnsafe as a migration path. We then migrated collectX callsites to collectXSemiFuture or collectXUnsafe and switched the implementation of collectX to the SemiFuture form. This diff removes collectXSemiFuture completely. Reviewed By: yfeldblum, mpark Differential Revision: D21631886 fbshipit-source-id: c7b296d51f30c8b51ab0c7d06b1ce62c8cdd28d5
-
- 20 May, 2020 9 commits
-
-
Ian Petersen authored
Summary: `folly::detail::OptionalPromise<Value>` won't build with exceptions turned off (e.g. by passing `-fno-exceptions` on Clang's command line) because its `unhandled_exception()` says `throw;`. This diff replaces the `throw;` with a call to `folly::rethrow_current_exception();`. Reviewed By: yfeldblum Differential Revision: D21655976 fbshipit-source-id: 5f431372f2494a09f98e3b8c36a94e8475efff29
-
Bryan Alger authored
Summary: This fails to build on win32 platform with: ``` xplat\folly\portability\pthread.cpp(142): error C2664: 'HANDLE CreateThread(LPSECURITY_ATTRIBUTES,SIZE_T,LPTHREAD_START_ROUTINE,LPVOID,DWORD,LPDWORD)': cannot convert argument 3 from 'DWORD (__cdecl *)(void *)' to 'LPTHREAD_START_ROUTINE' ``` This seems to fix it. Reviewed By: Orvid Differential Revision: D21623386 fbshipit-source-id: 1b18a74bd71ffc75f34a92074e07f3d69742c07d
-
Yedidya Feldblum authored
Summary: [Folly] Small simplification of `AsyncSocket` read loop. Differential Revision: D21514325 fbshipit-source-id: 0af27205b4aa2807a800430e8a2b3dea36356970
-
Dan Melnic authored
Summary: Add io_uring_submit_and_wait call Reviewed By: yfeldblum Differential Revision: D21653382 fbshipit-source-id: 945aa877a30b3c6431089a113ece5999d1217eb4
-
Matt Ma authored
Reviewed By: yfeldblum, luciang Differential Revision: D21656746 fbshipit-source-id: 5e19d72ccd524926c698b8814cc6c8f2c6133565
-
Dan Melnic authored
Summary: fsync the temp file Reviewed By: yfeldblum, kevin-vigor Differential Revision: D21668049 fbshipit-source-id: 85825f81dfbe10a452f7f946133bb3d8993850f8
-
Yedidya Feldblum authored
Summary: [Folly] `rethrow_current_exception`, a `-fno-exceptions` compatibility wrapper for `throw;`. Reviewed By: ispeters Differential Revision: D21656269 fbshipit-source-id: 8f37fe71c6255162b8f05268cae04ac5927013d7
-
Nick Terrell authored
Summary: gcc-6.5 on OS X <= 10.6 complains about the `\r` when this code path is enabled. I don't think we officially support `__i386__`, but I want to backport the patch from zstd. https://github.com/facebook/zstd/pull/1418 (Note: this ignores all push blocking failures!) Reviewed By: yfeldblum, Orvid Differential Revision: D13104652 fbshipit-source-id: 737a68253c7d90c3a1cc026069b048551cb5ced9
-
Adam Simpkins authored
Summary: If an error is thrown when formating arguments for a log message, use `folly::exceptionStr()` to format the exception instead of just `ex.what()`. I changed all of the tests that verify the results of these strings to use a regular expression, as `folly::exceptionStr()` produces different results in different platforms, and does not always demangle type names. I also included a minor change to increase a timeout in AsyncFileWriterTest.cpp, as I saw this timeout fail spuriously once in my testing. Reviewed By: yfeldblum Differential Revision: D21635680 fbshipit-source-id: 749ef48deb59af1f2faef0158e0291838e09fc38
-
- 19 May, 2020 6 commits
-
-
Matt Ma authored
Summary: Fix the issue that there may be other tags like DW_TAG_lexical_block between DW_TAG_subprogram and DW_TAG_inlined_subroutine. Also increase the maximum inline location info per frame since previous value 3 is too small. Refactors the code to set file and line for inline functions. Reviewed By: luciang Differential Revision: D21250080 fbshipit-source-id: f52dc74ee5c144aa26723546b48486f8a5250f19
-
Dan Melnic authored
Summary: Fix uninitialized maxSubmit_, maxGet_ member variables Reviewed By: danobi Differential Revision: D21645171 fbshipit-source-id: 094ba7b045010954fdebc249318191f956f5b7b2
-
Adam Simpkins authored
Summary: This updates the logging code so that it is possible to include `folly/xlog.h` and write log statements in code that is compiled with `-fno-exceptions` The code for parsing log configuration strings does still use exceptions in some of its config parsing logic. It shouldn't be too difficult to disable that in a subsequent diff, but for now this change at least makes it possible for calling code to write log messages. Reviewed By: yfeldblum Differential Revision: D21630914 fbshipit-source-id: ce9ed422f40066e57433a85182e1a8fc6d8628db
-
Robin Cheng authored
Summary: This fixes a race condition detected by ThreadSanitizer. The thread list is protected by a mutex, but individual structs in the list are not protected, leading to racy access to two of their fields. This diff makes the fields atomic. Reviewed By: yfeldblum Differential Revision: D21484748 fbshipit-source-id: a981419f47a2aebaf1d40b23e9c4967cf2104aaa
-
Dan Melnic authored
Summary: Remove PollIoBackend inline submit Reviewed By: danobi Differential Revision: D21625033 fbshipit-source-id: 02ee55e64a2538c6a2392ea70912f4ae9b642963
-
Lee Howes authored
Summary: The current stack trace formatting is based on repeated string appends with newlines. This change adds more control so that we can produce file and line information only, without unnecessary newlines. New format: ./folly/experimental/symbolizer/Symbolizer.h:77 ./folly/experimental/symbolizer/test/StackTraceTest.cpp:209 ./folly/experimental/symbolizer/test/StackTraceTest.cpp:213 ./folly/experimental/symbolizer/test/StackTraceTest.cpp:258 Reviewed By: yfeldblum Differential Revision: D21562670 fbshipit-source-id: 7d05605cbda686e2f1c87577647c7ab7581f8580
-