1. 13 Jan, 2015 34 commits
    • Jim Meyering's avatar
      folly/String-inl.h (humanify): avoid -Wsign-compare error · 06cee071
      Jim Meyering authored
      Summary:
      * folly/String-inl.h (humanify): Count with a signed type.
      Otherwise, gcc-4.9 fails with e.g.,
      folly/String-inl.h:596:33: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      folly/String-inl.h:601:32: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1770451
      
      Tasks: 5941250
      
      Signature: t1:1770451:1420704354:c841ca453a5586fbf474535ca26cef17f95427dd
      06cee071
    • Jim Meyering's avatar
      folly/AtomicHashArray: use an unsigned type for each of two counters · d6ddc282
      Jim Meyering authored
      Summary:
      * folly/AtomicHashArray.h (numEntries_, numPendingEntries_):
      Use an unsigned type for each of these.  They count things, can
      never go below 0, and are compared to unsigned values.
      Otherwise, gcc-4.9 would emit this:
      folly/AtomicHashArray-inl.h:153:38: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1770695
      
      Tasks: 5941250
      
      Signature: t1:1770695:1420683354:bfa4775bc2f8aab74e34772308a5c8b1779243b8
      d6ddc282
    • Jim Meyering's avatar
      folly/AtomicHashMap-inl.h: avoid -Wsign-compare warning/error (easy) · 69e1c7dc
      Jim Meyering authored
      Summary:
      * folly/AtomicHashMap-inl.h (insertInternal): Do not declare
      nextMapIdx to be signed ("int"), since we compare it against
      variables of unsigned type.  Otherwise, gcc-4.9 would give this
      diagnostic:
      folly/AtomicHashMap-inl.h:99:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      complaining about this comparison:
      if (nextMapIdx >= kNumSubMaps_ ||
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1770683
      
      Tasks: 5941250
      
      Signature: t1:1770683:1420683505:4452c7cb4f14f098be089601be906884036348ed
      69e1c7dc
    • Jim Meyering's avatar
      Histogram and Timeseries vs gcc-4.9 and -Wsign-compare · 29be5d6d
      Jim Meyering authored
      Summary:
      Address multiple -Werror=sign-compare issues exposed when building
      tao with gcc-4.9.
      In most of these changes I've changed the type of the index in
      a for-loop from int to size_t.  The important thing is to use
      an unsigned type when the limit is also unsigned.  I choose size_t
      because the general recommendation (when writing portable code)
      to avoid size-tied types like uint32_t and uint64_t unless you
      have a very good reason to require them.
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 tao/server && fbmake dbgo
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1766651
      
      Tasks: 5941250
      
      Signature: t1:1766651:1420594537:56ef53ca233e1649469db9570942c1d5dd47cf6d
      29be5d6d
    • Jim Meyering's avatar
      folly/test/ForeachTest.cpp: avoid -Wsign-compare error · 8cae10aa
      Jim Meyering authored
      Summary:
      * folly/test/ForeachTest.cpp: Change a "1" to "1U", so it matches
      the signedness of the size_t upper bound.
      Otherwise, gcc-4.9 fails with e.g.,
      folly/Foreach.h:194:16: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1770603
      
      Tasks: 5941250
      
      Signature: t1:1770603:1420679246:56ef62ac7fa4413a4ad6310c3381a12bdc59e64c
      8cae10aa
    • Jim Meyering's avatar
      folly/stats/BucketedTimeSeries-defs.h: avoid -Wsign-compare error · 0d98066a
      Jim Meyering authored
      Summary:
      * folly/stats/BucketedTimeSeries-defs.h (BucketedTimeSeries):
      Assume that maxDuration is never negative, and cast the signed
      duration_.count() to size_t, to avoid this error from gcc-4.9:
      
      folly/stats/BucketedTimeSeries-defs.h:38:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1770171
      
      Tasks: 5941250
      
      Signature: t1:1770171:1420669115:61e6b8d3248f88b25736322c7066af015209fba5
      0d98066a
    • Jim Meyering's avatar
      folly/Format-inl.h: use the correct type for fwrite return value (easy) · ab794fb6
      Jim Meyering authored
      Summary:
      * folly/Format-inl.h (folly): fwrite returns size_t, not ssize_t.
      Fixing this avoids the following diagnostic from gcc-4.9:
      folly/Format-inl.h:299:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1770155
      
      Tasks: 5941250
      
      Signature: t1:1770155:1420668733:62593231d35f5874521dba575f23b68891b2a4f9
      ab794fb6
    • Jim Meyering's avatar
      folly/Format-inl.h: avoid -Wsign-compare error · 453a7e48
      Jim Meyering authored
      Summary:
      * folly/Format-inl.h (IndexableTraitsSeq::at): Add an explicit
      int-to-size_t cast (ok here, since we've just confirmed
      that the value is not negative) to avoid this error from gcc-4.9:
      
      folly/Format-inl.h:947:29: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: tjackson@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1770193
      
      Tasks: 5941250
      
      Signature: t1:1770193:1420670569:83ac19c2ca8cd408d7c86d7dce49e2d4b418941a
      453a7e48
    • Jim Meyering's avatar
      folly/test/SpinLockTest.cpp: avoid -Wsign-compare error (trivial) · 3d4f7737
      Jim Meyering authored
      Summary:
      * folly/test/SpinLockTest.cpp (trylockTestThread):
      Change parameter type from int to size_t, to fix these:
      folly/test/SpinLockTest.cpp:67:25: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      folly/test/SpinLockTest.cpp:82:60: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: net-systems@, folly-diffs@
      
      FB internal diff: D1770564
      
      Tasks: 5941250
      
      Signature: t1:1770564:1420674373:fa3020398e2df66590eb71f798419b6f555d07c4
      3d4f7737
    • Dave Watson's avatar
      Fix CPUObserver test · 5227dcf2
      Dave Watson authored
      Summary: CPUObserver observe events happen in different threads than the IOThreadPool ones.
      
      Test Plan: fbconfig folly/wangle/concurrent/test && fbmake runtests --stress-runs 48
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: doug, fugalh, folly-diffs@
      
      FB internal diff: D1769345
      
      Tasks: 5948465
      
      Signature: t1:1769345:1420654316:196121ca30c905497a0acade05b9d877c98f6eeb
      5227dcf2
    • Jim Meyering's avatar
      folly/wangle/bootstrap/ServerBootstrap.h: avoid -Wsign-compare error (trivial) · 3564b902
      Jim Meyering authored
      Summary:
      * folly/wangle/bootstrap/ServerBootstrap.h:
      Change type of a for-loop index from int to size_t.
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: fugalh, folly-diffs@
      
      FB internal diff: D1770091
      
      Tasks: 5941250
      
      Signature: t1:1770091:1420667597:fbe9a5ba56a0e34e0480c82c8fb61128406ded95
      3564b902
    • Nicholas Ormrod's avatar
      AHM ASAN test adjustment · 98543616
      Nicholas Ormrod authored
      Summary:
      The AHA-insert-race test case (a) does a LOT of iterations, and
      (b) allocated and deallocates a lot of memory on each iteration.
      
      The long iterations, by themselves, take 8s, and should be reduced.
      Further, ASAN errors on these tests, since it needs to hold on to memory
      for a bit of time and ends up OOMing.
      
      Test Plan:
      fbconfig -r 'folly' '--platform-all=gcc-4.8.1-glibc-2.17-fb' '--sanitize=address'
      fbmake runtests Ahm.atomic_hash_array_insert_race
      
      Reviewed By: robbert@fb.com
      
      Subscribers: sdwilsh, folly-diffs@
      
      FB internal diff: D1767334
      
      Tasks: 5941888
      
      Signature: t1:1767334:1420612386:4d6f4067b30d1cb7d20bcfeb0f31fac1339ead20
      98543616
    • Jim Meyering's avatar
      folly/small_vector.h: avoid -Wsign-compare error · 67a4edad
      Jim Meyering authored
      Summary:
      * folly/small_vector.h (moveToUninitialized): Do not mix
      signed and unsigned for-loop index/limit.  Instead, eliminate
      the intermediate "count" altogether and iterate as long as
      "first" is not equal to "last". Otherwise, gcc-4.9 fails with e.g.,
      folly/small_vector.h:115:18: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: soren@fb.com
      
      Subscribers: trunkagent, folly-diffs@
      
      FB internal diff: D1767844
      
      Tasks: 5941250
      
      Signature: t1:1767844:1420601608:987fd7f7d44197ed9919910c9b559b37fbe421b6
      67a4edad
    • Jim Meyering's avatar
      folly/FBVector.h: avoid -Wsign-compare error (simple) · b6c430e1
      Jim Meyering authored
      Summary:
      * folly/FBVector.h (make_window): Declare "tail" to be
      explicitly of the same type as "n".  Otherwise, we'd
      use the type of std::distance, which is unsigned, and
      then compare that against "n" of type "size_type", which
      is unsigned, and we'd get this from gcc-4.9:
      folly/FBVector.h:1276:14: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com, andrei.alexandrescu@fb.com
      
      Subscribers: trunkagent, njormrod, folly-diffs@
      
      FB internal diff: D1768346
      
      Tasks: 5941250
      
      Signature: t1:1768346:1420594452:654dac805bb46f7c6a38b4e4102e4004720d6835
      b6c430e1
    • Jim Meyering's avatar
      folly/test/RangeTest.cpp: avoid -Wsign-compare error (trivial) · c7e25e1a
      Jim Meyering authored
      Summary:
      * folly/test/RangeTest.cpp (NeedleFinderTest): Declare for-loop
      index to be of type size_t.  OTherwise, gcc-4.9 fails:
      folly/test/RangeTest.cpp:910:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1768279
      
      Tasks: 5941250
      
      Signature: t1:1768279:1420593237:246040eebd40e313bdb19799bb11d6639f1481de
      c7e25e1a
    • Jim Meyering's avatar
      folly/experimental/test/BitsBenchmark.cpp: avoid -Wsign-compare error · 314f48cc
      Jim Meyering authored
      Summary:
      * folly/experimental/test/BitsBenchmark.cpp (benchmarkSet):
      Another s/int/size_t/ change to type of for-loop index, to match
      the type of the loop's upper bound.
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1767853
      
      Tasks: 5941250
      
      Signature: t1:1767853:1420587945:f32a0ef33f6c5fa75598ecb114a243f83b31e550
      314f48cc
    • Jim Meyering's avatar
      folly/wangle/channel/ChannelPipeline.h: avoid -Wsign-compare errors (trivial) · 042bbfeb
      Jim Meyering authored
      Summary:
      * folly/wangle/channel/ChannelPipeline.h: Declare for-loop indices
      to be of type size_t(not int), to match size of upper bound.
      Otherwise, gcc-4.9 fails with e.g.,
      folly/wangle/channel/ChannelPipeline.h:126:23: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: fugalh, folly-diffs@
      
      FB internal diff: D1767783
      
      Tasks: 5941250
      
      Signature: t1:1767783:1420587925:d662b75e6a62ebd5bacdde28ad6e1da22ef777ac
      042bbfeb
    • Jim Meyering's avatar
      folly/gen/Parallel-inl.h: trivial -Wsign-compare fix · 32172a24
      Jim Meyering authored
      Summary:
      [just like https://phabricator.fb.com/D1767160 --
      I don't know why I didn't see this the first time]
      * folly/gen/Parallel-inl.h (folly): Use a for-loop index of type
      size_t (not "int") to match type of upper bound.
      Otherwise, gcc-4.9 fails with this:
      folly/gen/Parallel-inl.h:242:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1767520
      
      Signature: t1:1767520:1420583501:121f7212f78774adb6ca7cf67cbab83bf604cbbe
      32172a24
    • Jim Meyering's avatar
      folly/gen/Parallel-inl.h: trivial -Wsign-compare fix · a4a48cc2
      Jim Meyering authored
      Summary:
      * folly/gen/Parallel-inl.h (folly): Use a for-loop index of type
      size_t (not "int") to match type of upper bound.
      Otherwise, gcc-4.9 fails with this:
      folly/gen/Parallel-inl.h:242:27: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 -r folly && fbmake dbgo
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1767160
      
      Tasks: 5941250
      
      Signature: t1:1767160:1420577886:6acfb7f6d50ed715dcf4058841aeabc39fa99cbc
      a4a48cc2
    • Peter Griess's avatar
      Fix HHWheelTimer compilation bug in libc++ build · 0af2af09
      Peter Griess authored
      Summary:
      - Manually swap bucket_ entries in HHWheelTimer to work around a bug in
      libc++
      
      Test Plan:
      - fbconfig -r folly/io/async && fbmake runtests --extended-tests
      - Sync to OS X and build there
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: trunkagent, doug, seanc, folly-diffs@
      
      FB internal diff: D1766601
      
      Signature: t1:1766601:1420566916:24a2911e997ee04f0934884bdf7b82345cb2b752
      0af2af09
    • Hans Fugal's avatar
      join · 27188837
      Hans Fugal authored
      Summary:
      Fixes T5922800
      (I think)
      
      Test Plan:
      TBH I don't know why detaching a temporary thread variable might cause the program to abort but this seems to be the most likely cause so I'm making this change and we'll see in a day or two if it fixes it.
      
      The test still passes and doesn't hang
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: fugalh, exa, folly-diffs@
      
      FB internal diff: D1764374
      
      Tasks: 5922800
      
      Signature: t1:1764374:1420485233:2e4c81776ef6b6bdae18fbf2e99f0deea37b7879
      27188837
    • Jim Meyering's avatar
      folly/Format-inl.h: fix gcc-4.9-exposed shadowing warning/error (trivial) · 4925e0f4
      Jim Meyering authored
      Summary:
      * folly/Format-inl.h (BaseFormatter): Move decls of P and END down
      past the shadowed decls.  Otherwise, gcc-4.9 would emit this:
      ./folly/Format-inl.h:209:10: error: declaration of 'p' shadows a previous local [-Werror=shadow-local]
      ./folly/Format-inl.h:202:8: error: shadowed declaration is here [-Werror=shadow-local]
      ./folly/Format-inl.h:210:10: error: declaration of 'end' shadows a previous local [-Werror=shadow-local]
      ./folly/Format-inl.h:203:8: error: shadowed declaration is here [-Werror=shadow-local]
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 tao/server && fbmake dbgo
      
      Reviewed By: andrewjcg@fb.com
      
      Subscribers: trunkagent, net-systems@, folly-diffs@
      
      FB internal diff: D1766673
      
      Tasks: 5941250
      
      Signature: t1:1766673:1420569376:22c5c3a012715e479b27ba6f0bde1a3b079a3be3
      4925e0f4
    • Dave Watson's avatar
      Thread Observer · 9009c2b4
      Dave Watson authored
      Summary: Observer methods, so users of IOThreadPoolExecutor can do stuff when threads are added/removed.  As a use case, previously the thrift server only used the threads already started when it started up, and assumed iothreadpool was never resized.
      
      Test Plan: Added several unittests
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, doug, fugalh, alandau, bmatheny, mshneer, folly-diffs@
      
      FB internal diff: D1753861
      
      Signature: t1:1753861:1420236825:54cbdfee0efb3b97dea35faba29c134f2b10a480
      9009c2b4
    • Jim Meyering's avatar
      folly/Range.cpp: avoid -Werror=sign-compare error with gcc-4.9 · c9a5ee23
      Jim Meyering authored
      Summary:
      * folly/Range.cpp (scanHaystackBlock): This method mistakenly
      declared its "idx" (aka blockStartIdx) parameter to have signed type.
      It is logically an unsigned type and is compared only with other
      variables of unsigned type, so make it unsigned.
      Here's the diagnostic:
      folly/Range.cpp:202:44: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
      folly/Range.cpp: In instantiation of 'size_t folly::detail::scanHaystackBlock(folly::StringPiece, folly::StringPiece, int64_t) [with bool HAYSTACK_ALIGNED = true; size_t = long unsigned int; folly::StringPiece = folly::Range<const char*>; int64_t = long int]':
      
      Test Plan:
      Run this and note there are fewer errors than before:
      fbconfig --platform-all=gcc-4.9-glibc-2.20 tao/server && fbmake dbgo
      
      Reviewed By: robbert@fb.com, philipp@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1765590
      
      Signature: t1:1765590:1420506036:7cbe2c454ad1f018a1c0aa5112a38bed1b2ac673
      c9a5ee23
    • James Sedgwick's avatar
      fix 4.9 build · fe41434e
      James Sedgwick authored
      Summary:
      see https://www.facebook.com/groups/738749156173702/permalink/798168656898418/
      
      I suppressed "comparison between signed and unsigned integer expressions" warnings for this first pass because there a whole lot (dozens) of those. Do we suppress those with 4.8 or something? Never seen the warnings before.
      
      I can't find anything in boost 1.57 docs/changelog indicating why implicit conversion of boost::optional<bool> -> bool doesn't compile anymore, but it doesn't.
      
      Test Plan: fbconfig -r --platform-all gcc-4.9-glibc-2.20 --extra-cxxflags="-Wno-sign-compare" folly && fbmake opt && fbmake runtests_opt
      
      Reviewed By: rhysparry@fb.com
      
      Subscribers: trunkagent, fugalh, folly-diffs@
      
      FB internal diff: D1765093
      
      Signature: t1:1765093:1420500411:062acf841641c7f4142c9b48e8daa45327de6822
      fe41434e
    • Hans Fugal's avatar
      (folly) osx bootstrap script · 799d6503
      Hans Fugal authored
      Summary:
      This is a bootstrap script for building folly on osx. I attempted to make it Just Work for anyone who uses Homebrew (http://brew.sh/) but even if it doesn't work out of the box it should be instructive for the motivated developer on OSX.
      
      Facebook:
      In #5134151 Wangle used to not build, because something was using a futex. But that seems to have been rectified (or the build problems are hiding in headers that aren't used in the libfolly build).
      
      I'll also update https://our.intern.facebook.com/intern/wiki/Folly/BuildingOnMac to point people to this script instead.
      
      Test Plan:
      Tested on my laptop which is running Yosemite (10.10.1)
      Build, then inspect `otool -L .libs/*dylib`
      
      Reviewed By: davejwatson@fb.com
      
      Subscribers: folly-diffs@, exa
      
      FB internal diff: D1765248
      
      Tasks: 5134151
      
      Signature: t1:1765248:1420500905:bc5da97a0446f502cb2badc85c9004ff0a62027a
      799d6503
    • Dave Watson's avatar
      fix bootstrap test on older kernels · c77b1e7d
      Dave Watson authored
      Summary: another unittest that doesn't work without reuseport support, add a check
      
      Test Plan: ran it on sandcastle187.prn2, works
      
      Reviewed By: njormrod@fb.com
      
      Subscribers: doug, fugalh, folly-diffs@
      
      FB internal diff: D1764395
      
      Tasks: 5931982
      
      Signature: t1:1764395:1420490666:658aef148ebca9484534a0cebb228570e28f1002
      c77b1e7d
    • Sergey Doroshenko's avatar
      folly: AsyncServerSocket::getAddress: prefer IPv6 · 23027364
      Sergey Doroshenko authored
      Summary:
      Can't connect from ipv6-only cluster to ipv4/ipv6 service which uses different ports.
      
      Facebook:
      A lot of tests start a service, get its port, and try to connect to 127.0.0.1:port, which breaks
      after this diff since the port corresponds to IPv6 address, not IPv4. Fixing this by changing
      127.0.0.1 to ::1 in places found by sandcastle.
      
      ```
      fbconfig servicerouter/aggregator/tests servicerouter/client/cpp/test common/fb303/cpp/test thrift/lib/cpp2/test unicorn/hotswap/test common/client_mgmt thrift/test servicerouter/client/swig/tests unicorn/async/test servicerouter/selection/tests
      ```
      
      Test Plan:
      ```
      $ ./fastcopy_server --dir . &
      $ netstat -atnlp | grep LISTEN | grep fastcopy
      tcp        0      0 0.0.0.0:65478               0.0.0.0:*                   LISTEN      9348/./fastcopy_ser
      tcp        0      0 :::52793                    :::*                        LISTEN      9348/./fastcopy_ser
      ```
      
      Reviewed By: philipp@fb.com
      
      Subscribers: trunkagent, vkatich, fbcode-common-diffs@, chaoyc, search-fbcode-diffs@, davejwatson, andrewcox, mcduff, hitesh, unicorn-diffs@, alandau, mshneer, folly-diffs@, bmatheny, ps, soren
      
      FB internal diff: D1760372
      
      Tasks: 5868818, 5886688
      
      Signature: t1:1760372:1419992695:e7d254b2b8f730baefc169effa236b8daa9d846d
      23027364
    • Viswanath Sivakumar's avatar
      Fix use of SSL session TransportInfo after txn is detached · 9d022380
      Viswanath Sivakumar authored
      Summary:
      De-couple TransportInfo fields from SSL session structs to avoid
      dangling pointers.
      
      Facebook:
      We sometimes lazily copy TransportInfo in handler after
      detachClientTransaction for logging. If the socket is closed, then this
      creates dangling pointers to some SSL structs. This is an attempt to fix
      that.
      
      This is similar to what @ajitb did in
      https://phabricator.fb.com/D1666951 which had to be abandoned because of
      memory overhead. Here, instead of copying the relevant fields per
      transaction, we are only doing it once per session (shared_ptr), so the
      memory overhead should be negligible.
      
      Test Plan: Unit tests pass. Will canary
      
      Reviewed By: afrind@fb.com
      
      Subscribers: fugalh, bmatheny, ssl-diffs@, folly-diffs@, ajitb
      
      FB internal diff: D1757318
      
      Tasks: 5865651, 5879508
      
      Signature: t1:1757318:1420482488:9f5144b499eb2086cf2a80243328db5715b48f88
      9d022380
    • Andrii Grynenko's avatar
      Replace singleton names with type tags · df2469a3
      Andrii Grynenko authored
      Summary: This change simplifies Singleton API (methods don't need to accept name) and the actual implementation. It also makes it similar to folly::ThreadLocalPtr. Additionally misspelled singleton name becomes compilation error, not runtime error. Some users were actually naming singletons, when that was neccessary, this should also be fixed.
      
      Test Plan: unit tests for all touched projects
      
      Reviewed By: chip@fb.com
      
      Subscribers: trunkagent, fugalh, jsedgwick, fbcode-common-diffs@, mcduff, hitesh, mshneer, folly-diffs@
      
      FB internal diff: D1744978
      
      Signature: t1:1744978:1419282587:bd29dd8a70d7572530ac371a96a21764229bc397
      df2469a3
    • Philip Pronin's avatar
      fix __cxa_throw signature · 760b4c4f
      Philip Pronin authored
      Summary: `__cxa_throw` signature didn't match C++ ABI (see 2.4.3 in http://refspecs.linuxfoundation.org/abi-eh-1.22.html), gcc 4.9 was complaining.
      
      Test Plan: fbconfig -r folly && fbmake opt -j32
      
      Reviewed By: soren@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1760492
      
      Tasks: 5908365
      
      Signature: t1:1760492:1420251038:6d04683f96ac889ff348ca0485420c975819b90b
      760b4c4f
    • Nick Tchervenski's avatar
      add a UT for Wangle::Future for circular dependency · 22ffed16
      Nick Tchervenski authored
      Summary:
      Making sure Wangle can handle circular dependencies.
      There was an actual code issue in September that cause a crash in Atlas
      Adserver due to this. The issue has been since fixed and Adserver's code
      has been changed to avoid such circular dependency. We're adding a unit
      test for this case.
      
      Unit test is added as per our conversation on the Wangle group: https://www.facebook.com/groups/715931878455430/permalink/770180369697247/
      
      Test Plan:
      Add the same test on a code base from Sep 20th, observe that it fails:
      https://phabricator.fb.com/P19352007
      
      Run the unit test on latest code base - it succeeds
      
      Reviewed By: hans@fb.com
      
      Subscribers: atlas2-eng@, fugalh, folly-diffs@, leizhao, mchughj, kit, mpechuk
      
      FB internal diff: D1761006
      
      Tasks: 5384229
      
      Signature: t1:1761006:1420238204:74ffb3fe8b88a25a23ade8e0990e69d405ea7f1e
      22ffed16
    • Hans Fugal's avatar
      Future::within · f8f6e199
      Hans Fugal authored
      Summary: For when you have a future that you want to complete within a duration, else raise a `TimedOut` exception.
      
      Test Plan: new unit tests
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: trunkagent, fugalh, exa, folly-diffs@
      
      FB internal diff: D1756580
      
      Tasks: 4548494
      
      Signature: t1:1756580:1420215704:862f68816fc3a9d05a77077c439bec002aa29cf3
      f8f6e199
    • Chip Turner's avatar
      Improve unit test output and logging to diagnose build breaks · 45bf87b3
      Chip Turner authored
      Summary:
      I can't repro the very frequent breakage we get from the unit
      test framework, and it would be helpful to get the proper error messages
      from it, so this adjusts the logging and changes a CHECK to an EXPECT to
      get more data when the failure occurs.
      
      Test Plan: runtests
      
      Reviewed By: hans@fb.com
      
      Subscribers: lins, anca, folly-diffs@
      
      FB internal diff: D1761800
      
      Tasks: 5870141
      
      Signature: t1:1761800:1420226753:27a66fb0ce47cd57529e5fd0518550fb649c9eb5
      45bf87b3
  2. 07 Jan, 2015 6 commits
    • Ajit Banerjee's avatar
      Bump version to 21:0 · 72e24ebc
      Ajit Banerjee authored
      72e24ebc
    • Bob Haarman's avatar
      some fixes for clang-3.5 compatibility · 0f75d2ba
      Bob Haarman authored
      Summary:
      Clang 3.5 performs more rigorous static analysis than compilers we've previously used, and accordingly comes up with some additional warnings. This diff fixes some of the issues clang-3.5 warns about.
      
      Facebook:
      
      Test Plan:
      # after pulling in changes that allow clang-3.5 to be used
      fbconfig --clang --with-project-version clang:3.5 -r common/memory && fbmake runtests_opt
      fbconfig --clang --with-project-version clang:3.5 -r common/strings && fbmake runtests_opt
      fbconfig --clang --with-project-version clang:3.5 folly/test && fbmake runtests_opt
      
      Tests for common/strings and folly/test pass. common/memory has one test failure, which also occurs with clang-3.4, while eliminating a couple of test failures that clang-3.4 had.
      
      Reviewed By: meyering@fb.com
      
      Subscribers: fbcode-common-diffs@, sdwilsh, mathieubaudet, folly-diffs@
      
      FB internal diff: D1761101
      
      Signature: t1:1761101:1419976252:ff60166dc8986e1239f88012b5e552a7d204aede
      0f75d2ba
    • Sean Cannella's avatar
      Don't use FOLLY_TLS on Android · b7912274
      Sean Cannella authored
      Summary:
      emutls as far as StaticMeta needs to use it is broken on
      Android as well due to unspecified pthread_key cleanup order between the
      emulated __thread and our manual uses of it. Use the alternative that we
      use on __APPLE__ there as well.
      
      Test Plan: compiled and ran consuming code on Android
      
      Reviewed By: dancol@fb.com
      
      Subscribers: fma, shikong, kmdent, benyluo, ranjeeth, subodh, folly-diffs@
      
      FB internal diff: D1760569
      
      Tasks: 5265754, 5907613
      
      Signature: t1:1760569:1419955865:afe8f35dadda85393492ac9331e9f62a74f4fdad
      b7912274
    • Sarang Masti's avatar
      Allow conversion from a type T to itself · 821c5d75
      Sarang Masti authored
      Summary: same as title
      
      Test Plan: - fbconfig -r folly && fbmake runtests
      
      Reviewed By: andrei.alexandrescu@fb.com
      
      Subscribers: folly-diffs@
      
      FB internal diff: D1754577
      
      Signature: t1:1754577:1419618119:4c1a59cd19b23de9a9f6574341944e5e80530d62
      821c5d75
    • Dave Watson's avatar
      SharedThreadPool unittest · 450fee03
      Dave Watson authored
      Summary: Add a test to check that the accept IOPool can be the same as the IO worker thread pool
      
      Test Plan: unittest
      
      Reviewed By: jsedgwick@fb.com
      
      Subscribers: doug, fugalh, njormrod, folly-diffs@
      
      FB internal diff: D1710628
      
      Signature: t1:1710628:1417469919:6d81a9426b61e9f1b804114f895ed541e547110f
      450fee03
    • Keith Adams's avatar
      Add convenience functions to serialize to / deserialize from string · 1ed040e7
      Keith Adams authored
      Summary: kma asked
      
      Test Plan: tests added
      
      Reviewed By: andrei.bajenov@fb.com
      
      Subscribers: alandau, bmatheny, mshneer, folly-diffs@
      
      FB internal diff: D1756731
      
      Signature: t1:1756731:1419442987:afdccce166ef1f1e609d8894ea587915f6fea8e7
      1ed040e7