Giter Site home page Giter Site logo

qihoo360 / evpp Goto Github PK

View Code? Open in Web Editor NEW
3.5K 231.0 934.0 30.8 MB

A modern C++ network library for developing high performance network services in TCP/UDP/HTTP protocols.

License: BSD 3-Clause "New" or "Revised" License

CMake 3.56% C++ 88.28% C 4.70% Shell 2.57% Go 0.62% Makefile 0.03% Thrift 0.06% Python 0.18%
network-library libevent high-performance nonblocking tcp-server http-server udp-server async-functions evpp evnsq

evpp's People

Contributors

dx9 avatar feihongmeilian avatar ivanabc avatar jinguoli avatar kant avatar kenforever1 avatar liwei-ch avatar lougxing avatar moogates avatar ohsayan avatar qihoo360github avatar redfox1999 avatar shgxwxl avatar sotex avatar spinorx avatar strega-nil avatar xiaobfly avatar yuangu avatar zhangke-s avatar zieckey avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evpp's Issues

Unit test failed testTCPClientDisconnectImmediately

[==========] Running 1 test from 1 test case.
[----------] Global test environment set-up.
[----------] 1 test from GtestObjectClass_testTCPClientDisconnectImmediately
[ RUN ] GtestObjectClass_testTCPClientDisconnectImmediately.testTCPClientDisconnectImmediately
I0317 23:12:49.081928 26211 connector.cc:20] Connector::Connector this=0x17d0cf0 raddr=cmake.org:80
I0317 23:12:49.082002 26211 sockets.cc:103] ParseFromIPPort inet_pton(AF_INET 'cmake.org', ...) rc=0. cmake.org is not a valid IP address. Maybe it is a hostname.
I0317 23:12:49.082123 26211 connector.cc:46] Try to connect cmake.org:80 status=kDisconnected
I0317 23:12:49.082337 26211 connector.cc:58] The remote address cmake.org:80 is a host, try to resolve its IP address.
I0317 23:12:49.082495 26211 dns_resolver.cc:19] DNSResolver::Start tid=140274208405312 this=0x17d0fc8
I0317 23:12:49.083032 26211 dns_resolver.cc:70] DNSResolver::AsyncWait tid=140274208405312 this=0x17d0fc8
I0317 23:12:49.083163 26211 connector.cc:70] Cancel to connect cmake.org:80 status=kDNSResolving
I0317 23:12:49.083231 26211 dns_resolver.cc:89] DNSResolver::OnCanceled tid=140274208405312 this=0x17d0fc8
I0317 23:12:49.083343 26211 dns_resolver.cc:12] DNSResolver::~DNSResolver tid=140274208405312 this=0x17d0fc8
I0317 23:12:49.083474 26211 tcp_client.cc:73] Failed to connect to cmake.org:80. errno=9 Bad file descriptor
I0317 23:12:49.083529 26211 tcp_conn.cc:32] TCPConn::[] this=0x17d16d0 channel=0 fd=-1
I0317 23:12:49.083592 26211 invoke_timer.cc:10] InvokeTimer::InvokeTimer tid=140274208405312 this=0x17d0df0
I0317 23:12:49.083636 26211 invoke_timer.cc:24] InvokeTimer::Start tid=140274208405312 this=0x17d0df0 refcount=2
I0317 23:12:49.083734 26211 tcp_conn.cc:36] TCPConn::~TCPConn() name= this=0x17d16d0 channel=0 fd=-1 type=0 status=kDisconnected
W0317 23:12:49.083869 26211 dns_resolver.cc:129] dns resolve cancel, may be timeout
I0317 23:12:49.083904 26211 dns_resolver.cc:132] delete dns base

Unit test `testTCPServer1` failed sometimes

If the tcp_client_thread does not start, and we do TCPClient::Connect, that will cause race-condition problem:

