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

Overview

evpp

Github release Build status Platform License Project Status: Active – The project has reached a stable, usable state and is being actively developed.

Introduction 中文说明

evpp is a modern C++ network library for developing high performance network services using TCP/UDP/HTTP protocols. evpp provides a TCP Server to support multi-threaded nonblocking event-driven server and also a HTTP, UDP Server to support HTTP and UDP protocols.

Features

  1. Modern C++11 interface
  2. Modern functional/bind style callback instead of C-style function pointer.
  3. Multi-core friendly and thread-safe
  4. A nonblocking multi-threaded TCP server
  5. A nonblocking TCP client
  6. A nonblocking multi-threaded HTTP server based on the buildin http server of libevent
  7. A nonblocking HTTP client
  8. A nonblocking multi-threaded UDP server
  9. Async DNS resolving
  10. EventLoop/ThreadPool/Timer
  11. Well tested — evpp is well tested with unit tests and stress tested daily in production. It has been used in production and processes 1000+ billions networking communications every day in our production
  12. Easy install — evpp can be packaged as a deb, rpm, tar.gz with a single command for straight forward distribution and integration

And also provides some libraries based on evpp:

  1. evmc a nonblocking async C++ memcached (or membase cluster) client library. This library is currently used in production which sends more than 300 billions requests every day. See evmc readme for more details.
  2. evnsq a nonblocking async C++ NSQ client library. This library is currently used in production which processes more than 130 billions messages every day. See evnsq readme for more details.

NOTE: master is our development branch and may not be stable at all times.

Origin

In our business system, we need to build a TCP long-connection Gateway and other TCP services. When we do a survey of the open sources, we cannot find any appropriate network library for our demands. According to our own business characteristic, an ideal C++ network library must have the features below:

  1. A simple enough C++ interface
  2. Support multi-threads and multi-processes
  3. Based on libevent is preferable for our projects. Given your older applications were based on libevent, it was preferable to have your new framework also be based on it, so as to reduce the overall time/effort/cost to completion. Actually, we do have some older applications which were based on libevent.

As described above, there are not many options to choose from. So we developed one ourself. The design of the interface is highly inspired by muduo and Golang. Let's take some examples to explain this:

  1. Duration : This is a time interval class, with a time unit. It is referenced to the implementation of Duration of the Golang project. We have seen some many cases that the time interval without a unit. For example, what does timeout mean? Seconds, milliseconds or microseconds? We need to read the document carefully, even more, we need to read the implementation codes. Our Duration class has self-explations with the time unit. Additionally std::chrono::duration in the STL of C++11 has the similar implementations, but it is a little bit complicated.
  2. Buffer : This is a memory buffer class. It uses the advantages of the two projects muduo and Golang.
  3. http::Server : This is a HTTP server class with a working threads pool. It is thread-safe to dispatch tasks
  4. We simply use a string with the format of "ip:port" to represent a network address. This is referenced to the design of Golang.
  5. httpc::ConnPool : This is HTTP client connection pool with highly performance. In the future we can add more features to this class : load balance and failover.

In addition, in the implementations we pay seriously attations to thread-safe problems. An event-related resource must be initialized and released in its own EventLoop thread, so that we can minimize the possibility of thread-safe error. In order to achieve this goal we reimplemented event_add and event_del and other functions. Each call to event_add, we stored the resource into thread local storage, and in the call event_del, we checked it whether it is stored in the thread local storage. And then we checked all the threads local storages to see whether there are resources not destructively released when the process was exiting. The detail codes are here https://github.com/Qihoo360/evpp/blob/master/evpp/inner_pre.cc#L36~L87. We are so harshly pursuit the thread safety to make a program can quietly exit or reload, because we have a deep understanding of "developing a system to run forever and developing a system to quietly exit after running a period of time are totally two different things".

Getting Started

Please see Quick Start

Benchmark

Benchmark Reports

The IO Event performance benchmark against Boost.Asio : evpp is higher than asio about 20%~50% in this case

The ping-pong benchmark against Boost.Asio : evpp is higher than asio about 5%~20% in this case

The throughput benchmark against libevent2 : evpp is higher than libevent about 17%~130% in this case

The throughput benchmark against Boost.Asio : evpp and asio have the similar performance in this case

