- 29 Oct, 2014 19 commits
-
-
Hans Fugal authored
Summary: Reverts D1633874. Companion to D1636490 which fixes the bug. Test Plan: git reverting code that was git reverted and hasn't changed in the interim Won't be checked in without the companion bugfix diff (D1636490) Reviewed By: davejwatson@fb.com Subscribers: trunkagent, net-systems@, fugalh, exa, njormrod, folly-diffs@ FB internal diff: D1636487 Tasks: 5438209 Blame Revision: D1633874
-
Dave Watson authored
Summary: EventBaseManager was moved to folly, we shouldn't have deps on apache Test Plan: fbconfig -r folly/experimental/wangle/concurrency; fbmake runtests Reviewed By: hans@fb.com Subscribers: doug, fugalh, njormrod, folly-diffs@ FB internal diff: D1636006
-
Hans Fugal authored
Summary: Test Plan: Reviewed By: harishs@fb.com Subscribers: net-systems@, fugalh, exa, njormrod, folly-diffs@ FB internal diff: D1633874 Tasks: 5438209
-
Hans Fugal authored
Summary: I'm still a little mystified how one makes a Future<const T> (I tried to make one explicitly in a test and failed), but this is clearly the bug @reedriley sees in https://phabricator.fb.com/D1620805#21 Test Plan: fbconfig titan/cachius/test fbmake Reviewed By: reedriley@fb.com Subscribers: trunkagent, net-systems@, fugalh, exa, njormrod, reedriley, folly-diffs@ FB internal diff: D1630378 Blame Revision: D1620805
-
Dave Watson authored
Summary: Changes: * namespace to folly * some std::chrono replacesments * Moves shutdownSocketSet stuff to thriftserver instead of in the socket itself. * Changes exception types. I don't see anywhere that uses the TAsync*SERVER*socket exceptions depending on the TTransport type, but I could be wrong? I don't really know what to do about the exception types unittests still postponed overnight. Test Plan: fbconfig -r thrift; fbmake runtests fbconfig -r proxygen; fbmake runtests Reviewed By: dcsommer@fb.com Subscribers: hphp-diffs@, ps, folly-diffs@, anca, trunkagent, jsedgwick, fugalh, doug, alandau, bmatheny, njormrod FB internal diff: D1579187
-
James Sedgwick authored
Summary: fix fbthrift build, broken in D1621717 I wonder if it'd be possible to lint against this somehow. The jenkins failures are easy to miss especially on folly diffs with lots of failure noise (in this case it was still postponed) Test Plan: wait for jenkins Reviewed By: davejwatson@fb.com Subscribers: njormrod, folly-diffs@ FB internal diff: D1630833
-
Andrii Grynenko authored
Summary: This makes it more likely that SingletonVaultDestructor won't be created after atexit calls. Test Plan: unit test Reviewed By: chip@fb.com Subscribers: hphp-diffs@, ps, njormrod, folly-diffs@ FB internal diff: D1629804 Tasks: 5353022
-
Hans Fugal authored
Summary: This would cause debug builds to do a bad thing (access the variable `this->detached_` within an assert, after `delete this`). Test Plan: unit tests Hopefully now that we have a dummy cpp file in `folly/wangle/detail` contbuild will pick it up and all the dependencies will also run their tests. Right now, we suspect maybe maelstrom (@wez) and adinvoicer and zookeeper (@jying) and probably others are seeing this in unit test failures (esp. if they use asan, which is rightly detecting read after free). Hoping contbuild will catch them. Reviewed By: davejwatson@fb.com Subscribers: net-systems@, fugalh, exa, njormrod, folly-diffs@, wez, dcapel, jying, cgheorghe FB internal diff: D1630301 Tasks: 5424546, 5435720 Blame Revision: D1618240
-
Hans Fugal authored
Summary: Fixing the race will take some more thought. Probably a condvar. For now, I'm turning waitFor into a spinlock instead. Test Plan: new unit test that deadlocks before the workaround Reviewed By: jsedgwick@fb.com Subscribers: trunkagent, net-systems@, fugalh, exa, njormrod, folly-diffs@ FB internal diff: D1628015 Tasks: 5427828
-
Hans Fugal authored
Summary: If you try to include files in a weird (but not incorrect) order you get compilation errors. No longer! Test Plan: new dummy `cpp_binary` target Reviewed By: davejwatson@fb.com Subscribers: trunkagent, folly-diffs@, net-systems@, fugalh, exa, njormrod FB internal diff: D1621083
-
Hans Fugal authored
Summary: Modeled very closely after Finagle's interrupts. Compare with https://github.com/twitter/util/blob/master/util-core/src/main/scala/com/twitter/util/Promise.scala if you like. The basic idea is the promise holder can register an interrupt handler, and then interrupts will call that handler. A typical handler would fulfil the promise with an exception (or special value) indicating that it was interrupted (if it was interrupted in time). Raising an interrupt does not prevent setting a value or callbacks executing or any of that - it is only advisory to the promise holder. Test Plan: I wrote some unit tests. Reviewed By: davejwatson@fb.com Subscribers: folly-diffs@, net-systems@, fugalh, exa, hannesr, njormrod FB internal diff: D1620805 Tasks: 4618297
-
Hans Fugal authored
Summary: This is a refactor of the current functionality to use a state machine (inheriting from `FSM`). This will make it easier to extend to do cancellation and Future collapsing. Performance is the same, maybe slightly faster (abt 1%). (I might be a little conservative with the atomics, it might be worth going through and reasoning about whether they all need to be atomic). The state machine is two states, Waiting (no value), and Done (has a value). Transitioning to Done will execute the callback if it exists and we are active. Otherwise the callback will happen when it is set and active is true. There is a subjective balancing act in place here, between making a state for every single mutable bit of information (which results in an explosion of states: hasValue X hasCallback X isActive X isCancelled …), and finding a sweet spot of expressivity. This isn't too far from the way Twitter did it, though we don't (yet) have all the states they have (and they don't have the concept of hot/cold futures). But I got there by way of replacing the `mutex_` with the state, after changing all those variables to atomics so they didn't need mutex protection (resulting in only `callback_` and `result_` needing it). I expect the state machine will morph as the rest of the functionality is added, but hopefully it will be easier to understand and keep correct (that's the idea anyway). Test Plan: Tests still pass (and not by accident, I made several awesome mistakes along the way). Reviewed By: davejwatson@fb.com Subscribers: net-systems@, fugalh, exa, njormrod FB internal diff: D1618240 Tasks: 4618297
-
Hans Fugal authored
Summary: Just some cleaning hose in `detail::Core`. - rename `fulfil` to `setResult` - and `value_` to `result_` - remove unnecessary helper methods (I can be convinced to keep them if you like them) Test Plan: mechanical changes, tests still pass Reviewed By: davejwatson@fb.com Subscribers: trunkagent, folly-diffs@, net-systems@, fugalh, exa, njormrod FB internal diff: D1618161
-
Hans Fugal authored
Summary: Later is now superfluous. Just hold a deactivated future (e.g. one returned by `Future::via`), and then activate (or destruct) it when you're ready. ThreadGate has proven to be too rigid and too heavyweight to be really useful. And is superfluous now with `Future::via`. e.g. f.via(east).then(a1).then(a2).via(west).then(b1).then(b2); This is stage one of removing these: mark them deprecated. Stage two will be for me to change all existing usages in our code to not use them. Stage three will be to rip these out altogether. Test Plan: Everything still builds and works, but now with deprecation warnings. fbconfig -r \ common/smc/cpp/tests \ folly/wangle \ langtech/audiens \ messaging/avscan \ messaging/maelstrom \ neteng/traffic_manager \ notifications/nudge/service \ tao/client \ zeus/datashuttle fbmake runtests Reviewed By: jsedgwick@fb.com Subscribers: net-systems@, fugalh, exa, njormrod, folly-diffs@ FB internal diff: D1626412 Tasks: 5409538
-
Hans Fugal authored
Summary: It was deprecated, now is unused. Test Plan: fbgs check contbuild Reviewed By: hannesr@fb.com Subscribers: trunkagent, net-systems@, fugalh, exa, njormrod, folly-diffs@ FB internal diff: D1624221
-
Hans Fugal authored
Summary: for great contbuild Test Plan: these projects still build. contbuild should start picking them up, based on discussion with @robbert Reviewed By: robbert@fb.com Subscribers: trunkagent, net-systems@, fugalh, exa, mwa, jgehring, fuegen, njormrod, folly-diffs@, robbert FB internal diff: D1624206 Tasks: 5399744
-
Hans Fugal authored
Summary: Like the magic macros. As it says in the comment, this can lead to nicer code. Also added/moved a couple examples to the top of `test/FSM.cpp`. Test Plan: new tests Reviewed By: davejwatson@fb.com Subscribers: trunkagent, net-systems@, fugalh, exa, njormrod FB internal diff: D1618184
-
James Sedgwick authored
Summary: as above Test Plan: Reviewed By: davejwatson@fb.com Subscribers: fugalh, njormrod FB internal diff: D1589439
-
Sean Cannella authored
Summary: This is the last of the changes to make folly and thrift portable. The old thrift SpinLock implementation is exactly we want here so port this into folly. If someone later makes efficeint versions of MicroSpinLock for platforms other than x64 they can easily be plugged in without changing the calling code. Test Plan: compiled on multiple platforms Reviewed By: alandau@fb.com Subscribers: folly-diffs@, ldbrandy, trunkagent, alandau, bmatheny, njormrod, mshneer, shikong, benyluo, kmdent, fma, ranjeeth, subodh FB internal diff: D1621717 Tasks: 5183325
-
- 17 Oct, 2014 20 commits
-
-
dcsommer authored
-
Pavlo Kushnir authored
Summary: mcrouter now uses folly::Singleton. Test Plan: visual Reviewed By: andrii@fb.com Subscribers: njormrod FB internal diff: D1622647
-
Max Wang authored
Test Plan: yes Reviewed By: delong.j@fb.com
-
Sean Cannella authored
Summary: pthread_atfork isn't defined in the Android NDK (and therefore is not actually supported even though it's in bionic/libc) so don't call it there. Test Plan: compiled on Linux, Android Reviewed By: meyering@fb.com Subscribers: njormrod, shikong, kmdent, fma FB internal diff: D1620584 Tasks: 5183325
-
Tom Jackson authored
Summary: Buffer size calculation had fallen out of sync with the actual test code. Good thing we have ASAN! Test Plan: Run the test with address santizer. Reviewed By: mpawlowski@fb.com Subscribers: mpawlowski, trunkagent, njormrod FB internal diff: D1619472 Tasks: 5325399
-
Max Wang authored
Summary: I can see how {<,>}{,=} comparisons might be ambiguous, but equality should never be, so let's allow it. Test Plan: tests Reviewed By: tjackson@fb.com Subscribers: trunkagent, njormrod FB internal diff: D1618088
-
Dave Watson authored
Summary: Move shutdownsocketset to folly, since it is a dep of the asyncsockets Previoulsy tried moving it in to the server directly: D1583629, but had issues - close(fd) is called before the error callback, so we can't remove the fd before the close, which is essential to it working properly. Just move it to folly instead. Test Plan: fbconfig -r thrift/lib/cpp thrift/lib/cpp2; fbmake runtests Reviewed By: dcsommer@fb.com Subscribers: mshneer, trunkagent, fugalh, jsedgwick, doug, alandau, bmatheny, njormrod FB internal diff: D1594950
-
Sean Cannella authored
Summary: Conditional changes required to compile on iOS and Android. Test Plan: compiled on all platforms Reviewed By: meyering@fb.com Subscribers: kmccray, trunkagent, shilin, njormrod, ranjeeth, subodh, bmatheny FB internal diff: D1618028 Tasks: 5183325
-
Andrii Grynenko authored
Summary: This is a fix for situations where you know that something is keeping singleton alive (by getting a weak_ptr and locking it), and request a singleton instance via get() method (if e.g. it's hard to pass a pointer to singleton instance from a method which locked it). If shutdown was scheduled - an exception was previously thrown even though the object was not destroyed yet. This simplifies conversion of legacy code to folly::Singleton. Test Plan: fbconfig -r gatehouse/usersets/tests fbmake runtests Reviewed By: chip@fb.com Subscribers: trunkagent, njormrod FB internal diff: D1619311
-
Subodh Iyengar authored
Summary: Remove global initialization of ThreadLocal in Random See https://gcc.gnu.org/onlinedocs/gcc-4.8.3/gcc/Thread-Local.html Static initializers and thread locals don't mix well, and we're seeing some crashes which we think might be related to this. Test Plan: Unit tests Reviewed By: seanc@fb.com Subscribers: trunkagent, seanc, njormrod FB internal diff: D1617455
-
James Sedgwick authored
Summary: universal references and perfect forwarding to the rescue Test Plan: added demonstrative unit tests Reviewed By: hans@fb.com Subscribers: trunkagent, fugalh, njormrod, bmatheny FB internal diff: D1592032 Tasks: 5283342
-
James Sedgwick authored
Summary: the one in concurrent/ is a bit more generic, so I kept that as Executor and renamed the existing one ScheduledExecutor because Hans is surfing I took the liberty of renaming Action->Func as an alias for std::function<void()>, because I think it's more reflective also kept the version of add() that doesn't force rvalue-reference as it's more user friendly and probably not less performant in common cases (insert reference to "want speed? pass by value" here) Test Plan: compiled some major relevant bits, will let contbuild show me anything I missed Reviewed By: hans@fb.com Subscribers: trunkagent, rushix, fbcode-common-diffs@, fugalh, msk, njormrod FB internal diff: D1591237 Tasks: 5279196
-
Andrii Grynenko authored
Summary: Right now destroyInstances is scheduled when SingletonVault is requested. This may change singleton destruction order (folly::Singleton-managed vs unmanaged singletons) when new singleton is registered with folly::Singleton (no matter if it is even used). This diff changes it to be more stable. Test Plan: servicerouter unittests Reviewed By: chip@fb.com Subscribers: njormrod, mshneer FB internal diff: D1615213 Tasks: 5353022
-
Sean Cannella authored
Summary: While working on other code I noticed folly stopped compiling with clang. Fix that. Test Plan: fbmake runtests (clang and gcc) Reviewed By: lucian@fb.com Subscribers: mathieubaudet, njormrod, bmatheny FB internal diff: D1618189
-
Hans Fugal authored
Summary: For great speed Test Plan: Before ============================================================================ folly/wangle/test/Benchmark.cpp relative time/iter iters/s ============================================================================ constantFuture 241.19ns 4.15M promiseAndFuture 100.32% 240.42ns 4.16M withThen 44.63% 540.47ns 1.85M ---------------------------------------------------------------------------- oneThen 519.20ns 1.93M twoThens 62.83% 826.41ns 1.21M fourThens 36.80% 1.41us 708.75K hundredThens 1.79% 29.05us 34.42K ---------------------------------------------------------------------------- no_contention 4.82ms 207.27 contention 62.91% 7.67ms 130.39 ============================================================================ After ============================================================================ folly/wangle/test/Benchmark.cpp relative time/iter iters/s ============================================================================ constantFuture 159.79ns 6.26M promiseAndFuture 101.23% 157.84ns 6.34M withThen 41.78% 382.47ns 2.61M ---------------------------------------------------------------------------- oneThen 358.23ns 2.79M twoThens 63.07% 568.00ns 1.76M fourThens 36.89% 971.07ns 1.03M hundredThens 1.76% 20.34us 49.17K ---------------------------------------------------------------------------- no_contention 3.75ms 266.75 contention 59.83% 6.27ms 159.59 ============================================================================ That's a 150% speedup. Reviewed By: davejwatson@fb.com Subscribers: net-systems@, fugalh, exa, njormrod FB internal diff: D1617363 Tasks: 5278220
-
Jun LI authored
Summary: Query string parsing uses a lot of CPU, it happens in ctor killing CPU even in users that are not interested in query string. Move it to getQueryParams(). Test Plan: fbconfig folly/test fbmake runtests_dbg Reviewed By: ldemailly@fb.com Subscribers: trunkagent, njormrod, zellux FB internal diff: D1604973 Tasks: 5304484 Blame Revision: https://phabricator.fb.com/D1455158
-
Pavlo Kushnir authored
Summary: D1615707 moved State.h to Core.h, but didn't update Makefile.am Test Plan: visual Reviewed By: davejwatson@fb.com Subscribers: fugalh, njormrod FB internal diff: D1617562 Blame Revision: D1615707
-
Daniel Sommermann authored
Summary: See https://gcc.gnu.org/onlinedocs/gcc-4.8.3/gcc/Thread-Local.html Thanks to @subodh for finding the first instance of this problem in the proxygen codebase. Test Plan: unit tests, tested proxygen unit tests on my laptop and I don't get segfaults on program exit now. Reviewed By: subodh@fb.com Subscribers: trunkagent, doug, njormrod, subodh FB internal diff: D1616149 Tasks: 5217022
-
Hans Fugal authored
Summary: spaghetti-monster Finagle uses a nifty state machine pattern in `Promise.scala`. Each state carries its data with it, then you switch statements with a simple state `cas`, within the functions (which are the transition inputs). See https://github.com/twitter/util/blob/master/util-core/src/main/scala/com/twitter/util/Promise.scala#L133-L139 and https://github.com/twitter/util/blob/master/util-core/src/main/scala/com/twitter/util/Promise.scala#L604-L635 for example. I was thinking we could do something similar in C++, though we don't quite have the same luxury of type cases like scala. (Although as an aside I found this really cool paper on implementing type cases in C++, it's kind of evil but very cool. http://www.stroustrup.com/OOPSLA-typeswitch-draft.pdf) I was looking at having a union of the different state classes, e.g. union U { State base; Done done; Waiting waiting; ... }; and then you could use the memoized `dynamic_cast` trick in that paper to make a fairly efficient type case (and fairly readable, depending on how evil you want to get with the macros). However, `dynamic_cast<Done*>(&u.base)` blissfully segfaults. I'm not sure if this is something that should work and it's a compiler bug, or whether trying to (ab)use a union this way is against some arcane C++ rules. @hannesr suggested maybe a variant type might work. We can also do memory mangling on our own if it comes to it - however those are all more advanced techniques to play with at a later optimization time. So instead, I went for a this-is-context helper base class. The mutable context is just `this`, and you inherit from `FSM`. The magic macros make it more succint to lay out state transitions. See the tests for examples. Maybe in the future we can get really clever and find a way to generate state machine diagrams from code using this, especially when macros are being used. Test Plan: unit tests were written and pass Reviewed By: davejwatson@fb.com Subscribers: meisner, trunkagent, net-systems@, fugalh, exa, njormrod, hannesr FB internal diff: D1613497
-
Hans Fugal authored
Summary: codemod `State` is such an overloaded term, and not really the best to describe this backing future/promise object. Yes, it holds the state but it's more than that and it gets in the way of calling the states of the state machines `State`s. Test Plan: builds and tests pass Reviewed By: davejwatson@fb.com Subscribers: trunkagent, net-systems@, fugalh, exa, njormrod FB internal diff: D1615707
-
- 15 Oct, 2014 1 commit
-
-
Andrii Grynenko authored
-