/home/weizili/git/evpp/evpp/inner_pre.cc:80: int evpp::EventDel(event*): Assertion `it->second == id' failed.

Segmentation fault in DNS resolver SetCancelCallback

SIGSEGV (Segmentation fault) when calling connect using localhost in a TCPClient

I0331 15:47:23.219928 12023 tcp_client.cc:44] TCPClient::Connect remote_addr=localhost:9099
I0331 15:47:23.219969 12023 connector.cc:20] Connector::Connector this=0x555555785120 raddr=localhost:9099
I0331 15:47:23.219995 12023 sockets.cc:103] ParseFromIPPort inet_pton(AF_INET 'localhost', ...) rc=0. localhost is not a valid IP address. Maybe it is a hostname.
I0331 15:47:23.220072 12023 connector.cc:47] Try to connect localhost:9099 status=kDisconnected
I0331 15:47:23.220132 12023 inner_pre.cc:63] event_add ev=0x555555783ba0 fd=-1 user_ptr=0x555555786020 tid=140737353916160
I0331 15:47:23.220154 12023 connector.cc:59] The remote address localhost:9099 is a host, try to resolve its IP address.
I0331 15:47:23.220237 12023 dns_resolver.cc:22] DNSResolver::Start tid=140737353916160 this=0x555555784550
I0331 15:47:23.220242 12023 dns_resolver.cc:116] call shared_from_this
I0331 15:47:23.220360 12023 dns_resolver.cc:194] this->use_count=3
I0331 15:47:23.220412 12023 dns_resolver.cc:179] localhost resolved a ip=127.0.0.1

Stack trace

#0  0x000055555555d61d in std::swap<std::_Any_data> (__a=..., __b=...) at /usr/include/c++/6/bits/move.h:191
#1  0x00007ffff7b534ab in std::function<void ()>::swap(std::function<void ()>&) (this=0x7fffffffd830, __x=...) at /usr/include/c++/6/functional:2025
#2  0x00007ffff7b5244d in std::function<void ()>::operator=(std::function<void ()> const&) (this=0x40, __x=...) at /usr/include/c++/6/functional:1940
#3  0x00007ffff7b674cd in evpp::EventWatcher::SetCancelCallback(std::function<void ()> const&) (this=0x0, cb=...) at evpp/libevent_watcher.cc:96
#4  0x00007ffff7b574be in evpp::DNSResolver::ClearTimer (this=0x555555784550) at evpp/dns_resolver.cc:200
#5  0x00007ffff7b571f5 in evpp::DNSResolver::OnResolved (this=0x555555784550, errcode=0, addr=0x555555782b60) at evpp/dns_resolver.cc:182
#6  0x00007ffff7b57422 in evpp::DNSResolver::OnResolved (errcode=0, addr=0x555555782b60, arg=0x555555782910) at evpp/dns_resolver.cc:195
#7  0x00007ffff6ab8ce8 in evdns_getaddrinfo () from /usr/lib/x86_64-linux-gnu/libevent-2.0.so.5
#8  0x00007ffff7b56d3a in evpp::DNSResolver::AsyncDNSResolve (this=0x555555784550) at evpp/dns_resolver.cc:120
#9  0x00007ffff7b5635a in evpp::DNSResolver::<lambda()>::operator()(void) const (__closure=0x7fffffffdbe0) at evpp/dns_resolver.cc:26
#10 0x00007ffff7b57668 in std::_Function_handler<void(), evpp::DNSResolver::Start()::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/6/functional:1740
#11 0x00007ffff7b5afce in std::function<void ()>::operator()() const (this=0x7fffffffdbe0) at /usr/include/c++/6/functional:2136
#12 0x00007ffff7b5a360 in evpp::EventLoop::RunInLoop(std::function<void ()>&&) (this=0x7fffffffdef0, functor=<unknown type in /usr/local/lib/libevpp.so.0.3, CU 0x3c472, DIE 0x49ae8>) at evpp/event_loop.cc:207
#13 0x00007ffff7b563e2 in evpp::DNSResolver::Start (this=0x555555784550) at evpp/dns_resolver.cc:31
#14 0x00007ffff7b5034d in evpp::Connector::Start (this=0x555555785120) at evpp/connector.cc:66
#15 0x00007ffff7b6c396 in evpp::TCPClient::<lambda()>::operator()(void) const (__closure=0x7fffffffde00) at evpp/tcp_client.cc:49
#16 0x00007ffff7b6d4bc in std::_Function_handler<void(), evpp::TCPClient::Connect()::<lambda()> >::_M_invoke(const std::_Any_data &) (__functor=...) at /usr/include/c++/6/functional:1740
#17 0x00007ffff7b5afce in std::function<void ()>::operator()() const (this=0x7fffffffde00) at /usr/include/c++/6/functional:2136
#18 0x00007ffff7b5a360 in evpp::EventLoop::RunInLoop(std::function<void ()>&&) (this=0x7fffffffdef0, functor=<unknown type in /usr/local/lib/libevpp.so.0.3, CU 0x3c472, DIE 0x49ae8>) at evpp/event_loop.cc:207
#19 0x00007ffff7b6c48e in evpp::TCPClient::Connect (this=0x7fffffffdfe0) at evpp/tcp_client.cc:51
#20 0x000055555555bef1 in main (argc=1, argv=0x7fffffffe1d8) at /home/jvalencia/workspace/cnettests/client.cpp:61

vcpkg的问题?

使用vcpkg安装后,命名空间 evpp::httpc 不能使用,头文件没有 httpc下得

Connector::Cancel crash

When TCPClient is connecting to a host and it is doing a DNS resolving, the user calls TCPClient::Disconnect, that will cause a crush at Connector::Cancel::chan_->DisableAllEvent()

void Connector::Cancel() {
    LOG_INFO << "Cancel to connect " << remote_addr_ << " status=" << StatusToString();
    assert(loop_->IsInLoopThread());
    if (dns_resolver_) {
        dns_resolver_->Cancel();
    }

    assert(timer_);
    timer_->Cancel();
    chan_->DisableAllEvent();
    chan_->Close();
}

cmake编译evnsq时提示说找不到utils

fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
请问这个是什么依赖?

上面那个问题我已经解决了。 但是编译安装完evpp后再安装evnsq时cmake时报错。
evpp文件夹下的CMakeLists中有相同的include语句, 但是可以成功编译。。。不明白为什么。
CMake Error at CMakeLists.txt:12 (include):
include could not find load file:

utils

CMake Error at CMakeLists.txt:13 (include):
include could not find load file:

packages

How to properly stop a TCPServer?

I am implementing a service that uses a TCPServer running in other thread, it needs to do some processing after the server has stoped, but when Stop() is called the program hangs.

Crash at http_server.cc:264 when we stop the http server

evpp::http::Server::__lambda3::operator() (__closure=0x7fdfb8001290) at /home/weizili/git/evpp/evpp/http/http_server.cc:264

When we are stopping the http server:

  1. Accept a new http request
  2. Dispatch the request to a IO event loop
  3. Stopping http server
  4. Listening http service and thread has stopped. This will delete the evhttp_ and free all the http connections.
  5. IO event loop begin to process the request at step 2, that will crash because the http request pointer is a wild pointer

Error on TCP server message buffer

When calling buffer->size() function from an OnMessageCallback in a tcp server it gives this error:

evpp/buffer.h:342: size_t evpp::Buffer::length() const: Assertion `write_index_ >= read_index_' failed. 
Aborted (core dumped) 