The throughput benchmark against Boost.Asio(中文) : evpp and asio have the similar performance in this case

The throughput benchmark against muduo(中文) : evpp and muduo have the similar performance in this case

Throughput

The throughput benchmark of evpp is 17%~130% higher than libevent2 and similar with boost.asio and muduo. Although evpp is based on libevent, evpp has a better throughput benchmark than libevent. That's because evpp implements its own IO buffer instead of libevent's evbuffer.

Examples

An echo TCP server

#include <evpp/tcp_server.h>
#include <evpp/buffer.h>
#include <evpp/tcp_conn.h>

int main(int argc, char* argv[]) {
    std::string addr = "0.0.0.0:9099";
    int thread_num = 4;
    evpp::EventLoop loop;
    evpp::TCPServer server(&loop, addr, "TCPEchoServer", thread_num);
    server.SetMessageCallback([](const evpp::TCPConnPtr& conn,
                                 evpp::Buffer* msg,
                                 evpp::Timestamp ts) {
        conn->Send(msg);
    });
    server.SetConnectionCallback([](const evpp::TCPConnPtr& conn) {
        if (conn->IsConnected()) {
            LOG_INFO << "A new connection from " << conn->remote_addr();
        } else {
            LOG_INFO << "Lost the connection from " << conn->remote_addr();
        }
    });
    server.Init();
    server.Start();
    loop.Run();
    return 0;
}

An echo HTTP server

#include <evpp/http/http_server.h>

int main(int argc, char* argv[]) {
    std::vector<int> ports = { 9009, 23456, 23457 };
    int thread_num = 2;
    evpp::http::Server server(thread_num);
    server.RegisterHandler("/echo",
                           [](evpp::EventLoop* loop,
                              const evpp::http::ContextPtr& ctx,
                              const evpp::http::HTTPSendResponseCallback& cb) {
        cb(ctx->body().ToString()); }
    );
    server.Init(ports);
    server.Start();
    while (!server.IsStopped()) {
        usleep(1);
    }
    return 0;
}

An echo UDP server

#include <evpp/udp/udp_server.h>
#include <evpp/udp/udp_message.h>

int main(int argc, char* argv[]) {
    std::vector<int> ports = { 1053, 5353 };
    evpp::udp::Server server;
    server.SetMessageHandler([](evpp::EventLoop* loop, evpp::udp::MessagePtr& msg) {
        evpp::udp::SendMessage(msg);
    });
    server.Init(ports);
    server.Start();

    while (!server.IsStopped()) {
        usleep(1);
    }
    return 0;
}

More examples

Please see the source code in examples.

TODO

  1. An async redis client
  2. Add zipkin tracing support
  3. Add examples : asio chat room
  4. Fix the comments written in mandarin problem
  5. Add benchmark against with boost.asio/cpp-netlib/beast http library/muduo/libevent/libuv ...

In Production

Qihoo

Welcome to join this list :-)

Thanks

Thanks for the support of Qihoo360.

Thanks for libevent, glog, gtest, Golang, LevelDB, rapidjson projects.

evpp is highly inspired by muduo. Thanks Chen Shuo

