facebook / wangle Goto Github PK
View Code? Open in Web Editor NEWWangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
License: Apache License 2.0
Wangle is a framework providing a set of common client/server abstractions for building services in a consistent, modular, and composable way.
License: Apache License 2.0
Downloaded and built FB Folly
Now trying to build FB Wangle.
Build is broken because wangle code still uses getTFOSucceeded which was removed from folly/io/async/AsyncSocket on August 9. Can't believe this hasn't been noticed so far...
trying to test the server restart case with independent IOThreadPool Echo example. patch EchoClient to catch folly::AsyncSocketException in the while loop (receive input and write to pipeline), so the while loop keeps forever.
test steps like:
Firstly need the similar patch with issue 45, to keep the EventBase in ClientBootstrap and implement ~ClientBootstrap.
Tried to call client.connect() again in the exception handling. But assert, `eventBase_->isInEventBaseThread()’, may fail when destruct the previous pipeline inside ClientBootstrap, as IOThreadPool is set to 2 and ClientBootstrap.connect() may select a new thread for it.
Had to allocate a new ClientBootstrap or added the reconnect() function to ClientBootstrap, which used the saved EventBase in ClientBootstrap.connect() to setup connection again. Is it the correct way to handle the server process restart?
HI.
Does wangle have an already asynchronous postgresSQL handler(wrapper)?
Best.
The following error happens when building in Ubuntu 14.04
In file included from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/Handler.h:13:0,
from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13,
from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12,
from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:14,
from /home/vagrant/proxygen/proxygen/wangle/wangle/channel/broadcast/test/ObservingHandlerTest.cpp:10:
/usr/local/include/folly/futures/Future.h:50:3: note: declared here
Future(Future const&) = delete;
^
In file included from /home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/gmock-actions.h:46:0,
from /home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/gmock.h:58,
from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:12,
from /home/vagrant/proxygen/proxygen/wangle/wangle/channel/broadcast/test/ObservingHandlerTest.cpp:10:
/home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/internal/gmock-internal-utils.h: In instantiation of ‘T testing::internal::Invalid() [with T = folly::Future<wangle::BroadcastHandler<int>*>]’:
/home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/gmock-actions.h:78:33: required from ‘static T testing::internal::BuiltInDefaultValue<T>::Get() [with T = folly::Future<wangle::BroadcastHandler<int>*>]’
/home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/gmock-actions.h:190:47: required from ‘static T testing::DefaultValue<T>::Get() [with T = folly::Future<wangle::BroadcastHandler<int>*>]’
/home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/gmock-spec-builders.h:1460:38: required from ‘testing::internal::FunctionMockerBase<F>::Result testing::internal::FunctionMockerBase<F>::PerformDefaultAction(const ArgumentTuple&, const string&) const [with F = folly::Future<wangle::BroadcastHandler<int>*>(const std::basic_string<char>&); testing::internal::FunctionMockerBase<F>::Result = folly::Future<wangle::BroadcastHandler<int>*>; testing::internal::FunctionMockerBase<F>::ArgumentTuple = std::tuple<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>; testing::internal::string = std::basic_string<char>]’
/home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/gmock-spec-builders.h:1350:66: required from ‘static testing::internal::ActionResultHolder<T>* testing::internal::ActionResultHolder<T>::PerformDefaultAction(const testing::internal::FunctionMockerBase<F>*, const typename testing::internal::Function<F>::ArgumentTuple&, const string&) [with F = folly::Future<wangle::BroadcastHandler<int>*>(const std::basic_string<char>&); T = folly::Future<wangle::BroadcastHandler<int>*>; typename testing::internal::Function<F>::ArgumentTuple = std::tuple<const std::basic_string<char, std::char_traits<char>, std::allocator<char> >&>; testing::internal::string = std::basic_string<char>]’
/home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/gmock-spec-builders.h:1473:75: required from ‘testing::internal::UntypedActionResultHolderBase* testing::internal::FunctionMockerBase<F>::UntypedPerformDefaultAction(const void*, const string&) const [with F = folly::Future<wangle::BroadcastHandler<int>*>(const std::basic_string<char>&); testing::internal::string = std::basic_string<char>]’
/home/vagrant/proxygen/proxygen/wangle/wangle/channel/broadcast/test/ObservingHandlerTest.cpp:346:1: required from here
/home/vagrant/proxygen/proxygen/wangle/wangle/gmock/src/gmock/include/gmock/internal/gmock-internal-utils.h:371:71: error: use of deleted function ‘folly::Future<T>::Future(const folly::Future<T>&) [with T = wangle::BroadcastHandler<int>*]’
*static_cast<volatile typename remove_reference<T>::type*>(NULL));
^
In file included from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/Handler.h:13:0,
from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13,
from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12,
from /home/vagrant/proxygen/proxygen/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:14,
from /home/vagrant/proxygen/proxygen/wangle/wangle/channel/broadcast/test/ObservingHandlerTest.cpp:10:
/usr/local/include/folly/futures/Future.h:50:3: note: declared here
Future(Future const&) = delete;
^
make[2]: *** [CMakeFiles/ObservingHandlerTest.dir/channel/broadcast/test/ObservingHandlerTest.cpp.o] Error 1
make[1]: *** [CMakeFiles/ObservingHandlerTest.dir/all] Error 2
make[2]: *** [CMakeFiles/BroadcastPoolTest.dir/channel/broadcast/test/BroadcastPoolTest.cpp.o] Error 1
make[1]: *** [CMakeFiles/BroadcastPoolTest.dir/all] Error 2
Linking CXX executable bin/BootstrapTest
[ 95%] Built target BootstrapTest
Linking CXX executable bin/PipelineTest
[ 95%] Built target PipelineTest
make: *** [all] Error 2
Commenting out the tests added in commit 35005bc fixes the issue
[ 4%] Building CXX object CMakeFiles/wangle.dir/codec/LengthFieldPrepender.cpp.o
In file included from /usr/local/include/folly/futures/Promise-inl.h:23:0,
from /usr/local/include/folly/futures/Promise.h:115,
from /usr/local/include/folly/futures/Future.h:30,
from /home/leef/download/wangle/wangle/../wangle/channel/Handler.h:13,
from /home/leef/download/wangle/wangle/../wangle/codec/ByteToMessageCodec.h:13,
from /home/leef/download/wangle/wangle/../wangle/codec/LengthFieldPrepender.h:13,
from /home/leef/download/wangle/wangle/codec/LengthFieldPrepender.cpp:11:
/usr/local/include/folly/futures/detail/Core.h: In instantiation of ‘class folly::detail::Core’:
/usr/local/include/folly/futures/Future-inl.h:64:5: required from ‘void folly::Future::detach() [with T = void]’
/usr/local/include/folly/futures/Future-inl.h:58:10: required from ‘folly::Future::~Future() [with T = void]’
/home/leef/download/wangle/wangle/codec/LengthFieldPrepender.cpp:90:39: required from here
/usr/local/include/folly/futures/detail/Core.h:77:3: error: static assertion failed: void futures are not supported. Use Unit instead.
static_assert(!std::is_void::value,
^
make[2]: *** [CMakeFiles/wangle.dir/codec/LengthFieldPrepender.cpp.o] Error 1
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
make: *** [all] Error 2
Building on Arch Linux with 8Gb of ram, no swap. Can Acceptor.o require 8Gb to compile?
[ 1%] Building CXX object CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o
virtual memory exhausted: Cannot allocate memory
CMakeFiles/wangle.dir/build.make:62: recipe for target 'CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o' failed
make[2]: *** [CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o] Error 1
CMakeFiles/Makefile2:484: recipe for target 'CMakeFiles/wangle.dir/all' failed
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
I use the wangle version 0.13.0 and the folly version 0.57.0!
[ 20%] Building CXX object CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o
In file included from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:14:0,
from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10:
/home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h: In instantiation of ‘static wangle::ConnectionManager::UniquePtr wangle::ConnectionManager::makeUnique(Args&& ...) [with Args = {folly::EventBase_&, const std::chrono::duration<long int, std::ratio<1l, 1000l> >&, wangle::Acceptor_}; wangle::ConnectionManager::UniquePtr = std::unique_ptr<wangle::ConnectionManager, folly::DelayedDestruction::Destructor>]’:
/home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:87:54: required from here
/home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: error: no matching function for call to ‘make_unique(folly::EventBase_&, const std::chrono::duration<long int, std::ratio<1l, 1000l> >&, wangle::Acceptor_)’
std::forward(args)...);
^
/home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: note: candidates are:
In file included from /usr/local/include/folly/io/Cursor.h:31:0,
from /usr/local/include/folly/io/async/AsyncSSLSocket.h:32,
from /home/junhosuh/workspace/wangle/wangle/../wangle/ssl/SSLUtil.h:14,
from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:15,
from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:12,
from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10:
/usr/local/include/folly/Memory.h:48:1: note: template<class T, class ... Args> typename std::enable_if<(! std::is_array< >::value), std::unique_ptr >::type folly::make_unique(Args&& ...)
make_unique(Args&&... args) {
^
/usr/local/include/folly/Memory.h:48:1: note: template argument deduction/substitution failed:
In file included from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:14:0,
from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10:
/home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: note: cannot convert ‘std::forwardfolly::EventBase*&((* & args#0))’ (type ‘folly::EventBase_’) to type ‘folly::DelayedDestruction::Destructor&&’
std::forward(args)...);
^
In file included from /usr/local/include/folly/io/Cursor.h:31:0,
from /usr/local/include/folly/io/async/AsyncSSLSocket.h:32,
from /home/junhosuh/workspace/wangle/wangle/../wangle/ssl/SSLUtil.h:14,
from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:15,
from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:12,
from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10:
/usr/local/include/folly/Memory.h:55:1: note: template typename std::enable_if<std::is_array< >::value, std::unique_ptr >::type folly::make_unique(size_t)
make_unique(const size_t n) {
^
/usr/local/include/folly/Memory.h:55:1: note: template argument deduction/substitution failed:
In file included from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:14:0,
from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10:
/home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: error: wrong number of template arguments (2, should be 1)
std::forward(args)...);
^
In file included from /usr/local/include/folly/io/Cursor.h:31:0,
from /usr/local/include/folly/io/async/AsyncSSLSocket.h:32,
from /home/junhosuh/workspace/wangle/wangle/../wangle/ssl/SSLUtil.h:14,
from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:15,
from /home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/Acceptor.h:12,
from /home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:10:
/usr/local/include/folly/Memory.h:63:1: note: template<class T, class ... Args> typename std::enable_if<(std::extent<Tp>::value != 0), std::unique_ptr >::type folly::make_unique(Args&& ...)
make_unique(Args&&...) = delete;
^
/usr/local/include/folly/Memory.h:63:1: note: template argument deduction/substitution failed:
/usr/local/include/folly/Memory.h: In substitution of ‘template<class T, class ... Args> typename std::enable_if<(std::extent<Tp>::value != 0), std::unique_ptr >::type folly::make_unique(Args&& ...) [with T = wangle::ConnectionManager; Args = {folly::DelayedDestruction::Destructor}]’:
/home/junhosuh/workspace/wangle/wangle/../wangle/acceptor/ConnectionManager.h:64:34: required from ‘static wangle::ConnectionManager::UniquePtr wangle::ConnectionManager::makeUnique(Args&& ...) [with Args = {folly::EventBase&, const std::chrono::duration<long int, std::ratio<1l, 1000l> >&, wangle::Acceptor}; wangle::ConnectionManager::UniquePtr = std::unique_ptr<wangle::ConnectionManager, folly::DelayedDestruction::Destructor>]’
/home/junhosuh/workspace/wangle/wangle/acceptor/Acceptor.cpp:87:54: required from here
/usr/local/include/folly/Memory.h:63:1: error: no type named ‘type’ in ‘struct std::enable_if<false, std::unique_ptr<wangle::ConnectionManager, std::default_deletewangle::ConnectionManager > >’
make[2]: *_* [CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o] Error 1
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
make: *** [all] Error 2
I got feedback from some developers that wasn't much examples so I decided to add more examples. I've started off with the most basic: Echo Server/Client. #21
I will write a custom binary protocol next.
After cmake . I face the following problem when I try to make. PFB the logs of the same.
[ 49%] Building CXX object CMakeFiles/BroadcastHandlerTest.dir/channel/broadcast/test/BroadcastHandlerTest.cpp.o
In file included from /Users/nivas.thangavelu/code/wangle/wangle/channel/broadcast/test/BroadcastHandlerTest.cpp:10:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:15:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Handler.h:14:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Pipeline.h:22:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/acceptor/TransportInfo.h:12:
/Users/nivas.thangavelu/code/wangle/wangle/../wangle/ssl/SSLUtil.h:74:17: warning: 'SSL_CTX_get_ex_new_index' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
pindex = SSL_CTX_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
^
/usr/include/openssl/ssl.h:1614:5: note: 'SSL_CTX_get_ex_new_index' has been explicitly marked deprecated here
int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
^
In file included from /Users/nivas.thangavelu/code/wangle/wangle/channel/broadcast/test/BroadcastHandlerTest.cpp:10:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:15:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Handler.h:14:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Pipeline.h:22:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/acceptor/TransportInfo.h:12:
/Users/nivas.thangavelu/code/wangle/wangle/../wangle/ssl/SSLUtil.h:81:17: warning: 'RSA_get_ex_new_index' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
*pindex = RSA_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
^
/usr/include/openssl/rsa.h:389:5: note: 'RSA_get_ex_new_index' has been explicitly marked deprecated here
int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
^
In file included from /Users/nivas.thangavelu/code/wangle/wangle/channel/broadcast/test/BroadcastHandlerTest.cpp:10:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:15:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Handler.h:14:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Pipeline.h:22:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/acceptor/TransportInfo.h:12:
/Users/nivas.thangavelu/code/wangle/wangle/../wangle/ssl/SSLUtil.h:121:17: warning: 'SSL_SESSION_get_ex_new_index' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
*pindex = SSL_SESSION_get_ex_new_index(
^
/usr/include/openssl/ssl.h:1609:5: note: 'SSL_SESSION_get_ex_new_index' has been explicitly marked deprecated here
int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
^
3 warnings generated.
[ 49%] Linking CXX executable bin/BroadcastHandlerTest
ld: library not found for -latomic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: ** [bin/BroadcastHandlerTest] Error 1
make[1]: *** [CMakeFiles/BroadcastHandlerTest.dir/all] Error 2
make: *** [all] Error 2
I modify the telnet example to echo protocol.
/*
* Copyright (c) 2015, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
*/
#include <gflags/gflags.h>
#include <wangle/bootstrap/ServerBootstrap.h>
#include <wangle/channel/AsyncSocketHandler.h>
#include <wangle/codec/LineBasedFrameDecoder.h>
#include <wangle/codec/FixedLengthFrameDecoder.h>
#include <wangle/codec/StringCodec.h>
using namespace folly;
using namespace wangle;
DEFINE_int32(port, 8096, "echo server port");
DEFINE_int32(frame_length, 10, "echo frame length");
typedef Pipeline<IOBufQueue&, std::string> EchoPipeline;
class EchoHandler : public HandlerAdapter<std::string> {
public:
virtual void read(Context* ctx, std::string msg) override {
if (msg.empty())
{
write(ctx, "Please type something.\r\n");
}
else if (msg == "bye")
{
write(ctx, "Have a fabulous day!\r\n").then([ctx, this]{
close(ctx);
});
}
else
{
write(ctx, msg);
}
}
virtual void transportActive(Context* ctx) override {
auto sock = ctx->getTransport();
SocketAddress localAddress;
sock->getLocalAddress(&localAddress);
//write(ctx, "Welcome to " + localAddress.describe() + "!\r\n");
std::cout << "Welcome to " + localAddress.describe() + "!\r\n" << std::endl;
//write(ctx, "Type 'bye' to disconnect.\r\n");
}
};
class EchoPipelineFactory : public PipelineFactory<EchoPipeline> {
public:
EchoPipeline::Ptr newPipeline(std::shared_ptr<AsyncTransportWrapper> sock) {
auto pipeline = EchoPipeline::create();
pipeline->addBack(AsyncSocketHandler(sock));
pipeline->addBack(FixedLengthFrameDecoder(FLAGS_frame_length));
pipeline->addBack(StringCodec());
pipeline->addBack(EchoHandler());
pipeline->finalize();
return pipeline;
}
};
int main(int argc, char** argv) {
google::ParseCommandLineFlags(&argc, &argv, true);
ServerBootstrap<EchoPipeline> server;
server.childPipeline(std::make_shared<EchoPipelineFactory>());
server.bind(FLAGS_port);
server.waitForStop();
return 0;
}
I test it use my echoclient with 10 bytes playload,then the qps is only 13w。
My hardware:
model name : Intel(R) Xeon(R) CPU E5-2450 v2 @ 2.50GHz
cpu MHz : 2500.000
cache size : 20480 KB
MemTotal: 132133772 kB
OS:
CentOS release 6.3 (Final) with gcc 4.8
[ 71%] Building CXX object CMakeFiles/ConnectionManagerTest.dir/acceptor/test/ConnectionManagerTest.cpp.o
/home/vagrant/wangle/wangle/acceptor/test/ConnectionManagerTest.cpp: In function ‘int main(int, char**)’:
/home/vagrant/wangle/wangle/acceptor/test/ConnectionManagerTest.cpp:202:3: error: ‘gflags’ has not been declared
gflags::ParseCommandLineFlags(&argc, &argv, true);
^
make[2]: *** [CMakeFiles/ConnectionManagerTest.dir/acceptor/test/ConnectionManagerTest.cpp.o] Error 1
make[1]: *** [CMakeFiles/ConnectionManagerTest.dir/all] Error 2
make: *** [all] Error 2
Add #include <gflags/gflags.h>
to wangle/acceptor/test/ConnectionManagerTest.cpp
.
Hi,
Quick questions is it possible to configure wangle to use something like zero mq instead of socket ?
Regards
Ben
/usr/bin/ld: warning: libboost_thread.so.1.59.0, needed by /usr/local/lib/../lib/libfolly.so, may conflict with libboost_thread.so.1.54.0
/usr/bin/ld: warning: libboost_system.so.1.59.0, needed by /usr/local/lib/../lib/libfolly.so, may conflict with libboost_system.so.1.54.0
/usr/bin/ld: ../gmock/src/gmock-build/libgmock.a(gtest-all.cc.o): undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/AcceptorTest] error 1
make[1]: *** [CMakeFiles/AcceptorTest.dir/all] error 2
make: *** [all] error 2
I can not find the solution for the error.
uname -a:
Linux lixiang-ubuntu 3.16.0-50-generic #67~14.04.1-Ubuntu SMP Fri Oct 2 22:07:51 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
Hi Please Give LengthFieldBasedFrameDecoder Client and Server Example.
I ran into this compilation error with gcc 5.3 and Ubuntu 14.04. It looks like the issue is because -std=c++0x
is set in CMakeLists.txt instead of -std=c++14
. Since there are no dependencies on this header I just removed it from the build order for now.
In file included from /home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp:12:0:
/home/vagrant/wangle/wangle/../wangle/concurrent/Async.h:18:18: error: ‘async’ function uses ‘auto’ type specifier without trailing return type
auto async(F&& fn) {
^
/home/vagrant/wangle/wangle/../wangle/concurrent/Async.h:18:18: note: deduced return type only available with -std=c++14 or -std=gnu++14
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp: In member function ‘virtual void AsyncFunc_manual_executor_Test::TestBody()’:
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp:22:34: error: invalid use of ‘auto’
auto f = async([]{ return 42; });
^
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp: In member function ‘virtual void AsyncFunc_value_lambda_Test::TestBody()’:
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp:31:29: error: invalid use of ‘auto’
auto future = async(lambda);
^
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp: In member function ‘virtual void AsyncFunc_void_lambda_Test::TestBody()’:
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp:37:29: error: invalid use of ‘auto’
auto future = async(lambda);
^
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp: In member function ‘virtual void AsyncFunc_moveonly_lambda_Test::TestBody()’:
/home/vagrant/wangle/wangle/concurrent/test/AsyncTest.cpp:44:29: error: invalid use of ‘auto’
auto future = async(lambda);
^
make[2]: *** [CMakeFiles/AsyncTest.dir/concurrent/test/AsyncTest.cpp.o] Error 1
make[1]: *** [CMakeFiles/AsyncTest.dir/all] Error 2
make: *** [all] Error 2```
Any Ideas how to fix this?
[ 56%] Building CXX object CMakeFiles/wangle.dir/deprecated/rx/Dummy.cpp.o
[ 58%] Building CXX object CMakeFiles/wangle.dir/ssl/PasswordInFile.cpp.o
In file included from /tmp/fblualib-build.Nkyraj/wangle/wangle/ssl/PasswordInFile.cpp:10:0:
/tmp/fblualib-build.Nkyraj/wangle/wangle/../wangle/ssl/PasswordInFile.h:21:8: error: ‘void wangle::PasswordInFile::getPassword(std::string&, int)’ marked override, but does not override
void getPassword(std::string& password, int size) override {
^
make[2]: *** [CMakeFiles/wangle.dir/ssl/PasswordInFile.cpp.o] Error 1
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
make: *** [all] Error 2
Boost 1.60, GCC 5.3, Ubuntu 14.04
[ 71%] Building CXX object CMakeFiles/BootstrapTest.dir/bootstrap/BootstrapTest.cpp.o
Linking CXX executable bin/BootstrapTest
/usr/bin/ld: CMakeFiles/BootstrapTest.dir/bootstrap/BootstrapTest.cpp.o: undefined reference to symbol 'ZN5boost10filesystem4pathdVERKS1'
/usr/local/lib/libboost_filesystem.so.1.60.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
make[2]: *** [bin/BootstrapTest] Error 1
make[1]: *** [CMakeFiles/BootstrapTest.dir/all] Error 2
make: *** [all] Error 2
I recently compiled the Wangle library without libatomic (as it errors on Fedora 23). I just tried to build server that is very close to echo example in the implementation. When trying to build, this is what happens:
usr/bin/ld: /usr/local/lib/libwangle.a(SSLSessionCacheManager.cpp.o): undefined reference to symbol 'SSL_CTX_get_ex_new_index@@libssl.so.10'
/usr/lib64/libssl.so.10: error adding symbols: DSO missing from command line
libssl can be found in the given directories. Is there a way to disable SSLSessionCacheManager? Am I missing any dependencies?
What I did:
I have a byte array (actually the raw packet data) and I know its length. However, it may contain '\0' in the middle so that the example code doesn't work for me - such '\0' will be regarded as the end of string and I cannot send the whole array together to the destination.
I'm not quite familiar with Wangle and any idea for how to build a pipeline for my purpose?
Thanks!
P.S.
The pipeline in the sample code is showed below, it works perfect for the printable strings:
auto pipeline = EchoPipeline::create();
pipeline->addBack(AsyncSocketHandler(sock));
pipeline->addBack(
EventBaseHandler()); // ensure we can write from any thread
pipeline->addBack(LineBasedFrameDecoder(8192, false));
pipeline->addBack(StringCodec());
pipeline->addBack(EchoHandler());
A error occurs as follows:
$ make
[ 17%] Built target gmock
[ 17%] Building CXX object CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o
/home/zzcheng/software/wangle/wangle/acceptor/Acceptor.cpp: In member function 'void wangle::Acceptor::connectionReady(folly::AsyncTransportWrapper::UniquePtr, const folly::SocketAddress&, const string&, SecureTransportType, wangle::TransportInfo&)':
/home/zzcheng/software/wangle/wangle/acceptor/Acceptor.cpp:256:28: error: 'class folly::AsyncTransportWrapper' has no member named 'getUnderlyingTransport'
auto asyncSocket = sock->getUnderlyingTransport();
^
/home/zzcheng/software/wangle/wangle/acceptor/Acceptor.cpp:256:62: error: expected primary-expression before '>' token
auto asyncSocket = sock->getUnderlyingTransport();
^
/home/zzcheng/software/wangle/wangle/acceptor/Acceptor.cpp:256:64: error: expected primary-expression before ')' token
auto asyncSocket = sock->getUnderlyingTransport();
^
make[2]: *** [CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o] Error 1
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
make: *** [all] Error 2
thanks.
Test project /home/lixiang/library/facebook/wangle-master/wangle/build
Start 1: AcceptorTest
1/15 Test #1: AcceptorTest ......................... Passed 0.02 sec
Start 2: LoadShedConfigurationTest
2/15 Test #2: LoadShedConfigurationTest ............ Passed 0.01 sec
Start 3: PeekingAcceptorHandshakeHelperTest
3/15 Test #3: PeekingAcceptorHandshakeHelperTest ... Passed 0.02 sec
Start 4: BootstrapTest
4/15 Test #4: BootstrapTest ........................ Passed 0.64 sec
Start 5: AsyncSocketHandlerTest
5/15 Test #5: AsyncSocketHandlerTest ............... Passed 0.01 sec
Start 6: OutputBufferingHandlerTest
6/15 Test #6: OutputBufferingHandlerTest ........... Passed 0.01 sec
Start 7: PipelineTest
7/15 Test #7: PipelineTest ......................... Passed 0.27 sec
Start 8: CodecTest
8/15 Test #8: CodecTest ............................ Passed 0.00 sec
Start 9: CodelTest
9/15 Test #9: CodelTest ............................ Passed 0.58 sec
Start 10: GlobalExecutorTest
10/15 Test #10: GlobalExecutorTest ................... Passed 0.00 sec
Start 11: ThreadPoolExecutorTest
11/15 Test #11: ThreadPoolExecutorTest ............... Passed 0.69 sec
Start 12: RxTest
12/15 Test #12: RxTest ............................... Passed 0.01 sec
Start 13: ServiceTest
13/15 Test #13: ServiceTest .........................._Exception: SegFault 0.07 sec
Start 14: SSLCacheTest
14/15 Test #14: SSLCacheTest ........................._Failed 0.00 sec
Start 15: SSLContextManagerTest
15/15 Test #15: SSLContextManagerTest ................ Passed 0.00 sec
87% tests passed, 2 tests failed out of 15
Total Test time (real) = 2.34 sec
The following tests FAILED:
13 - ServiceTest (SEGFAULT)
14 - SSLCacheTest (Failed)
Errors while running CTest
Do you know why?
[ 30%] Building CXX object CMakeFiles/wangle.dir/channel/FileRegion.cpp.o
/Users/btv/wangle/wangle/channel/FileRegion.cpp:54:15: error: use of undeclared identifier 'SPLICE_F_NONBLOCK'
int flags = SPLICE_F_NONBLOCK | SPLICE_F_MORE;
Hi,
It seems the operator-> (https://github.com/facebook/folly/blob/e845ef57f1f368944123e4a50bd4d1616a363efa/folly/Singleton.h#L453) was removed at some point, so wangle compiles no more.
By fresh folly I mean commit 8f1e662a59dec3476bf626b283effaa8a88acdd5 (and Singleton.h https://github.com/facebook/folly/blob/8f1e662a59dec3476bf626b283effaa8a88acdd5/folly/Singleton.h).
Vadim
Im decoding LengthFieldBasedFrameDecoder format. when I'm Decoding Length is not coming. Please Suggest me How i need to decode. please find the below program
class EchoHandler : public HandlerAdapterstd::string {
public:
virtual void read(Context* ctx, std::string msg) override {
LOG(INFO) << "Recieving Time";
/* Here Im Decoding the Buffer but Content Length is Not able to Read *//
std::cout << "handling " << msg << std::endl;
write(ctx, msg + "\r\n");
}
};
class EchoPipelineFactory : public PipelineFactory {
public:
EchoPipeline::Ptr newPipeline(std::shared_ptr sock) {
auto pipeline = EchoPipeline::create();
pipeline->addBack(AsyncSocketHandler(sock));
pipeline->addBack(LengthFieldBasedFrameDecoder());
pipeline->addBack(LengthFieldPrepender());
pipeline->addBack(StringCodec());
pipeline->addBack(EchoHandler());
pipeline->finalize();
return pipeline;
}
};
int main(int argc, char** argv) {
google::ParseCommandLineFlags(&argc, &argv, true);
ServerBootstrap server;
server.childPipeline(std::make_shared());
server.bind(FLAGS_port);
server.waitForStop();
return 0;
}
What is the right way to deal with readEOF and readException? My understanding is that one needs to close the context on readEOF otherwise the pipeline object will never get destroyed. The echo server example doesn't do this. Isn't this a problem?
Should the context also be closed on readException or is this condition recoverable?
I am trying to build a pipeline that behaves similarly as Subscriber. I could not use broadcast pipeline directly because broadcasting is not the desired default behavior. So the basic operations look like follows:
Client A connects and subscribe so I save Context A
Client B connects and issued a request that A is interested in, so I write data to Context A.
Interestingly, this code works as expected only when compiled with NDEBUG
flag on. I otherwise get a DCHECK
failure that can be traced back to folly
:
https://github.com/facebook/folly/blob/2c8de414e51305fa00ef6efdab69de0fbda7aff1/folly/io/async/EventBase.cpp#L494
While the check appears in the folly
code, I am wondering what is the right approach of mimicking the behavior of wangle
's broadcast pipeline.
Currently the root CMakelist.txt file's include dirs are:
include_directories(
${CMAKE_SOURCE_DIR}/..
${FOLLY_INCLUDE_DIR}
${INCLUDE_DIR}
)
This is missing the boost include dirs.
I think it should be:
include_directories(
${CMAKE_SOURCE_DIR}/..
${FOLLY_INCLUDE_DIR}
${Boost_INCLUDE_DIRS}
${INCLUDE_DIR}
)
I cloned the repo, did the following, and got this error:
cd wangle/wangle
sudo cmake .
sudo make
yba@ubuntu:~/Documents/XXX/tools/fbthrift/wangle/wangle$ sudo make
[ 1%] Performing configure step for 'gmock'
CMake Error at /home/yba/Documents/XXX/tools/fbthrift/wangle/wangle/gmock/src/gmock-stamp/gmock-configure.cmake:16 (message):
Command failed: 1
'/usr/bin/cmake' '-GUnix Makefiles' '/home/yba/Documents/XXX/tools/fbthrift/wangle/wangle/gmock/src/gmock'
See also
/home/yba/Documents/XXX/tools/fbthrift/wangle/wangle/gmock/src/gmock-stamp/gmock-configure-*.log
make[2]: *** [gmock/src/gmock-stamp/gmock-configure] Error 1
make[1]: *** [CMakeFiles/gmock.dir/all] Error 2
make: *** [all] Error 2
The error log says:
-- downloading...
src='https://googlemock.googlecode.com/files/gmock-1.7.0.zip'
dst='/home/yba/Documents/XXX/tools/fbthrift/wangle/wangle/gmock/src/gmock-1.7.0.zip'
timeout='none'
CMake Error at gmock-stamp/download-gmock.cmake:21 (message):
error: downloading
'https://googlemock.googlecode.com/files/gmock-1.7.0.zip' failed
status_code: 22
status_string: "HTTP response code said error"
log: Hostname was NOT found in DNS cache
Trying 173.194.205.82...
Connected to googlemock.googlecode.com (173.194.205.82) port 443 (#0)
successfully set certificate verify locations:
CAfile: none
CApath: /etc/ssl/certs
SSLv3, TLS handshake, Client hello (1):
Is this normal? https://googlemock.googlecode.com/files/gmock-1.7.0.zip
seems to be invalid. Please confirm this is a bug, or help me on how to compile it. I could compile successfully last month.
Thank you very much!
After cmake . I face the following problem when I try to make. PFB the logs of the same.
[ 49%] Building CXX object CMakeFiles/BroadcastHandlerTest.dir/channel/broadcast/test/BroadcastHandlerTest.cpp.o
In file included from /Users/nivas.thangavelu/code/wangle/wangle/channel/broadcast/test/BroadcastHandlerTest.cpp:10:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:15:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Handler.h:14:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Pipeline.h:22:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/acceptor/TransportInfo.h:12:
/Users/nivas.thangavelu/code/wangle/wangle/../wangle/ssl/SSLUtil.h:74:17: warning: 'SSL_CTX_get_ex_new_index' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
pindex = SSL_CTX_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
^
/usr/include/openssl/ssl.h:1614:5: note: 'SSL_CTX_get_ex_new_index' has been explicitly marked deprecated here
int SSL_CTX_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
^
In file included from /Users/nivas.thangavelu/code/wangle/wangle/channel/broadcast/test/BroadcastHandlerTest.cpp:10:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:15:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Handler.h:14:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Pipeline.h:22:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/acceptor/TransportInfo.h:12:
/Users/nivas.thangavelu/code/wangle/wangle/../wangle/ssl/SSLUtil.h:81:17: warning: 'RSA_get_ex_new_index' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
*pindex = RSA_get_ex_new_index(0, nullptr, nullptr, nullptr, nullptr);
^
/usr/include/openssl/rsa.h:389:5: note: 'RSA_get_ex_new_index' has been explicitly marked deprecated here
int RSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
^
In file included from /Users/nivas.thangavelu/code/wangle/wangle/channel/broadcast/test/BroadcastHandlerTest.cpp:10:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/test/Mocks.h:15:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/broadcast/BroadcastHandler.h:12:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Handler.h:14:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/channel/Pipeline.h:22:
In file included from /Users/nivas.thangavelu/code/wangle/wangle/../wangle/acceptor/TransportInfo.h:12:
/Users/nivas.thangavelu/code/wangle/wangle/../wangle/ssl/SSLUtil.h:121:17: warning: 'SSL_SESSION_get_ex_new_index' is deprecated: first deprecated in OS X 10.7 [-Wdeprecated-declarations]
*pindex = SSL_SESSION_get_ex_new_index(
^
/usr/include/openssl/ssl.h:1609:5: note: 'SSL_SESSION_get_ex_new_index' has been explicitly marked deprecated here
int SSL_SESSION_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
^
3 warnings generated.
[ 49%] Linking CXX executable bin/BroadcastHandlerTest
ld: library not found for -latomic
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: ** [bin/BroadcastHandlerTest] Error 1
make[1]: *** [CMakeFiles/BroadcastHandlerTest.dir/all] Error 2
make: *** [all] Error 2
I did smpp decoding but clients side I'm not able read the response
System: OS X 10.11.4
openssl
is installed by homebrew, brew install openssl
.
CMake command-line options: cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ .
Following log shows that cmake
found openssl
successfully:
$ cd wangle
$ cmake -DOPENSSL_ROOT_DIR=/usr/local/opt/openssl/ .
-- The C compiler identification is AppleClang 7.3.0.7030029
-- The CXX compiler identification is AppleClang 7.3.0.7030029
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found Folly: /usr/local/include
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Boost version: 1.60.0
-- Found the following Boost libraries:
-- system
-- thread
-- filesystem
-- chrono
-- date_time
-- atomic
-- Found OpenSSL: /usr/local/opt/openssl/lib/libssl.dylib;/usr/local/opt/openssl/lib/libcrypto.dylib (found version "1.0.2g")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/haoxun/Temp/wangle/wangle
But, make
complains that <openssl/ssl.h>
not found:
$ make
Scanning dependencies of target wangle
[ 1%] Building CXX object CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o
In file included from /Users/haoxun/Temp/wangle/wangle/acceptor/Acceptor.cpp:10:
In file included from /Users/haoxun/Temp/wangle/wangle/../wangle/acceptor/Acceptor.h:12:
In file included from /Users/haoxun/Temp/wangle/wangle/../wangle/acceptor/ServerSocketConfig.h:13:
In file included from /Users/haoxun/Temp/wangle/wangle/../wangle/ssl/SSLContextConfig.h:14:
/usr/local/include/folly/io/async/SSLContext.h:26:10: fatal error: 'openssl/ssl.h' file not found
#include <openssl/ssl.h>
^
1 error generated.
make[2]: *** [CMakeFiles/wangle.dir/acceptor/Acceptor.cpp.o] Error 1
make[1]: *** [CMakeFiles/wangle.dir/all] Error 2
make: *** [all] Error 2
I've check the CMakeCache.txt
, seems there's nothing wrong:
//Path to a library.
OPENSSL_CRYPTO_LIBRARY:FILEPATH=/usr/local/opt/openssl/lib/libcrypto.dylib
//Path to a file.
OPENSSL_INCLUDE_DIR:PATH=/usr/local/opt/openssl/include
//No help, variable specified on the command line.
OPENSSL_ROOT_DIR:UNINITIALIZED=/usr/local/opt/openssl/
//Path to a library.
OPENSSL_SSL_LIBRARY:FILEPATH=/usr/local/opt/openssl/lib/libssl.dylib
OPENSSL_INCLUDE_DIR
detected by cmake
is correct, of course:
$ cd /usr/local/opt/openssl/include
$ tree
.
└── openssl
├── aes.h
├── asn1.h
├── asn1_mac.h
├── asn1t.h
├── bio.h
├── blowfish.h
├── bn.h
├── buffer.h
├── camellia.h
├── cast.h
├── cmac.h
├── cms.h
├── comp.h
├── conf.h
├── conf_api.h
├── crypto.h
├── des.h
├── des_old.h
├── dh.h
├── dsa.h
├── dso.h
├── dtls1.h
├── e_os2.h
├── ebcdic.h
├── ec.h
├── ecdh.h
├── ecdsa.h
├── engine.h
├── err.h
├── evp.h
├── hmac.h
├── idea.h
├── krb5_asn.h
├── kssl.h
├── lhash.h
├── md4.h
├── md5.h
├── mdc2.h
├── modes.h
├── obj_mac.h
├── objects.h
├── ocsp.h
├── opensslconf.h
├── opensslv.h
├── ossl_typ.h
├── pem.h
├── pem2.h
├── pkcs12.h
├── pkcs7.h
├── pqueue.h
├── rand.h
├── rc2.h
├── rc4.h
├── ripemd.h
├── rsa.h
├── safestack.h
├── seed.h
├── sha.h
├── srp.h
├── srtp.h
├── ssl.h
├── ssl2.h
├── ssl23.h
├── ssl3.h
├── stack.h
├── symhacks.h
├── tls1.h
├── ts.h
├── txt_db.h
├── ui.h
├── ui_compat.h
├── whrlpool.h
├── x509.h
├── x509_vfy.h
└── x509v3.h
1 directory, 75 files
In conclusion, I guess there's something wrong in the CMakeLists.txt
.
It seems that lasted folly has make Future copy ctor deleted, which is used in AsyncSocketHandlerTest.cpp.
Scanning dependencies of target AsyncSocketHandlerTest
[ 2%] Building CXX object CMakeFiles/AsyncSocketHandlerTest.dir/channel/test/AsyncSocketHandlerTest.cpp.o
In file included from /home/zed/fbthrift/thrift/build/deps/wangle/wangle/gmock/src/gmock/include/gmock/gmock-generated-function-mockers.h:43:0,
from /home/zed/fbthrift/thrift/build/deps/wangle/wangle/gmock/src/gmock/include/gmock/gmock.h:61,
from /home/zed/fbthrift/thrift/build/deps/wangle/wangle/../wangle/channel/test/MockHandler.h:13,
from /home/zed/fbthrift/thrift/build/deps/wangle/wangle/channel/test/AsyncSocketHandlerTest.cpp:14:
/home/zed/fbthrift/thrift/build/deps/wangle/wangle/gmock/src/gmock/include/gmock/gmock-spec-builders.h: In instantiation of ‘T testing::internal::ActionResultHolder::GetValueAndDelete() const [with T = folly::Futurefolly::Unit]’:
/home/zed/fbthrift/thrift/build/deps/wangle/wangle/gmock/src/gmock/include/gmock/gmock-spec-builders.h:1530:60: required from ‘testing::internal::FunctionMockerBase::Result testing::internal::FunctionMockerBase::InvokeWith(const ArgumentTuple&) [with F = folly::Futurefolly::Unit(wangle::HandlerContext<folly::IOBufQueue&, std::unique_ptrfolly::IOBuf >, std::shared_ptrfolly::IOBuf); testing::internal::FunctionMockerBase::Result = folly::Futurefolly::Unit; testing::internal::FunctionMockerBase::ArgumentTuple = std::tuple<wangle::HandlerContext<folly::IOBufQueue&, std::unique_ptr<folly::IOBuf, std::default_deletefolly::IOBuf > >, std::shared_ptrfolly::IOBuf >]’
/home/zed/fbthrift/thrift/build/deps/wangle/wangle/gmock/src/gmock/include/gmock/gmock-generated-function-mockers.h:118:50: required from ‘R testing::internal::FunctionMocker<R(A1, A2)>::Invoke(A1, A2) [with R = folly::Futurefolly::Unit; A1 = wangle::HandlerContext<folly::IOBufQueue&, std::unique_ptrfolly::IOBuf >*; A2 = std::shared_ptrfolly::IOBuf]’
/home/zed/fbthrift/thrift/build/deps/wangle/wangle/../wangle/channel/test/MockHandler.h:73:3: required from here
/home/zed/fbthrift/thrift/build/deps/wangle/wangle/gmock/src/gmock/include/gmock/gmock-spec-builders.h:1330:20: error: use of deleted function ‘folly::Future::Future(const folly::Future&) [with T = folly::Unit]’
T retval(value_);
^
In file included from /home/zed/fbthrift/thrift/build/deps/wangle/wangle/../wangle/channel/Handler.h:13:0,
from /home/zed/fbthrift/thrift/build/deps/wangle/wangle/../wangle/channel/AsyncSocketHandler.h:13,
from /home/zed/fbthrift/thrift/build/deps/wangle/wangle/channel/test/AsyncSocketHandlerTest.cpp:12:
/usr/local/include/folly/futures/Future.h:50:3: error: declared here
Future(Future const&) = delete;
I tried to compile wangle on lastest commit whose hash is 0891263.
errors occur in SSLContextManagerTest.cpp: In member function ‘virtual void wangle::SSLContextManagerTest_TestSessionContextIfSupplied_Test::TestBody()’
but compile is succeeded on right before commit whose hash is 1ae9efd.
I'm installing proxygen. it forced to change branch to master. so I cannot install it. Please fix it.
On Mac OS X 10.10.5, when calling make
to build wangle, errors generated like:
/Users/yimmeng/repos/devlibs/wangle/wangle/../wangle/channel/HandlerContext-inl.h:413:14: error: no viable conversion from 'Future<void>' to 'Future<folly::Unit>'
return folly::makeFuture();
I am building wangle with homebrew installed folly (folly: stable 0.48.0 (bottled))
boost-1.59.0 double-conversion folly gcc-4.9.4 gflags glog gmp-4.3.2 libevent mpc-1.0.3 mpfr-2.4.2 mstch openssl-1.0.1u snappy
cd /home/$USER/downloads
git clone https://github.com/facebook/wangle
cd wangle/wangle
env PATH=/home/$USER/build/gcc-4.9.4/bin/:$PATH cmake -DBUILD_SHARED_LIBS=ON -DFOLLY_LIBRARY=/home/$USER/build/folly/lib/libfolly.so -DFOLLY_LIBRARIES=/home/$USER/build/folly/lib -DFOLLY_INCLUDE_DIR=/home/$USER/build/folly/include -DBOOST_ROOT=/home/$USER/build/boost-1.59.0 -DBoost_LIBRARIES=/home/$USER/build/boost-1.59.0/lib -DGFLAGS_LIBRARY_PATH=/home/$USER/build/gflags/lib/libgflags.so -DGLOG_LIBRARY_PATH=/home/$USER/build/glog/lib/libglog.so -DOPENSSL_LIBRARIES=/home/$USER/build/openssl-1.0.1u/lib -DOPENSSL_INCLUDE_DIR=/home/$USER/build/openssl-1.0.1u/include -DCMAKE_INSTALL_PREFIX=/home/$USER/build/wangle -DINCLUDE_DIR="/home/$USER/build/double-conversion/include;/home/$USER/build/gflags/include;/home/$USER/build/glog/include;/home/$USER/build/libevent/include;/home/$USER/build/boost-1.59.0/include" .
env PATH=/home/$USER/build/gcc-4.9.4/bin/:$PATH make -j 10
My LD_LIBRARY_PATH is:
/home/spershin/build/folly/lib:/home/spershin/build/boost-1.59.0/lib:/home/spershin/build/double-conversion/lib64:/home/spershin/build/gflags/lib:/home/spershin/build/glog/lib:/home/spershin/build/snappy/lib:/home/spershin/build/openssl-1.0.1u/lib:/home/spershin/build/libevent/lib:/home/spershin/build/gmp-4.3.2/lib:/home/spershin/build/mpfr-2.4.2/lib:/home/spershin/build/mpc-1.0.3/lib
I get the following problems and suspicious output:
During cmake it says it has found system ssl libraries despite the specified variable (OPENSSL_LIBRARIES) in the command line:
-- Found OpenSSL: /usr/lib64/libssl.so;/usr/lib64/libcrypto.so (found version "1.0.1u")
During make:
make[2]: Warning: File CMakeFiles/LoadShedConfigurationTest.dir/depend.make has modification time 0.0025 s in the future
make[2]: Warning: File CMakeFiles/ConnectionManagerTest.dir/depend.make has modification time 0.0033 s in the future
make[2]: Warning: File CMakeFiles/ThreadPoolExecutorTest.dir/depend.make has modification time 0.00063 s in the future
make[2]: Warning: File CMakeFiles/PeekingAcceptorHandshakeHelperTest.dir/depend.make has modification time 0.0014 s in the future
make[2]: Warning: File CMakeFiles/AcceptorTest.dir/depend.make has modification time 0.00039 s in the future
...
[ 64%] Linking CXX executable bin/LoadShedConfigurationTest
/bin/ld: warning: libssl.so.1.0.0, needed by /home/spershin/build/folly/lib/libfolly.so, may conflict with libssl.so.10
/bin/ld: warning: libcrypto.so.1.0.0, needed by /home/spershin/build/folly/lib/libfolly.so, may conflict with libcrypto.so.10
/home/spershin/build/folly/lib/libfolly.so: undefined reference to std::__throw_out_of_range_fmt(char const*, ...)@GLIBCXX_3.4.20
/home/spershin/build/folly/lib/libfolly.so: undefined reference to __cxa_throw_bad_array_new_length@CXXABI_1.3.8
collect2: error: ld returned 1 exit status
make[2]: *** [bin/LoadShedConfigurationTest] Error 1
make[1]: *** [CMakeFiles/LoadShedConfigurationTest.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
The linking error is the same for all test binaries, I think.
So I see two problems: the build is picking up the wrong ssl libraries and possibly some incorrect system libraries.
I checked the "/home/spershin/build/folly/lib/libfolly.so" and ldd does not report any "not found" dependencies. I've also been able to compile a simple application & link it with the folly library.
I'm at lost at the moment and would appreciate any help.
Thanks!
I will write an in-depth tutorial based on my upcoming blog post - Writing high-performance servers with modern C++
I would be grateful for a peer review before I publish and merge into the README.md.
Is there anything that I have missed out?
Is anything incorrect?
Does it flow correctly?
Is it interesting enough?
Lib | version |
---|---|
wangle | v0.13.0 |
folly | v0.57.0 |
Test project /home/ubuntu/facebook/wangle/wangle
Start 1: BootstrapTest
1/11 Test #1: BootstrapTest .................... Passed 0.63 sec
Start 2: OutputBufferingHandlerTest
2/11 Test #2: OutputBufferingHandlerTest ....... Passed 0.01 sec
Start 3: PipelineTest
3/11 Test #3: PipelineTest ..................... Passed 0.01 sec
Start 4: CodecTest
4/11 Test #4: CodecTest ........................***Failed 0.01 sec
Start 5: CodelTest
5/11 Test #5: CodelTest ........................ Passed 0.40 sec
Start 6: GlobalExecutorTest
6/11 Test #6: GlobalExecutorTest ............... Passed 0.01 sec
Start 7: ThreadPoolExecutorTest
7/11 Test #7: ThreadPoolExecutorTest ........... Passed 0.72 sec
Start 8: RxTest
8/11 Test #8: RxTest ........................... Passed 0.01 sec
Start 9: ServiceTest
9/11 Test #9: ServiceTest ......................***Exception: SegFault 0.13 sec
Start 10: SSLCacheTest
10/11 Test #10: SSLCacheTest .....................***Failed 0.01 sec
Start 11: SSLContextManagerTest
11/11 Test #11: SSLContextManagerTest ............ Passed 0.01 sec
73% tests passed, 3 tests failed out of 11
Total Test time (real) = 1.94 sec
The following tests FAILED:
4 - CodecTest (Failed)
9 - ServiceTest (SEGFAULT)
10 - SSLCacheTest (Failed)
root@douglasnote:/home/douglas/projetos/filtro/lib/proxigen/proxygen/wangle/wangle# cmake .
-- Boost version: 1.54.0
-- Found the following Boost libraries:
-- system
-- thread
-- Configuring done
-- Generating done
-- Build files have been written to: /home/douglas/projetos/filtro/lib/proxigen/proxygen/wangle/wangle
root@douglasnote:/home/douglas/projetos/filtro/lib/proxigen/proxygen/wangle/wangle# make
[ 18%] Built target gmock
[ 74%] Built target wangle
[ 76%] Built target BootstrapTest
[ 79%] Built target CodecTest
[ 81%] Built target CodelTest
[ 83%] Built target GlobalExecutorTest
[ 86%] Built target OutputBufferingHandlerTest
[ 88%] Built target PipelineTest
[ 90%] Built target RxTest
[ 93%] Built target SSLCacheTest
[ 95%] Built target SSLContextManagerTest
[ 97%] Building CXX object CMakeFiles/ServiceTest.dir/service/ServiceTest.cpp.o
/home/douglas/projetos/filtro/lib/proxigen/proxygen/wangle/wangle/service/ServiceTest.cpp: In function ‘int folly::main(int, char*)’:
/home/douglas/projetos/filtro/lib/proxigen/proxygen/wangle/wangle/service/ServiceTest.cpp:324:3: error: ‘ParseCommandLineFlags’ is not a member of ‘google’
google::ParseCommandLineFlags(&argc, &argv, true);
^
make[2]: * [CMakeFiles/ServiceTest.dir/service/ServiceTest.cpp.o] Erro 1
make[1]: ** [CMakeFiles/ServiceTest.dir/all] Erro 2
make: ** [all] Erro 2
uname -a
Linux douglasnote 3.13.0-53-generic #89-Ubuntu SMP Wed May 20 10:34:39 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
trying to test the separate IOThreadPool. Patch like below for EchoClient.cpp
std::shared_ptrwangle::IOThreadPoolExecutor ioPool =
std::make_sharedwangle::IOThreadPoolExecutor(2);
std::shared_ptr pipeFact =
std::make_shared();
ClientBootstrap client;
client.group(ioPool);
client.pipelineFactory(pipeFact);
But when EchoClient exits, assert error showed up.
I0423 21:57:13.939635 54128 AsyncSocket.cpp:519] AsyncSocket::setReadCallback() this=0x7f2b88001950, fd=11, callback=0, state=2
EchoClient: io/async/AsyncSocket.cpp:558: virtual void folly::AsyncSocket::setReadCB(folly::AsyncTransportWrapper::ReadCallback*): Assertion `eventBase_->isInEventBaseThread()' failed.
Looks Pipeline/AsyncSocket destruction was called by the main thread, that was why AsyncSocket assert.
Added the patch to ClientBootstrap to avoid this assert. Is it the correct way to handle it?
Basically the patch kept the EventBase that was selected to setup the socket with server at connect() in ClientBootstrap class. And destruct pipeline in the EventBase thread in ~ClientBootstrap.
virtual ~ClientBootstrap() {
if (base_ && group_.get() && pipeline_) {
// Pipeline was already created, destroy from the EventBase thread
// as AsyncSocket destruct could only be called from its EventBase thread
VLOG(5) << " ~ClientBootstrap " << this
<< ", destruct pipeline_ in EventBase thread";
base_->runImmediatelyOrRunInEventBaseThreadAndWait(&{
pipeline_.reset();
});
}
};
What is the limit and how can one go about increasing it ?
try to create multiple connections to the same server with Echo example. but could not get it work. any help?
The code change is simple
diff --git a/wangle/example/echo/EchoClient.cpp b/wangle/example/echo/EchoClient.cpp
index 5ee0cad..2b424b1 100644
--- a/wangle/example/echo/EchoClient.cpp
+++ b/wangle/example/echo/EchoClient.cpp
@@ -60,26 +60,49 @@ int main(int argc, char** argv) {
google::ParseCommandLineFlags(&argc, &argv, true);
ClientBootstrap client;
-- client.group(std::make_sharedwangle::IOThreadPoolExecutor(1));
++ client.group(std::make_sharedwangle::IOThreadPoolExecutor(2));
client.pipelineFactory(std::make_shared());
auto pipeline = client.connect(SocketAddress(FLAGS_host, FLAGS_port)).get();
++ auto pipeline1 = client.connect(SocketAddress(FLAGS_host, FLAGS_port)).get();
get below error
./bin/EchoClient -v=5
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0414 03:06:57.619832 12775 EventBase.cpp:164] EventBase(): Created.
I0414 03:06:57.621055 12775 EventBase.cpp:295] EventBase(): Starting loop.
I0414 03:06:57.621507 12775 EventBase.cpp:401] EventBase 0x7fd1e0000af0 loop time: 0
I0414 03:06:57.621940 12775 EventBase.cpp:401] EventBase 0x7fd1e0000af0 loop time: 0
I0414 03:06:57.622267 12775 EventBase.cpp:401] EventBase 0x7fd1e0000af0 loop time: 0
I0414 03:06:57.622627 12774 EventBase.cpp:164] EventBase(): Created.
I0414 03:06:57.623005 12774 EventBase.cpp:295] EventBase(): Starting loop.
I0414 03:06:57.623384 12773 EventBase.cpp:164] EventBase(): Created.
I0414 03:06:57.623760 12774 EventBase.cpp:401] EventBase 0x7fd1d8000a10 loop time: 0
I0414 03:06:57.624092 12774 AsyncSocket.cpp:192] new AsyncSocket(0x7fd1d80017c0, evb=0x7fd1d8000a10)
I0414 03:06:57.624151 12774 AsyncSocket.cpp:383] AsyncSocket::connect(this=0x7fd1d80017c0, evb=0x7fd1d8000a10, fd=15, host=[::1]:8080
I0414 03:06:57.624732 12774 EventBase.cpp:401] EventBase 0x7fd1d8000a10 loop time: 0
I0414 03:06:57.624949 12774 AsyncSocket.cpp:1401] AsyncSocket::handleWrite() this=0x7fd1d80017c0, fd=15, state=1
I0414 03:06:57.624963 12774 AsyncSocket.cpp:1573] AsyncSocket::handleConnect() this=0x7fd1d80017c0, fd=15, state=1
I0414 03:06:57.624979 12774 AsyncSocket.cpp:1750] AsyncSocket::updateEventRegistration(this=0x7fd1d80017c0, fd=15, evb=0x7fd1d8000a10, state=2, events=2
I0414 03:06:57.625022 12775 AsyncSocket.cpp:192] new AsyncSocket(0x7fd1e0001950, evb=0x7fd1e0000af0)
I0414 03:06:57.625051 12775 AsyncSocket.cpp:383] AsyncSocket::connect(this=0x7fd1e0001950, evb=0x7fd1e0000af0, fd=16, host=[::1]:8080
EchoClient: io/async/AsyncSocket.cpp:558: virtual void folly::AsyncSocket::setReadCB(folly::AsyncTransportWrapper::ReadCallback*): Assertion `eventBase_->isInEventBaseThread()' failed.
Aborted
Hi Please give the UDP Server and Client Example
When I tried to build wangle, it reported:
In file included from /project/opensource/source/wangle/wangle/../wangle/concurrent/ThreadPoolExecutor.h:19:
In file included from /project/opensource/source/wangle/wangle/../wangle/deprecated/rx/Observable.h:20:
/usr/local/include/folly/small_vector.h:619:14: error: use of undeclared identifier 'malloc_usable_size'
return malloc_usable_size(u.pdata_.heap_) / sizeof(value_type);
I've built "folly" successfully, did anyone encounter the same issue?
Thanks!
Hello,
I need to implement a proxy (client side) with Wangle. The proxy server is already there, which is a simple HTTP proxy - the client can CONNECT
to it, and send the message via the tunnel.
So I already have a pipeline ready, which is able to communicate with the destination directly. Does anyone have good ideas how to extend the original pipeline to support proxy? (ie. the direct destination is fixed to be the proxy while each connection can be configured in advance for the actual destination. I have no idea how to CONNECT
to the server and distinguish different connections based on the actual destination.)
Thanks in advance!
Zhenyu
Hi,
Latest tags from the projects are incompatible. I am using v2016.08.15.00 from folly and 0.13.0 from wangle. Could you please create a compatible tag for this folly version?
Thanks!
Br,
Zleho
Hello,
I built folly
and wangle
on linux (RHEL, gcc-4.8). Few of the tests fail with segfaults:
$ ./build/bin/ConnectionManagerTest
[==========] Running 12 tests from 1 test case.
[----------] Global test environment set-up.
[----------] 12 tests from ConnectionManagerTest
[ RUN ] ConnectionManagerTest.testShutdownSequence
*** Aborted at 1467472772 (unix time) try "date -d @1467472772" if you are using GNU date ***
PC: @ 0x49b7d4 __gnu_cxx::__exchange_and_add()
*** SIGSEGV (@0x9) received by PID 26785 (TID 0x7f5cb0f36800) from PID 9; stack trace: ***
@ 0x3ab2a0f710 (unknown)
@ 0x49b7d4 __gnu_cxx::__exchange_and_add()
@ 0x49b834 __gnu_cxx::__exchange_and_add_dispatch()
@ 0x49f34d std::_Sp_counted_base<>::_M_release()
@ 0x49e91d std::__shared_count<>::~__shared_count()
@ 0x49df8e std::__shared_ptr<>::~__shared_ptr()
@ 0x7f5cb427c3e9 std::__shared_ptr<>::operator=()
@ 0x7f5cb4276eb2 std::shared_ptr<>::operator=()
@ 0x7f5cb433ae0d folly::AsyncTimeout::scheduleTimeout()
@ 0x49c4db wangle::ConnectionManager::DrainHelper::startDrain()
@ 0x49c487 wangle::ConnectionManager::DrainHelper::startDrainAll()
@ 0x49c218 wangle::ConnectionManager::initiateGracefulShutdown()
@ 0x482404 (anonymous namespace)::ConnectionManagerTest_testShutdownSequence_Test::TestBody()
@ 0x4c2f0e testing::internal::HandleSehExceptionsInMethodIfSupported<>()
@ 0x4be15c testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x4a5a4b testing::Test::Run()
@ 0x4a6226 testing::TestInfo::Run()
@ 0x4a68b6 testing::TestCase::Run()
@ 0x4ad0fc testing::internal::UnitTestImpl::RunAllTests()
@ 0x4c42ec testing::internal::HandleSehExceptionsInMethodIfSupported<>()
@ 0x4befb6 testing::internal::HandleExceptionsInMethodIfSupported<>()
@ 0x4abd38 testing::UnitTest::Run()
@ 0x488490 RUN_ALL_TESTS()
@ 0x48493c main
@ 0x3ab261ed5d (unknown)
@ 0x4814e9 (unknown)
[1] 26785 segmentation fault (core dumped) ./build/bin/ConnectionManagerTest
Thanks for your help. Let me if you need more information.
[ 54%] Built target wangle
[ 55%] Linking CXX executable bin/AcceptorTest
/usr/bin/ld: ../gmock/src/gmock-build/libgmock.a(gtest-all.cc.o): undefined reference to symbol 'pthread_key_delete@@GLIBC_2.2.5'
/usr/lib64/libpthread.so.0: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
CMakeFiles/AcceptorTest.dir/build.make:102: recipe for target 'bin/AcceptorTest' failed
make[2]: *** [bin/AcceptorTest] Error 1
CMakeFiles/Makefile2:68: recipe for target 'CMakeFiles/AcceptorTest.dir/all' failed
make[1]: *** [CMakeFiles/AcceptorTest.dir/all] Error 2
Makefile:138: recipe for target 'all' failed
make: *** [all] Error 2
My g++ version is
% g++ --version
g++ (GCC) 6.1.1 20160510 (Red Hat 6.1.1-2)
Copyright (C) 2016 Free Software Foundation, Inc.
I don't know if it's a bug of g++
or it's a problem caused by the structure of Acceptor.cpp
.
Hello,
I have tried different versions of gflags (also changing default namespace from gflags to google). However, I still receive the following error.
Platform: Fedora 20
wangle-0.13.0/wangle/service/ServiceTest.cpp:327:3: error: ‘ParseCommandLineFlags’ is not a member of ‘google’
Downloaded and built FB Folly
Now trying to build FB Wangle.
Make fails because I build all libraries into custom folders and there seems to be no way to tell make to look in certain folders for double-conversions, glog and libevent includes.
If there is such a way, I would like to hear about it. Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.