怎么获取每次事件发生的时间戳

我知道 evp::Timesamp:now() 可以获取当前时间,但是这个方法每次是一个系统调用,太费了,我想本身eventloop 的每次loop已经计算过一次时间了,io事件发生时应该把这个时间传给上层,我看到tcp_server.h有一个注释是这么写的
// server.SetMessageCallback([](const evpp::TCPConnPtr& conn,
// evpp::Buffer* msg,
// evpp::Timestamp ts)
但是实际上第三个参数evpp::Timestamp ts已经没用了,是改过版本的问题吗,还有定时器
evpp::InvokeTimerPtr EventLoop::RunEvery(Duration interval, const Functor& f)
也没有把当前时间传出来,我要得到当前时间,又要找系统要一遍,既然eventloop已经得到当前时间了,应用层就不该再算一次。

event_loop_thread can't start after fork

We create EventLoopThread and initialize it in father process, but we use it in child process.
If we have only one child process , everything goes well.

But if we have multi child processes, something goes wrong.
Because EventLoop::watcher_ is created and initialized in father process, all children processes inherited father's pipe. When we use the pipe to do a notification in one child process, the notification may be received by another child process randomly.

if it's message had readed by other process
we marked watcher had been notified_ and never notify it again

    if (!notified_.load()) {
        DLOG_TRACE << "call watcher_->Nofity() notified_.store(true)";

        // We must set notified_ to true before calling `watcher_->Nodify()`
        // otherwise there is a change that:
        //  1. We called watcher_- > Nodify() on thread1
        //  2. On thread2 we watched this event, so wakeup the CPU changed to run this EventLoop on thread2 and executed all the pending task
        //  3. Then the CPU changed to run on thread1 and set notified_ to true
        //  4. Then, some thread except thread2 call this QueueInLoop to push a task into the queue, and find notified_ is true, so there is no change to wakeup thread2 to execute this task
        notified_.store(true);

        // Sometimes one thread invoke EventLoop::QueueInLoop(...), but anther
        // thread is invoking EventLoop::Stop() to stop this loop. At this moment
        // this loop maybe is stopping and the watcher_ object maybe has been
        // released already.
        if (watcher_) {
            watcher_->Notify();
        } else {
            DLOG_TRACE << "status=" << StatusToString();
            assert(!IsRunning());
        }
    } else {
         DLOG_TRACE << "No need to call watcher_->Nofity()";
    }