Issues
  • How do I exit loop.run()?

    How do I exit loop.run()?

    // @brief Join the thread. If you forget to call this method, // it will be invoked automatically in the destruct method ~EventLoopThread(). // @note DO NOT call this method from any of the working thread. void Join();

    EventLoopThread::~EventLoopThread() { DLOG_TRACE << "loop=" << event_loop_; assert(IsStopped()); Join(); } Causes the thread to fail

    opened by caistd 11
  • Error on TCP server message buffer

    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) 
    
    help wanted 
    opened by jvalenciag 11
  •  Add SSL and ability to add headers to http client + Fix assert on retry

    Add SSL and ability to add headers to http client + Fix assert on retry

    Using EVPP_HTTP_CLIENT_SUPPORTS_SSL for ssl support since otherwise we introduce dependency on openssl. If that dependency is ok, I can remove EVPP_HTTP_CLIENT_SUPPORTS_SSL

    opened by spinorx 10
  • How to properly stop a TCPServer?

    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.

    help wanted 
    opened by jvalenciag 7
  • TCPClient Crash when disconnect on ConnectionCallback

    TCPClient Crash when disconnect on ConnectionCallback

    crash scene:

    image

    reason: Just as the img show, when Connector::HandleWrite::conn_fn_(chan_->fd(), laddr)(line 154) deal with user ConnectionCallback, conn is disconnected, timer_ has been reset 。 So some strategies must be taken to deal with such situations... eg: recheck connect state, or asyn disconnect...

    image

    client code: image

    server code: image

    invalid usage 
    opened by aijyo 6
  • Simple makefile for built libraries

    Simple makefile for built libraries

    Hello,

    Let me first just say that I have recently built evpp along with the examples and tests on my Ubuntu 16.04 system and had no problems.

    The software seems to be extremely fast and I like that a lot as I am going to try and use it for a middleware project that I am starting.

    To that end, I would like to ask if there is a simple Makefile somewhere that I could use as a template in that I have the libraries built now, but want to use the examples/echo/httpecho code as my baseline for the multithreaded application and I do not know how to easily setup a makefile for just that project.

    Any help would be greatly appreciated. Thanks

    opened by Outstep 6
  • Tcp Client Server Crash

    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

    opened by Rezakarimi66 6
  • Segmentation fault in DNS resolver SetCancelCallback

    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
    
    bug 
    opened by jvalenciag 6
  • 关于线程安全的疑问

    关于线程安全的疑问

    1、在同一个eventloop 当中,存在N个conn 的时候,当在onmessagecallback 回调的时候 调用另一个conn是不是线程安全的? 代码逻辑差不多是这样的: class server { void onmessagecallback(conn, msg) { conn2 = conns[2]; // conn 收到消息的时候,触发事件调用其它的conn send msg 这里是不是线程安全的? conn2.send(msg); }

    list conns_; }

    更进一步我看到有eventloopthreadpool,如果上面的操作是线程安全的,那么在同一个threadpool的 eventloop里面的conn是不是线程安全的呢?

    opened by aijyo 5
  • evpp在vs2017的mfc工程中报内存泄漏

    evpp在vs2017的mfc工程中报内存泄漏

    我在一个mfc的项目中引用evpp,刚开始测试时我是在纯C++项目上测试的,没有太留意内存泄漏的问题。测试通后,我就花了两三天时间把项目的部分通信用evpp重写了,解决测试时发现有大量的内存泄漏问题。 刚开始还以为是其他地方的问题导致了内存泄漏,但最终定位到时evpp的内存泄漏。 并且evpp在一个新建的mfc项目中,只是简单使用也会有内存泄漏。 比如,引用头文件 #include <evpp/event_loop.h> 然后在函数中使用如下代码 std::shared_ptrevpp::EventLoop loop(new evpp::EventLoop); 程序退出时就会有内存泄漏。 拿测试用的代码进行测试也是同样是情况。

    我的开发环境如下: Windows版本: Windows10 Visual Studio版本: 15.7.4 Microsoft .Net Framewrok版本:4.7.03056 Windows SDK 版本:10.0.16299.0 image

    请问这是什么原因引起的,能否帮忙分析下哪个地方最有可能出问题。

    opened by 0to1 5
  • Build error in Linux Mint 18.1

    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?

    opened by Rezakarimi66 5
  • 对TCPClient进行压力测试,segment fault退出

    对TCPClient进行压力测试,segment fault退出

    我的代码在某些场景中,可能会频繁打开、关闭TCPClient连接,于是做了个压力测试,发现程序会崩溃,想询问一下这是不是一个不正确的使用方式

    测试代码如下

    #include <memory>
    #include <future>
    
    #include <evpp/tcp_conn.h>
    #include <evpp/tcp_client.h>
    #include <evpp/tcp_server.h>
    #include <evpp/tcp_conn.h>
    #include <evpp/event_loop_thread.h>
    
    #include <glog/logging.h>
    
    using namespace evpp;
    
    int main() {
        // 测试的server数量
        const int tnum = 4;
        
        auto base_thread = std::make_shared<evpp::EventLoopThread>();
        base_thread->Start(true);
    
        auto thread_pool = std::make_shared<evpp::EventLoopThreadPool>(base_thread->loop(), tnum * 2);
        thread_pool->Start(true);
    
        // 主线程同步future
        std::vector<std::future<void>> futures;
    
        for (int ti = 0; ti < tnum; ti++) {
            // 子线程的完成promise 子线程在执行结束后通过setvalue通知主线程结束等待
            std::shared_ptr<std::promise<void>> mp = std::make_shared<std::promise<void>>();
            futures.push_back(mp->get_future());
            std::thread tmp_t([=] {
                std::string s_port = std::to_string(28000 + ti);
                std::string s_ip = "0.0.0.0";
                auto s_addr = s_ip + ":" + s_port;
                auto m_svr = std::make_shared<TCPServer>(thread_pool->GetNextLoop(), s_addr, "tsvr", 1);
                m_svr->SetConnectionCallback([](const TCPConnPtr&) {});
                m_svr->SetMessageCallback([](const TCPConnPtr&, Buffer*) {});
    
                m_svr->Init();
                if (!m_svr->Start()) {
                    LOG(ERROR) << "Svr start failed: " << s_addr;
                }
    
                for (int i = 0; i < 10000; i++) {
                    auto m_cli = std::make_shared<TCPClient>(thread_pool->GetNextLoop(), s_addr, "tmp");
                    m_cli->SetConnectionCallback([](const TCPConnPtr&) {});
                    m_cli->SetMessageCallback([](const TCPConnPtr&, Buffer*) {});
    
                    m_cli->Connect();
                    while (true) { //等待连接
                        auto con = m_cli->conn();
                        if (con && con->IsConnected()) break;
                    }
                    m_cli->Disconnect();
                    while (true) {//等待断开
                        auto con = m_cli->conn();
                        if (!con) break;
                    }
                    m_cli.reset();
    
                }
    
                m_svr->Stop();
                while (!m_svr->IsStopped()) {
                    ;
                }
                mp->set_value();
    
                });
            tmp_t.detach();
        }
    
        for (auto& itor : futures) {
            itor.get();
        }
    
        thread_pool->Stop(true);
        base_thread->Stop(true);
    
        return 0;
    }
    

    执行结果

    ...
    W0218 14:19:01.507688 11864 tcp_client.cc:65] TCPClient::DisconnectInLoop this=0x7f31a8001bb0 remote_addr=0.0.0.0:28002
    W0218 14:19:01.508098 11857 tcp_client.cc:65] TCPClient::DisconnectInLoop this=0x7f3194001bb0 remote_addr=0.0.0.0:28003
    [1]    11855 segmentation fault (core dumped)  ./EvppClient.out
    
    opened by NewSetsu 0
  • 史上最全编译evpp文档

    史上最全编译evpp文档

    1. libevent

    git clone https://github.com/libevent/libevent.git
    git checkout release-2.1.8-stable
    ./autogen.sh
    ./configure
    mkdir build && cd build
    !!! 修改CMakeLists.txt,添加: set(CMAKE_POSITION_INDEPENDENT_CODE ON)
    cmake ..  // 如果没有openssl,使用:cmake -DEVENT__DISABLE_OPENSSL=ON ..
    make
    sudo make install
    

    不使用 set(CMAKE_POSITION_INDEPENDENT_CODE ON) 在编译evpp会出现下面错误:

    /usr/bin/ld: //usr/local/lib/libevent.a(buffer.c.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
    //usr/local/lib/libevent.a: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status
    
    

    2. glog

    方式一(我是使用这个方式)、
    sudo apt-get install autoconf automake libtool
    
    git clone https://github.com/google/glog.git
    git checkout tags/v0.4.0   // 需要看0.4版本的Readme.md
    ./autogen.sh 
    ./configure
    make 
    sudo make install
    
    方式二、
     sudo apt-get install libgoogle-glog-dev
    

    3. boost --文档写着可选,实际上不是

    使用apt-get直接进行安装: sudo apt-get install libboost-dev
      (这个安装成功了,但是使用失败,应该是包不全,没有boost_system与boost_thread等)
      
     1、下载安装包源码:
      wget -c "https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.gz"
     2、解压编译:
      tar -zxvf boost_1_77_0.tar.gz
      cd boost_1_77_0
      ./bootstrap.sh(不用加 --prefix=dir,会默认安装到/usr/local/目录下,成功会生成b2可执行文件)
      
      sudo ./b2 install(时间较长,20分钟) 
    

    4. gflags (optional)

    git clone https://github.com/gflags/gflags.git
    git checkout tags/v2.2.2
    mkdir build && cd build
    cmake -DGFLAGS_NAMESPACE=google -DCMAKE_CXX_FLAGS=-fPIC ..
    make
    sudo make install
    

    5. evpp

    5.1 Download the source code of evpp
    $ git clone https://github.com/Qihoo360/evpp
    $ cd evpp
    $ git checkout v0.7.0
    $ git submodule update --init --recursive   // 不执行这个会出错:fatal error: concurrentqueue/concurrentqueue.h: No such file or directory
    
    5.2 Compile and run unit tests.
    $ mkdir -p build && cd build
    $ cmake -DCMAKE_BUILD_TYPE=Debug ..
    !!! 在 CMakeLists.txt中 删除
    ```
    add_subdirectory (examples)  // 需要依赖gflags,如果我们不安装gflags就删除这个
    add_subdirectory (benchmark) // 如果要编译的话,那么在benchmark/throughput/asio_from_chenshuo/handler_allocator.hpp中添加头文件#include <boost/noncopyable.hpp>
    ```
    $ make   // 添加 -j 我的ubuntu 系统会崩溃
    $ make test // 单元测试
    
    或者直接执行
    
    cd tools && ./release-build.sh // 脚本中的make package会出错(CPack Error: Cannot find rpmbuild), 除非我们执行: apt-get install rpm
    
    5.3 Run the examples
    $ cd evpp/build/bin
    
    Run a HTTP client example:
    $ ./example_http_client_request01
    WARNING: Logging before InitGoogleLogging() is written to STDERR
    I0306 11:45:09.464159 13230 inner_pre.cc:37] ignore SIGPIPE
    I0306 11:45:09.464896 13230 client01.cc:30] Do http request
    I0306 11:45:09.493073 13231 client01.cc:14] http_code=200 [ok
    ]
    I0306 11:45:09.493124 13231 client01.cc:16] HTTP HEADER Connection=close
    I0306 11:45:09.493242 13231 event_loop.cc:103] EventLoop is stopping now, tid=140722561709824
    I0306 11:45:09.993921 13231 event_loop.cc:93] EventLoop stopped, tid: 140722561709824
    I0306 11:45:09.994107 13230 client01.cc:38] EventLoopThread stopped. 
    
    Run a HTTP server example:
    $ ./example_httpecho
    WARNING: Logging before InitGoogleLogging() is written to STDERR
    I0306 12:15:31.703927 21228 inner_pre.cc:37] ignore SIGPIPE
    I0306 12:15:31.706221 21228 http_server.cc:99] http server is running
    

    And in another console:

    $ curl "http://127.0.0.1:9009/echo" -d "Hello, world"
    Hello, world
    
    Run a TCP echo server example:
    $ ./example_tcpecho
    

    And in another console:

    $ telnet 127.0.0.1 9099 
    Trying 127.0.0.1...
    Connected to 127.0.0.1.
    Escape character is '^]'.
    

    Here we can type any words and we will find it is responsed by our TCP echo server.

    5.4 Other

    If you want to compile evpp on Windows using Microsoft Visual Studio 2015, please see quick_start_windows_with_visualstudio.md

    问题

    1. ./example_http_client_request01 
    ./example_http_client_request01: error while loading shared libraries: libglog.so.0: cannot open shared object file: No such file or directory
    
    实际上/usr/local/lib下面有的,那么执行 ldconfig
    
    
    2. CPack Error: Cannot find rpmbuil
    apt-get install rpm
    
    opened by gocpplua 1
