- 13 May, 2016 5 commits
-
-
Mirek Klimos authored
Summary: ^, as discussed on D3279644 Reviewed By: andriigrynenko Differential Revision: D3299473 fbshipit-source-id: dc302132db64399f768d69c641f848d0da1075c4
-
Mirek Klimos authored
Summary: To make sure RequestContext is properly unset when we stop processing request on a thread. This changes the API in Fibers, NotificationQueue, HHWheelTimer and AsyncTimeout, and fixes RequestContext handling in Futures (reset RC after the callback is done) Reviewed By: andriigrynenko Differential Revision: D3279644 fbshipit-source-id: a6a1c2840cdce179334aa1a3b28fa514cd5358c1
-
Chad Parry authored
Summary: This diff standardizes `HHWheelTimer` construction. It's not that safe to allow anyone to call `new HHWheelTimer` because the caller needs to remember to call `DelayedDestruction::destroy`. Once callers are made to be safer, I'll be able to change the `HHWheelTimer` to use standard smart pointers instead of `DelayedDestruction`. This picks up some work that I started in D2627941 but had to postpone. This was mostly a mechanical change: ( fbgs -ls 'new HHWheelTimer' ; fbgs -ls 'new folly::HHWheelTimer' ) | xargs perl -pi -e 's/\bnew\s+((?:folly::)?HHWheelTimer)\b/$1::newTimer/g' Then I manually inspected the code. I reverted `folly/io/async/HHWheelTimer.h`, since the `newTimer` factory method is the one place that we still want to call `new HHWheelTimer`. I manually edited `proxygen/lib/utils/SharedWheelTimer.cpp`, since that was using a `shared_ptr` with a custom destructor, which isn't needed anymore. I reverted `common/io/async/d` since the D shim is meant to pass around only raw pointers. I had to replace each instance of `foo.reset(…)` with `foo = …` . Then I made manual edits to `common/clientpool/ClientPool2-inl.h` because that code wants to store the timer in a `ThreadLocalPtr`. Reviewed By: yfeldblum Differential Revision: D3237530 fbshipit-source-id: 96bfb6987098618ad5430c21b1314f385f04a93d
-
Mark Santaniello authored
Summary: This -Wbool-compare is apparently new in GCC 5. We should ignore it, similar to the existing suppression of -Wsign-compare. Reviewed By: pixelb, yfeldblum Differential Revision: D3293675 fbshipit-source-id: 5f90b0dbf049a06c0f6c3df2cdfcc8055358e367
-
Subodh Iyengar authored
Summary: Error message might be < 256 bytes in which case buf.size() would be greater than the size of the message written out and we might have garbled bytes at the end. ERR_error_string_n null terminates the string so just use that. Reviewed By: anirudhvr Differential Revision: D3297320 fbshipit-source-id: 2ae626ce4c49ca478806c0bcc40a390e5a84f24b
-
- 12 May, 2016 5 commits
-
-
Andrii Grynenko authored
Summary: This updates FiberManager to automatically register custom stack for signal handlers. This ensures signal handlers will work correctly not only in case of stack overflow, but also if fiber stack size is just not enough for them. Reviewed By: yfeldblum Differential Revision: D3289912 fbshipit-source-id: 44959b727f70e1f1748d837b1a06c7414433e5ec
-
Chad Parry authored
Summary: This `ThreadLocalPtr::reset` overload will accept a `unique_ptr`. It's actually not totally exception safe, simply because `ElementWrapper::set` is not exception safe. The best I can say is that my additional code is exactly as safe as the underlying implemenation. liketolivedangerously Reviewed By: ericniebler Differential Revision: D3271563 fbshipit-source-id: 774bcf31924b1ed4e29a6cb1c0a36ad710ab6034
-
Chad Parry authored
Summary: While making an unrelated change, (D3271563, which was needed from an unrelated change, (D3237530)), I noticed a lack of exception safety here. If `std::bad_alloc` were thrown, then we don't want to leak memory. Reviewed By: ericniebler Differential Revision: D3271911 fbshipit-source-id: 0d316c0fa865a7d64622c1d62160bb0c2b061d78
-
Michael Lee authored
Summary: According to the POSIX definition, IOV_MAX is defined in limits.h. Given that IOVec.h is used to provide IOV_MAX and similar, it seems like we should add limits.h as well. Differential Revision: D3291996 fbshipit-source-id: 238140ebef7b1b90a28f3a67a25c5f5863538fc7
-
Christopher Dykes authored
Summary: Windows doesn't have sys/uio.h, so implement it. This doesn't adjust any includes of it yet, I'll leave that for a separate diff. Reviewed By: yfeldblum Differential Revision: D2978042 fbshipit-source-id: 16d398a856de50b6c662f739eb11dfb851096592
-
- 11 May, 2016 4 commits
-
-
Subodh Iyengar authored
Summary: Add server support for TFO to wangle. Reviewed By: Orvid Differential Revision: D3275427 fbshipit-source-id: 466baa342e2e0c4751e9c96d1e660cffb90e0634
-
Lucian Grijincu authored
Summary: abs(-INT_MIN) is UB. Avoid it by first casting the number to its unsigned equivalent and then negating that. Reviewed By: yfeldblum Differential Revision: D3280835 fbshipit-source-id: 40922d686173e6467e15d5a6dc2b62ad718349b5
-
Christopher Dykes authored
Summary: MSVC builds of libevent expect `evutil_socket_t` to be `HANDLE` values, but Folly, HHVM, and Thrift all use them as file descriptors. This adds a `folly_event_set` function that always expects a file descriptor rather than a socket. This also changes the places in Folly that use it. Reviewed By: mzlee, yfeldblum Differential Revision: D2874655 fbshipit-source-id: 66cfd86fd69a9fbac30d150445e4814cd5ca799e
-
Subodh Iyengar authored
Summary: We shouldn't rely on the internal buffer size of openssl for errors. This makes it more explicit. Reviewed By: knekritz Differential Revision: D3285918 fbshipit-source-id: 452bf16a3de151d0aa79c774f2fdfc1e08ee6f9c
-
- 10 May, 2016 10 commits
-
-
Neel Goyal authored
Summary: Add NETWOR_ERROR to switch so it doesn't fall into Invalid Exception block. Differential Revision: D3282448 fbshipit-source-id: 2cc5d21e436e6ac8f2f6581d99341ac47cf5b023
-
Kyle Nekritz authored
Reviewed By: siyengar Differential Revision: D3264727 fbshipit-source-id: fb10558096e73a3cbb6f2fb93296524c0206910d
-
Faidon Liambotis authored
Summary: These are pretty trivial. Debian's lint tool (lintian) warns about those in its verbose mode, and since we saw them when packaging for Debian, we thought of fixing them and forwarding them upstream. Closes https://github.com/facebook/folly/pull/345 Reviewed By: Orvid Differential Revision: D2769801 Pulled By: elliottneilclark fbshipit-source-id: ad37cc53792f21aae6558ba256f20cb56c6caab5
-
Jaak Ristioja authored
Summary: These didn't work properly in GitHub. Closes https://github.com/facebook/folly/pull/375 Differential Revision: D3281872 Pulled By: elliottneilclark fbshipit-source-id: b5398267ff5856bb6a7c4a3b963ae5cb47859bc3
-
Lucian Grijincu authored
Summary: It would be nice to fix, but it's going to be easier to do when folly support is for GCC>=5 which adds `__builtin_add_overflow`. For now disable the check as the Histgram code handles overflow correctly and has tests for these cases. Fixes need to be done for both float and integer types as Histogram is used with both. Reviewed By: meyering Differential Revision: D3280260 fbshipit-source-id: 56e524c517566a4547346859be7770eda2acee96
-
Lucian Grijincu authored
Summary: The result of E1 << E2 is E1 left-shifted E2 bit positions; vacated bits are filled with zeros. If E1 has a signed type and non-negative value, and E1 × 2E2 is representable in the result type, then that is the resulting value; otherwise, the behavior is undefined. The code assumed the signed left shift worked like an unsigned left shift, so make that explicit. Reviewed By: meyering Differential Revision: D3280325 fbshipit-source-id: 178b95ee36b7a1126a79bb825c2ad2ffa6fa9464
-
Lucian Grijincu authored
Summary: third-party-buck/build/libgcc/include/c++/4.9.x/bits/stl_vector.h:866:9: runtime error: reference binding to null pointer of type 'char' ``` Breakpoint 2, 0x0000000000494894 in __ubsan_handle_type_mismatch_abort () (gdb) bt ``` Reviewed By: meyering, yfeldblum Differential Revision: D3279234 fbshipit-source-id: 63a761587e5b3f79ece09fc99b9a593da0e44b75
-
Christopher Dykes authored
Summary: MSVC's preprocessor is different in how it deals with passing arguments expanded from `__VA_ARGS__`, so we have to add a stub to force it to expand the arguments. Reviewed By: yfeldblum Differential Revision: D3256328 fbshipit-source-id: 551434833d40e55498a9ab352eb74acdfd094835
-
Christopher Dykes authored
Summary: MSVC doesn't define `__cplusplus` as a high enough value to trigger this, so add an explicit check for MSVC instead. Reviewed By: yfeldblum Differential Revision: D3271647 fbshipit-source-id: a1e5a5a7eb75dce066dfc7fae8b2086880dc4c3d
-
Lucian Grijincu authored
Summary: before: [ RUN ] RangeFunc.Vector bits/stl_vector.h:866:9: runtime error: reference binding to null pointer of type 'int' Reviewed By: yfeldblum Differential Revision: D3279253 fbshipit-source-id: 957a8ec050f5c3b27febf7e6cd16ad1d307da169
-
- 09 May, 2016 6 commits
-
-
Jim Meyering authored
Summary: Running the folly/io/test:compression_test with a UBSAN-enabled binary would fail with this: folly/io/test/CompressionTest.cpp:96:36: runtime error: shift exponent 16777216 is too large for 64-bit type 'size_t' (aka 'unsigned long') That exposed the unwanted left-shift. That made it so the actual "start" offsets were in the range [0..numThreads-1], rather than being e.g., with numThreads == 8, [0, 16777216, 33554432, ...]. Oops. Reviewed By: luciang Differential Revision: D3277606 fbshipit-source-id: 4bc48f84b0065de070b62a810f08b96e36ea7136
-
Christopher Dykes authored
Summary: Because it is the standard (well, Intel's standard) location for __m128i, and GCC, Clang, MSVC and ICC all implement it in that location. Reviewed By: yfeldblum Differential Revision: D3270872 fbshipit-source-id: fa0f0410670cdb310e656ca55ee0f568ca5ee06f
-
Lucian Grijincu authored
Reviewed By: meyering Differential Revision: D3277138 fbshipit-source-id: 7050d18c256ac15c8122d4af59aa31208b1466fd
-
Christopher Dykes authored
Summary: Due to some fun with the order MSVC does name lookup in templates, it ends up complaining that these are ambigious between folly::detail and folly::recordio_helpers::detail. The solution is to simply reference folly::detail explicitly. Reviewed By: yfeldblum Differential Revision: D3271606 fbshipit-source-id: e599ad8d8fe33b1e4ec0b838ddb5dfacfdf60159
-
Christopher Dykes authored
Summary: This fixes a few issues in the portability headers for MSVC. Not entirely sure how I managed to cause these in the first place, but this fixes them anyways. Reviewed By: yfeldblum Differential Revision: D3271859 fbshipit-source-id: 11a5d35246f29112563ee9079525aa37ced206ff
-
Philip Pronin authored
Summary: I would switch these to just use the intrinsic functions, but GCC 4.8 doesn't support them. MSVC supports the intrinsics, which is the primary reason for the switch. Reviewed By: yfeldblum Differential Revision: D3265572 fb-gh-sync-id: 3268f90d5234bdf77b3579504efd3dcd43f38aff fbshipit-source-id: 3268f90d5234bdf77b3579504efd3dcd43f38aff
-
- 07 May, 2016 1 commit
-
-
Andrii Grynenko authored
Summary: It's very unlikely that caller will handle such exceptions and FiberManager can proceed even if one task failed. DFATAL will ensure we still fail on such exceptions in debug builds. Reviewed By: yfeldblum Differential Revision: D3273573 fb-gh-sync-id: 55eba19c16429a3c89a2fdf5363fd4b55b3998a2 fbshipit-source-id: 55eba19c16429a3c89a2fdf5363fd4b55b3998a2
-
- 06 May, 2016 5 commits
-
-
Andrii Grynenko authored
Summary: Having singleton registered after registrationComplete() is called is not a hard failure. Replacing exception with ERROR, since we probably still want to avoid such situation. Reviewed By: yfeldblum Differential Revision: D3266376 fb-gh-sync-id: 8130d279775348c835265987c95189bd3d8106f9 fbshipit-source-id: 8130d279775348c835265987c95189bd3d8106f9
-
Christopher Dykes authored
Summary: I would switch these to just use the intrinsic functions, but GCC 4.8 doesn't support them. MSVC supports the intrinsics, which is the primary reason for the switch. Reviewed By: yfeldblum Differential Revision: D3265572 fb-gh-sync-id: f12d16b8f64cf48adcb97958d7ae88d56689a96f fbshipit-source-id: f12d16b8f64cf48adcb97958d7ae88d56689a96f
-
Christopher Dykes authored
Summary: Windows doesn't define a couple of functions. Reviewed By: yfeldblum Differential Revision: D2990676 fb-gh-sync-id: 1a1354bd7976cb8b4747436d6907d65210ba506c fbshipit-source-id: 1a1354bd7976cb8b4747436d6907d65210ba506c
-
Haijun Zhu authored
Summary: test console reports "address already in use" failure so add some randomness to it. Reviewed By: yfeldblum Differential Revision: D3265329 fb-gh-sync-id: a825cce787394783bb8d18d92385d2497b163385 fbshipit-source-id: a825cce787394783bb8d18d92385d2497b163385
-
Christopher Dykes authored
Summary: Windows doesn't have it, and it's used in a lot of places. Reviewed By: yfeldblum Differential Revision: D2997499 fb-gh-sync-id: fbf8f5f087b8f39197d5bf2177e4d34efd74631f fbshipit-source-id: fbf8f5f087b8f39197d5bf2177e4d34efd74631f
-
- 05 May, 2016 4 commits
-
-
Andrii Grynenko authored
Summary: Grouping all folly::ThreadLocal atfork hooks in one. This allows proper ordering between folly::ThreadLocal hooks and hooks added by other libraries (we always want folly::ThreadLocal hooks to be registered first). Reviewed By: ericniebler Differential Revision: D3262666 fb-gh-sync-id: 1aa928b9ddd484580f4a4a7b320e9e64164bb04a fbshipit-source-id: 1aa928b9ddd484580f4a4a7b320e9e64164bb04a
-
Andrii Grynenko authored
Summary: LoopKeepAlive can be useful to tell EventBase, that loop() shouldn't return even if there are no events registered, because some tasks will later be added via runInEventBaseThread. While at least one LoopKeepAlive is alive - EventBase::loop() behaves like EventBase::loopForever(). Reviewed By: yfeldblum Differential Revision: D3261706 fb-gh-sync-id: d91424d3d12cae11abd72cffdbd57f136f628dae fbshipit-source-id: d91424d3d12cae11abd72cffdbd57f136f628dae
-
Andrii Grynenko authored
Reviewed By: yfeldblum Differential Revision: D3244669 fb-gh-sync-id: 73fa4ecb0432a802e67ef922255a896d96f32374 fbshipit-source-id: 73fa4ecb0432a802e67ef922255a896d96f32374
-
Michael Lee authored
Summary: There are two places that still includes gflags/gflags.h: portability/GFlags.h and futures/exercises/Koan.h. Also removing gflags entirely from a couple of places which never reference it at all. Reviewed By: yfeldblum Differential Revision: D3203187 fb-gh-sync-id: e7725fbf2c4b3c475c0035e1b0e8c6e1227f277f fbshipit-source-id: e7725fbf2c4b3c475c0035e1b0e8c6e1227f277f
-