Support for direct write on fd on TCP client/server

I am currently sending google's protobuf messages using evpp tcp server/client by serializing/deserializing to/from a buffer, I just found a protobuf stream(google::protobuf::io::FileOutputStream) that writes directly to an fd and would eliminate this buffer. Any way to ingrate this custom code on TCP client/server implementations?

Build error in Linux Mint 18.1

Hi

I want to use your library in my project but I cannot build it in my OS. My OS is Linux mint 18.1 and and I use you release build script in tools folder. I am getting the following errors;

In file included from /home/reza/Downloads/evpp-0.6.1/evpp/dns_resolver.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn_pool.h:9:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn_pool.cc:1:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:590: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/conn_pool.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/conn_pool.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:446: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/dns_resolver.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/dns_resolver.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn.cc:1:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:662: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/conn.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/conn.cc.o] Error 1
[ 42%] Linking C executable ../../../bin/benchmark_tcp_libevent_client
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/invoke_timer.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:278: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/invoke_timer.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/invoke_timer.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn_pool.h:9:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn_pool.cc:1:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_server.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_server.cc:3:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:398: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/tcp_server.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/tcp_server.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:590: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/conn_pool.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/conn_pool.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/fd_channel.cc:7:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:86: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/fd_channel.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/fd_channel.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:6:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:494: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/http/http_server.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/http/http_server.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_loop.cc:5:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:134: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_loop.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_loop.cc.o] Error 1
[ 42%] Built target benchmark_ioevent_libevent
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/udp/udp_server.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn_pool.h:9:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/request.cc:3:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:686: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/request.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/request.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:566: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/udp/udp_server.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/udp/udp_server.cc.o] Error 1
[ 42%] Linking C executable ../../../bin/benchmark_http_libevent
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn_pool.h:9:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/request.cc:3:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:686: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/request.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/request.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_loop.cc:5:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:134: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/event_loop.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/event_loop.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/response.cc:3:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/http/service.cc:5:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:470: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/http/service.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/http/service.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:614: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/response.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/httpc/response.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/listener.cc:4:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_loop_thread_pool.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:302: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/event_loop_thread_pool.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/event_loop_thread_pool.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_watcher.cc:7:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:182: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/event_watcher.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/event_watcher.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_client.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_client.cc:5:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/dns_resolver.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_server.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_server.cc:3:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_loop_thread_pool.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:350: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/listener.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/listener.cc.o] Error 1
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:302: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_loop_thread_pool.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_loop_thread_pool.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:398: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/tcp_server.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/tcp_server.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:446: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/dns_resolver.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/dns_resolver.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_watcher.cc:7:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:182: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_watcher.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_watcher.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:62: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/tcp_client.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/tcp_client.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/connector.cc:4:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/invoke_timer.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
compilation terminated.
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/fd_channel.cc:7:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:278: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/invoke_timer.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/invoke_timer.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:86: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/fd_channel.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/fd_channel.cc.o] Error 1
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:374: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/connector.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/connector.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/http/service.cc:5:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:470: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/http/service.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/http/service.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_client.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_client.cc:5:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/connector.cc:4:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_loop_thread.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
compilation terminated.
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/listener.cc:4:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:206: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/event_loop_thread.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/event_loop_thread.cc.o] Error 1
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:374: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/connector.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/connector.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:62: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/tcp_client.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/tcp_client.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_conn.cc:7:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:326: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/tcp_conn.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/tcp_conn.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/event_loop_thread.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn.cc:1:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:662: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/conn.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/conn.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:206: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_loop_thread.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/event_loop_thread.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/conn.h:4:0,
                 from /home/reza/Downloads/evpp-0.6.1/evpp/httpc/response.cc:3:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:350: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/listener.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/listener.cc.o] Error 1
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:614: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/response.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/httpc/response.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:6:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue_static.dir/build.make:494: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/http/http_server.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/http/http_server.cc.o] Error 1
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/udp/udp_server.cc:3:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
In file included from /home/reza/Downloads/evpp-0.6.1/evpp/tcp_conn.cc:7:0:
/home/reza/Downloads/evpp-0.6.1/evpp/event_loop.h:22:45: fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
compilation terminated.
compilation terminated.
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:326: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/tcp_conn.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/tcp_conn.cc.o] Error 1
evpp/CMakeFiles/evpp_concurrentqueue.dir/build.make:566: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/udp/udp_server.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/udp/udp_server.cc.o] Error 1
[ 42%] Built target benchmark_tcp_libevent_client
[ 42%] Built target benchmark_http_libevent
[ 42%] Linking CXX executable ../../bin/benchmark_gettimeofday
[ 42%] Linking CXX executable ../../../../bin/example_recipes_self_control_timer_basic_02
[ 42%] Built target benchmark_gettimeofday
[ 42%] Linking CXX executable ../../../../bin/example_recipes_self_control_timer_basic_01
[ 42%] Built target example_recipes_self_control_timer_basic_02
[ 42%] Built target example_recipes_self_control_timer_basic_01
[ 43%] Linking CXX executable ../../../../bin/example_recipes_self_control_timer_periodic_04
[ 43%] Linking CXX executable ../../../../bin/example_recipes_self_control_timer_cancel_03
c++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-5/README.Bugs> for instructions.
evpp/CMakeFiles/evpp_boost.dir/build.make:278: recipe for target 'evpp/CMakeFiles/evpp_boost.dir/invoke_timer.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_boost.dir/invoke_timer.cc.o] Error 4
make[2]: *** Waiting for unfinished jobs....
virtual memory exhausted: Cannot allocate memory
virtual memory exhausted: Cannot allocate memory
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Stop()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:174:44: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto fn = [&count, &promise, this, hs = lt.hservice]() {
                                            ^
evpp/CMakeFiles/evpp_boost.dir/build.make:470: recipe for target 'evpp/CMakeFiles/evpp_boost.dir/http/service.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_boost.dir/http/service.cc.o] Error 1
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Pause()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:214:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Continue()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:225:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
evpp/CMakeFiles/evpp_static.dir/build.make:614: recipe for target 'evpp/CMakeFiles/evpp_static.dir/httpc/response.cc.o' failed
make[2]: *** [evpp/CMakeFiles/evpp_static.dir/httpc/response.cc.o] Error 1
make[2]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:282: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue.dir/all' failed
make[1]: *** [evpp/CMakeFiles/evpp_concurrentqueue.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
CMakeFiles/Makefile2:319: recipe for target 'evpp/CMakeFiles/evpp_concurrentqueue_static.dir/all' failed
make[1]: *** [evpp/CMakeFiles/evpp_concurrentqueue_static.dir/all] Error 2
[ 43%] Built target example_recipes_self_control_timer_periodic_04
[ 43%] Built target example_recipes_self_control_timer_cancel_03
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Stop()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:174:44: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto fn = [&count, &promise, this, hs = lt.hservice]() {
                                            ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Pause()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:214:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Continue()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:225:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Stop()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:174:44: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto fn = [&count, &promise, this, hs = lt.hservice]() {
                                            ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Pause()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:214:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Continue()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:225:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Stop()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:174:44: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto fn = [&count, &promise, this, hs = lt.hservice]() {
                                            ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Pause()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:214:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc: In member function ‘void evpp::http::Server::Continue()’:
/home/reza/Downloads/evpp-0.6.1/evpp/http/http_server.cc:225:19: warning: lambda capture initializers only available with -std=c++14 or -std=gnu++14
         auto f = [hs = lt.hservice]() {
                   ^
[ 43%] Linking CXX static library ../lib/libevpp_lite_static.a
[ 43%] Built target evpp_lite_static
CMakeFiles/Makefile2:245: recipe for target 'evpp/CMakeFiles/evpp_boost.dir/all' failed
make[1]: *** [evpp/CMakeFiles/evpp_boost.dir/all] Error 2
[ 44%] Linking CXX static library ../lib/libevpp_boost_static.a
CMakeFiles/Makefile2:134: recipe for target 'evpp/CMakeFiles/evpp_static.dir/all' failed
make[1]: *** [evpp/CMakeFiles/evpp_static.dir/all] Error 2
[ 44%] Built target evpp_boost_static
[ 44%] Linking CXX shared library ../lib/libevpp.so
[ 44%] Built target evpp
[ 44%] Linking CXX executable ../../../bin/benchmark_tcp_asio_server
[ 44%] Built target benchmark_tcp_asio_server
[ 44%] Linking CXX executable ../../../bin/benchmark_tcp_asio_client
[ 44%] Built target benchmark_tcp_asio_client
Makefile:160: recipe for target 'all' failed
make: *** [all] Error 2

I installed all third-part libraries like boost, glog and googletest. Am I missing something?

moodycamel::ConcurrentQueue is not that stable

test_evpp_stability_concurrentqueue: /home/weizili/git/evpp/test/stability/stability.cc:129: {anonymous}::testStop(evpp::EventLoop*, int*)::__lambda4: Assertion `!result.empty()' failed.

Wrong usage of `struct evhttp_request` in trace log

We cannot use struct evhttp_request* req any more after we called evhttp_send_reply.

struct Response {
    Response(struct evhttp_request* r, const std::string& m)
        : req(r), buffer(nullptr) {
        if (m.size() > 0) {
            buffer = evbuffer_new();
            evbuffer_add(buffer, m.c_str(), m.size());
        }
    }

    ~Response() {
        if (buffer) {
            evbuffer_free(buffer);
            buffer = nullptr;
        }

        // At this time, req is freed by evhttp framework probably.
        // So don't use req any more.
        // LOG_TRACE << "free request " << req->uri;
    }

    struct evhttp_request*  req;
    struct evbuffer* buffer;
};

EventLoop::QueueInLoop bug

When only one event in the EventLoop, we are now in the EventLoop thread and put a functor into queue to expect to be executed, but this functor will never be called.

evnsq is not ready forever when it connects nsqd in some case,even nsqd is ok

tag:0.3.0
场景:重启nsqd;切换nsq对象,出现evnsq一直不ready的现象;

E0413 15:35:31.297906 121534 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.297941 121541 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298004 121573 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.297988 121572 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.297940 121539 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298244 121519 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298007 121574 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298313 121542 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298290 121543 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298413 121576 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.297991 121540 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298322 121544 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298416 121545 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298013 121575 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298435 121578 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298676 121549 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298750 121580 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298422 121548 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298835 121520 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298735 121547 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.299043 121518 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298773 121552 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298760 121579 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298758 121551 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298310 121577 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298785 121581 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298804 121515 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298480 121582 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298856 121553 batch_producer.cc:248] nsq is not ready
E0413 15:35:31.298643 121546 batch_producer.cc:248] nsq is not ready

Fix a race condition bug of http::Service

void Service::Stop() {
    LOG_TRACE << "this=" << this << " http service is stopping";
    assert(listen_loop_->IsInLoopThread());

    if (evhttp_) {
        evhttp_free(evhttp_);
        evhttp_ = nullptr;
        evhttp_bound_socket_ = nullptr;
    }

    listen_loop_ = nullptr;
    callbacks_.clear();
    default_callback_ = HTTPRequestCallback();
    LOG_TRACE << "this=" << this << " http service stopped";
}

void Service::SendReply(struct evhttp_request* req, const std::string& response_data) {
    ...

    if (listen_loop_->IsRunning()) {
        LOG_INFO << "this=" << this << " dispatch this SendReply to listening thread";
        listen_loop_->RunInLoop(f);
    } else {
        LOG_WARN << "this=" << this << " listening thread is going to stop. we discards this request.";
        // TODO do we need do some resource recycling about the evhttp_request?
    }
}

The above code, Service::SendReply in work thread will use listen_loop_ at the time that this object listen_loop_ is be set to nullptr in Service::Stop()

stability.cc::TestHTTPServer crash

Suppose this scenario :
We are running stability.cc::TestHTTPServer with 0 working thread. When we stop the http server:
1. http::Server::Stop() wait at "exit_promise_.get_future().wait();"
2. When the listening thread exits, it will execute tpool_->Stop(fn)
3. tpool->Stop(fn) finishes very soon, and fn will be invoked : "exit_promise_.set_value();"
4. The 1st step will wakeup and continue to execute next logic codes and http::Server::Stop() exits
5. The whole http Server object is distructing including the listening thread.
But at this right moment, listening thread is at step 2 executing its logic.
That will crash.

WIN10系统的Linux subststem, make test全部失败

WIN10系统的Linux subststem,是一个很完善的ubuntu,
严格按照quick start的指导走,到make test这一步:

~/evpp/build$ make test
Running tests...
Test project /home/tap/evpp/build
Start 1: evpp_unittest
1/3 Test #1: evpp_unittest ....................***Exception: SegFault 64.22 sec
Start 2: evpp_unittest_concurrentqueue
2/3 Test #2: evpp_unittest_concurrentqueue ....***Exception: SegFault 64.40 sec
Start 3: evpp_unittest_boost_lockfree
3/3 Test #3: evpp_unittest_boost_lockfree .....***Exception: SegFault 44.40 sec

0% tests passed, 3 tests failed out of 3

Total Test time (real) = 173.15 sec

The following tests FAILED:
1 - evpp_unittest (SEGFAULT)
2 - evpp_unittest_concurrentqueue (SEGFAULT)
3 - evpp_unittest_boost_lockfree (SEGFAULT)
Errors while running CTest
make: *** [test] Error 8

建议在win10的linux测试下,我已在2台机器重现。

evnsq Client::IsReady() implement wrong

We must iterate every NSQConn in conns_ to check whether it is OK.

bool Client::IsReady() const {
    if (conns_.empty()) {
        return false;
    }

    return conns_[0]->IsReady();
}

And in Client::OnConnection, when the NSQConn is at 'kConnected' status, should't we move it to conns_??

TCPServer::Stop race condition bug

 77 void TCPServer::StopInLoop() {
 78     LOG_TRACE << "Entering TCPServer::StopInLoop";
 79     listener_->Stop();
 80     listener_.reset();
 81 
 82     for (auto& c : connections_) {
 83         c.second->Close();
 84     }
 85 
 86     tpool_->Stop(true);
 87     assert(tpool_->IsStopped());
 88     LOG_TRACE << "TCPServer::StopInLoop exited";
 89 }

上述83、86两行,都会调用到工作线程的EventLoop::QueueInLoop函数,也就是至少会调用两次。设想以下场景:

  1. time 1:当前线程中,83行调用完毕,工作线程正好唤醒,执行到EventLoop::DoPendingFunctors函数中,
  2. time 2:当前线程执行到86行,EventLoop::QueueInLoop函数中,刚把一个函数对象放到队列中,但还没有来得及调用watcher_.Notify()
  3. time 3:工作线程这个时候,刚好将上述两个函数对象执行完毕。然后第二函数对象是EventLoop::StopInLoop,刚刚好也执行完毕,会将EventLoop::watcher_对象析构
  4. time 4:当前线程接着执行watcher_.Notify()。由于上面第三个时间点EventLoop::watcher_对象已经析构,最终导致程序崩溃。

这个场景可以用“testTCPServer1”来重现,可能需要运行很多次才能重现。

HTTPServer有类似问题,需要一起修复。

http::Server::Stop race condition bug

When the listening thread is stopping, we call Service::SendReply() will have a change to crash.

We need to change the status of EventLoop to kStopping when it is going to stop. Right now EventLoop only have a bool flag running_ which cannot hold the status.

你们编译会不会报错。

问题:
我使用VS2015和VS2017编译X64总是报错错误。基本上都是

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2664 “int evutil_socketpair(int,int,int,intptr_t [])”: 无法将参数 4 从“int [2]”转换为“intptr_t []” evpp_static C:\code\evpp\evpp\libevent_watcher.cc 120

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2664 “void event_set(event *,intptr_t,short,void (__cdecl *)(intptr_t,short,void *),void *)”: 无法将参数 4 从“overloaded-function”转换为“void (__cdecl *)(intptr_t,short,void *)” evpp_static C:\code\evpp\evpp\fd_channel.cc 54

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C2664 “void event_set(event *,intptr_t,short,void (__cdecl *)(intptr_t,short,void *),void *)”: 无法将参数 4 从“void (__cdecl *)(int,short,void *)”转换为“void (__cdecl *)(intptr_t,short,void *)” evpp_static C:\code\evpp\evpp\libevent_watcher.cc 228

产生的原因
然后我们看一下定义vcruntime.h(VS系统提供的)中的intptr_t定义。
// Definitions of common types
#ifdef _WIN64
typedef unsigned __int64 size_t;
typedef __int64 ptrdiff_t;
typedef __int64 intptr_t;
#else
typedef unsigned int size_t;
typedef int ptrdiff_t;
typedef int intptr_t;
#endif

event2 中的util.h定义

#ifdef _WIN32
#define evutil_socket_t intptr_t
#else
#define evutil_socket_t int
#endif

file descriptor leak

EventLoop::watcher_ is a type of PipeEventWatcher, it will create two file descriptors on initialization. We think these two file descriptors whill be closed when PipeEventWatcher destructing :

EventWatcher::~EventWatcher() {
    FreeEvent();
    Close();
}

But when the object is destructing we have no change to call PipeEventWatcher::DoClose() because the drived class PipeEventWatcher must be desctructed before EventWatcher.

A thread.join exception coredump

        auto http_close_fn = [=]() {
            lt.hserver->Stop();
            OnListenThreadExited(exited_listen_thread_count->fetch_add(1) + 1);
        };

This lamba function use = to capture which will cause the shared_ptrstd::thread copied and then we cannot determine when to destruct the thread.

A simple example on doing async http request inside the http handler

Hi! Can you give us an example on executing another http requests to remote host within the http handler?

e.g.

server.RegisterHandler("/echo",
                           [](evpp::EventLoop* loop,
                              const evpp::http::ContextPtr& ctx,
                              const evpp::http::HTTPSendResponseCallback& cb) {
         // In here we do, e.g. http request to someapi.com to get a json response

        cb(ctx->body().ToString()); }
    );

Thanks!

Remove Timestamp parameter from MessageCallback

typedef std::function<void(const TCPConnPtr&, Buffer*, Timestamp)> MessageCallback;

The MessageCallback has three parameters, the third one is a timestamp which is the data receiving time.
In most case, this parameter is not necessary.

So I suggest to remove it.

Any one has ideals?

DNSResolver::OnTimeout do not clear the timer

When a DNS resolving timeout, DNSResolver::OnTimeout will be called, but we don't clear the DNSResolver::timer_. That will leave DNSResolver::timer_ in memory and leave an struct event in event_base.

https support?

I see all the http client examples ,but not find any https request,does it support https?

TCPClient crashed when DNS resolving timeout

Steps:

  1. Set the DNS server to a far way server of the local mathine, we set it to 8.8.8.8 in China
  2. Set the TCPClient connection timeout to a very small duration, like 1ms

Result:

  1. Connector will timeout at first and call Connector::HandleError
  2. And then, DNSResolver will timeout later and call Connector::OnDNSResolved with an empty addrs. That will crash.

Test Code:

TEST_UNIT(testTCPClientConnectionTimeout) {
    std::shared_ptr<evpp::EventLoop> loop(new evpp::EventLoop);
    std::shared_ptr<evpp::TCPClient> client(new evpp::TCPClient(loop.get(), "cmake.org:80", "TCPPingPongClient"));
    client->SetConnectionCallback([loop, client](const evpp::TCPConnPtr& conn) {
        loop->Stop();
    });
    client->set_auto_reconnect(false);
    client->set_connecting_timeout(evpp::Duration(0.0001));
    client->Connect();
    loop->Run();
    client.reset();
    loop.reset();
    H_TEST_ASSERT(evpp::GetActiveEventCount() == 0);
}

make test 报错

[root@localhost build]# make test
Running tests...
Test project /root/evpp/build
Start 1: evpp_unittest
1/3 Test #1: evpp_unittest .................... Passed 53.71 sec
Start 2: evpp_unittest_concurrentqueue
2/3 Test #2: evpp_unittest_concurrentqueue .... Passed 52.55 sec
Start 3: evpp_unittest_boost_lockfree
3/3 Test #3: evpp_unittest_boost_lockfree .....***Exception: Other 50.74 sec

67% tests passed, 1 tests failed out of 3

Total Test time (real) = 157.08 sec

The following tests FAILED:
3 - evpp_unittest_boost_lockfree (OTHER_FAULT)
Errors while running CTest

Tcp Client Server Crash

Hi
I have run my first test with your library. Its performance seems very good. But I have a problem with the size of packets. When I set the size of packet to 10000 or higher, I get a crash in Buffer class (std::bad_alloc). I have attached my code below. Should I set size of sending buffer manually?
ClientServer.tar.gz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.