Releases(v0.7.0)
  • v0.7.0(Jul 13, 2017)

    Features:

    • Rename http::Context::FindClientIP to http::Context::FindClientIPFromURI
    • Add http::Context::FindQueryFromURI and http::Context::GetQuery. Thanks @sumory @sotex
    • Improve the performance of gettimeofday on windows. Thanks @yuangu

    Fix bugs:

    • Fix EventLoop::watcher_ notify failed after a fork() #56
    Source code(tar.gz)
    Source code(zip)
  • v0.6.1(Jun 21, 2017)

  • v0.6.0(Jun 19, 2017)

    Bug fix:

    • recv prefix multiget error
    • httpc::Request does not retry when evhttp_make_request failed #48
    • evnsq Client::HandleLoopkupdHTTPResponse coredump when response is null #48
    Source code(tar.gz)
    Source code(zip)
  • v0.5.0(May 28, 2017)

    Features:

    • Add IPv6 support for sock::ParseFromIPPort()
    • Add sock::SplitHostPort
    • Add http::Context::set_response_http_code(int code)
    • Add retry mechanism for http request
    • Change windows compile tool chain and libraries' dependence to vcpkg
    • Build a vcpkg package. See https://github.com/Microsoft/vcpkg/pull/1177

    Refactors:

    • Remove evpp/exp.h and evpp/evpp_export.h
    • Remove evnsq/exp.h, evnsq/evpp_export.h and evmc/exp.h
    • Rename evpp/libevent_headers.h to evpp/libevent.h
    • Rename evpp/libevent_compact.cc to evpp/libevent.cc
    • Rename evpp/log_config.h to evpp/logging.h
    • Extract windows relative codes to evpp/windows_port.h

    Bug fix: #43 Fixed TCPClient crashed when DNS resolving timeout

    Source code(tar.gz)
    Source code(zip)
  • v0.4.0(Apr 26, 2017)

    Refactor:

    • Rename event_loop() to loop() of EventLoopThread/TCPClient/http::Service
    • Rename libevent_watcher.{h,cc} to event_watcher.{h.cc}
    • Rename evnsq::ConnPtr to evnsq::NSQConnPtr

    Bug fix:

    • Fix unit test failed problem. If the tcp_client_thread does not start,we do TCPClient::Connect, that will cause race-condition problem #25
    • Fix file descriptor leak bug #23
    • Fix TCPServer::Stop coredump #26
    • Fix HTTP Server::Stop coredump #27 #28 #29 #36
    • Fix TCPServer::HandleNewConn assert error and fix a race condition problem of TCPServer::Start #30
    • Fix DNSResolver will invoke callback twice when it is timeout #32
    • Fix evnsq Client::IsReady() implement wrong #21
    Source code(tar.gz)
    Source code(zip)
  • v0.3.2(Apr 5, 2017)

    Features:

    • Add Buffer::EnsureWritableBytes

    Bug fix:

    • #19 Fix Segmentation fault in DNS resolver SetCancelCallback bug
    • Fix Buffer::ToText '\0' bug
    Source code(tar.gz)
    Source code(zip)
  • v0.3.1(Mar 27, 2017)

    Features:

    • #3 evnsq supports AUTH
    • Add boost::lockfree::queue compile option and build a library linked with boost.

    Bug fix:

    • #17 TCPClient will crash when we do 'Disconnect' and destruct the object immediately
    • #18 The delay closing feature of an incoming TCPConn will make memory leak
    Source code(tar.gz)
    Source code(zip)
  • v0.3.0(Mar 18, 2017)

    Features:

    • #3 Remove Timestamp parameter from MessageCallback

    Bug fix:

    • #5 Fix EventLoop::QueueInLoop bug
    • #7 Fix Crush when TCPClient connect failed bug
    • #9 Fix Connector::Cancel crush
    • #10 Fix Connector was not released bug
    • #11 Unit test failed testTCPClientDisconnectImmediately
    • #12 testDNSResolver may hang there sometimes
    • #13 Wrong usage of struct evhttp_request in trace log
    • #14 DNSResolver::OnTimeout do not clear the timer
    • #15 testHTTPServer1 may hang there sometimes
    Source code(tar.gz)
    Source code(zip)
  • v0.2.4(Mar 14, 2017)

Owner
Qihoo 360
360 official github
Qihoo 360
Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and 10K connections problem solution

CppServer Ultra fast and low latency asynchronous socket server & client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket protocols and

Ivan Shynkarenka 834 May 18, 2022
Provide translation, currency conversion, and voting services. First using telnet you create a connection to a TCP socket, then the server connects to 3 UDP sockets hosted on other servers to do tasks.

to run micro servers g++ translator.cpp -o translator ./translator <port 1> g++ voting.cpp -o voting ./voting <port 2> g++ currency_converter.cpp -o c

Jacob Artuso 1 Oct 29, 2021
BingBing 52 Apr 27, 2022
Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services.

Pushpin is a reverse proxy server written in C++ that makes it easy to implement WebSocket, HTTP streaming, and HTTP long-polling services. The project is unique among realtime push solutions in that it is designed to address the needs of API creators. Pushpin is transparent to clients and integrates easily into an API stack.

Fanout 3.1k May 8, 2022
Winpcap-based network packet capture tool, support TLS (part), UDP, ICMP, TCP, ARP, DNS and other protocol analysis, interface reference wireshark.

Winpcap-based network packet capture tool, support TLS (part), UDP, ICMP, TCP, ARP, DNS and other protocol analysis, interface reference wireshark.

null 31 Apr 26, 2022
Brynet - Header Only Cross platform high performance TCP network library using C++ 11.

Brynet Header Only Cross platform high performance TCP network library using C++ 11. Build status Windows : Linux/MacOS : Features Header only Cross p

IronsDu 838 May 15, 2022
A cross-platform network learning demos. Like high-performance http server

Network-Learn A cross-platform network learning demos (toys). And I try not to use 3rd-party libraries. Welcome to try it out and leave your comments.

Ho 229 24 Apr 15, 2022
Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

Built a client-server application using TCP and UDP sockets, in which the clients can subscribe/unsubscribe to various topics.

null 1 Oct 15, 2021
A TCP / UDP program supporting multiple test scenarios

sock_test A TCP / UDP program supporting multiple test scenarios The current communication protocol only supports UDP. TCP will be supported later. Ho

null 4 Mar 8, 2022
Wrapper for linux TCP/UDP/unix/USB socket connections

Socket Connection wrapper shared library Shared library that realize sockets connections and could transfer data-packages. Navigation Navigation Insta

Dmitry Golgovsky 7 Dec 21, 2021
Portable, single-file, protocol-agnostic TCP and UDP socket wrapper, primarily for game networking

Documentation This is a header-only library, as such most of its functional documentation is contained within the "header section" of the source code

null 62 Mar 23, 2022
📡 TCP/UDP port redirector

rinetd, by Thomas Boutell and Sam Hocevar. Released under the terms of the GNU General Public License, version 2 or later. This program is used to eff

Sam Hocevar 405 May 13, 2022
H2O - the optimized HTTP/1, HTTP/2, HTTP/3 server

H2O - an optimized HTTP server with support for HTTP/1.x, HTTP/2 and HTTP/3 (experimental) Copyright (c) 2014-2019 DeNA Co., Ltd., Kazuho Oku, Tatsuhi

H2O 10k May 11, 2022
A C++ async HTTP client library to use in asynchronous applications while communicating with REST services.

libashttp An asynchronous HTTP library using Boost.ASIO as the backend. This project is licensed under: Usage Here is a example usage which is taken f

Tolga Hoşgör 51 Dec 19, 2021
cuehttp is a modern c++ middleware framework for http(http/https)/websocket(ws/wss).

cuehttp 简介 cuehttp是一个使用Modern C++(C++17)编写的跨平台、高性能、易用的HTTP/WebSocket框架。基于中间件模式可以方便、高效、优雅的增加功能。cuehttp基于boost.asio开发,使用picohttpparser进行HTTP协议解析。内部依赖了nl

xcyl 23 Mar 25, 2022
A Tcp/Ip stack implementation on top of Solarflare ef_vi, and a C++ headers only framework for tcp multiplexing client/server.

Efvitcp Efvitcp is a tcp library using Solarflare ef_vi interface on linux, and also a tcp multiplexing framework for both C++ client and server progr

Meng Rao 18 Jan 12, 2022
an easy implementation of a multi-process tcp server and a multi-thread tcp client

一个TCP多进程服务器-多线程客户端的简单实现。 客户端类似Apache ab的测试功能,能够通过向某一个ip端口发送指定并发量和总数量的tcp短连接;服务端处理tcp短连接,每来一条消息就打印一条log。 使用cmake编译,建议在vscode里编译,或者命令行 # 终端进入目录 mkdir bu

adin 1 Nov 28, 2021
The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design. This project aims to help C++ developers connect to and interact with services.

Welcome! The C++ REST SDK is a Microsoft project for cloud-based client-server communication in native code using a modern asynchronous C++ API design

Microsoft 6.8k May 10, 2022
Asynchronous, Header-only C++ HTTP-over-(TCP|UNIX Socket|STDIO) Library

CXXHTTP A C++ library implementing an asynchronous HTTP server and client. To clone this library, make sure you also clone the submodules. The --recur

null 25 Mar 19, 2021