profile
viewpoint

chenshuo/muduo 7689

Event-driven network library for multi-threaded Linux server in C++11

chenshuo/4.4BSD-Lite2 274

User-mode TCP/IP stack from 4.4BSD-Lite2, a companion of TCP/IP Illustrated vol. 2

chenshuo/muduo-tutorial 171

Tutorial of Muduo network library

chenshuo/muduo-protorpc 158

Google Protobuf RPC based on Muduo

chenshuo/evcpp 25

A header-only C++ wrapper of libevent2

chenshuo/leanstl 23

Lean STL

chenshuo/muduo-udns 17

Muduo Non-blocking Address Resolver with UDNS

CommitCommentEvent

pull request commentchenshuo/muduo

Add contrib/mariadbclient

Please fix travis-ci first, put apt-get install in .travis.yml.

hfcrwx

comment created time in 2 days

push eventchenshuo/muduo

hfcrwx

commit sha 2be38aeae74877277c6b0a87548831706bbedea2

Fix wrong log

view details

push time in 4 days

push eventchenshuo/muduo

hfcrwx

commit sha 2be38aeae74877277c6b0a87548831706bbedea2

Fix wrong log

view details

push time in 4 days

PR merged chenshuo/muduo

Fix wrong log
+10 -10

0 comment

5 changed files

hfcrwx

pr closed time in 4 days

push eventchenshuo/muduo

GGGGITFKBJG

commit sha 49de14956093a2464ea610e3149976515301a1d5

Fix #458: ThreadPool::run() after stop() should not block forever. * update ThreadPool_test.cc

view details

hfcrwx

commit sha 96c47c7b3b3bda5f1e9cd7dcfa688ec0773440a4

Change boost::bind to std::bind in contrib/thrift (#465) * fix compile error "Reference to '_1' is ambiguous" * Change boost::bind to std::bind in contrib/thrift * Remove "using namespace" in contrib/thrift

view details

push time in 5 days

push eventchenshuo/muduo

hfcrwx

commit sha 96c47c7b3b3bda5f1e9cd7dcfa688ec0773440a4

Change boost::bind to std::bind in contrib/thrift (#465) * fix compile error "Reference to '_1' is ambiguous" * Change boost::bind to std::bind in contrib/thrift * Remove "using namespace" in contrib/thrift

view details

push time in 5 days

PR merged chenshuo/muduo

Reference to '_1' is ambiguous

centos7-x86_64 编译器及库均为默认版本,有编译错误: /root/muduo/contrib/thrift/ThriftConnection.cc:23:47: 错误:对‘_1’的引用有歧义 this, _1, _2, _3)); 原因: using namespace muduo;引起muduo::_1和boost中(anonymous namespace)::_1的混乱 解决方法: using namespace muduo; -> using muduo::Timestamp;

+32 -26

2 comments

3 changed files

hfcrwx

pr closed time in 5 days

issue closedchenshuo/muduo

EchoProcessor is not found

Hello, i didn't find the definition of EchoProcessor~

closed time in 6 days

chenyaoyu

issue commentchenshuo/muduo

EchoProcessor is not found

I don't get it.

chenyaoyu

comment created time in 6 days

Pull request review commentchenshuo/muduo

Reference to '_1' is ambiguous

 ThriftConnection::ThriftConnection(ThriftServer* server,     state_(kExpectFrameSize),     frameSize_(0) {-  conn_->setMessageCallback(boost::bind(&ThriftConnection::onMessage,-                                        this, _1, _2, _3));+  conn_->setMessageCallback(std::bind(&ThriftConnection::onMessage,+                                        this, muduo::_1, muduo::_2, muduo::_3));

Replace muduo::_1 with just _1, you may need to using muduo::_1 at the beginning of this file.

Ditto for _2, _3 and below.

hfcrwx

comment created time in 6 days

Pull request review commentchenshuo/muduo

Reference to '_1' is ambiguous

 #include "contrib/thrift/ThriftConnection.h" -#include <boost/bind.hpp>+#include <functional>  #include "muduo/base/Logging.h"  #include <thrift/transport/TTransportException.h>  #include "contrib/thrift/ThriftServer.h" -using muduo::Timestamp;-using muduo::net::Buffer;-using muduo::net::TcpConnectionPtr;+using namespace muduo;

Please don't using namespace in contrib code.

hfcrwx

comment created time in 6 days

issue commentchenshuo/muduo

进程之间的实现跟redis的实现有点类似。多线程的是通过循环队列吗?无锁队列吗?

This is not an issue of muduo. GitHub issues are not for discussion like this. Please read and fill in Issue template before filing an issue.

xiaozhitaba

comment created time in 8 days

issue closedchenshuo/muduo

请教一个问题 通信协议的设计啥证明设计的?跟redis一样用RESP2吗

GitHub issues are for tracking bugs, not for general discussing like a forum.

If you have a general question to ask, send it to mailing list:

muduo-library@googlegroups.com

Or visit: https://groups.google.com/forum/#!forum/muduo-library

When file an issue muduo, please provide a SSCCE: Short, Self Contained, Correct (Compilable), Example.

Also specify the exact environment where the issue occurs:

Linux distro and version? x86 or ARM? 32-bit or 64-bit?

Branch (cpp98/cpp11/cpp17) and version of muduo?

Version of cmake, gcc and boost? (If not from distro.)

closed time in 8 days

xiaozhitaba

issue commentchenshuo/muduo

请教一个问题 通信协议的设计啥证明设计的?跟redis一样用RESP2吗

This is not an issue of muduo. GitHub issues are not for discussion like this.

xiaozhitaba

comment created time in 8 days

pull request commentchenshuo/muduo

Reference to '_1' is ambiguous

  1. One patch per PR please.
  2. Change boost::bind to std::bind is a better fix for contrib/thrift/ThriftConnection.cc
hfcrwx

comment created time in 8 days

push eventchenshuo/muduo

GGGGITFKBJG

commit sha 49de14956093a2464ea610e3149976515301a1d5

Fix #458: ThreadPool::run() after stop() should not block forever. * update ThreadPool_test.cc

view details

push time in 11 days

issue closedchenshuo/muduo

ThreadPool::run()可能会阻塞的问题。

问题是这样的: 当队列满时,生产者线程也会阻塞。ThreadPool::stop()只是唤醒了阻塞的消费者线程。 假如某时刻队列已满,消费者线程正忙于执行已取出的任务,生产者线程放置操作会阻塞。这时另一个线程调用stop()想关闭线程池,就会造成生产者线程永远都阻塞在wait()上。

代码是这样:

#include "muduo/base/ThreadPool.h"
#include <stdio.h>
#include "muduo/base/CurrentThread.h"

using namespace muduo;

ThreadPool pool;

void longtimeTask() {  // 每个任务需要5秒完成
  printf("Thread %s taken a task.\n", CurrentThread::name());
  CurrentThread::sleepUsec(5000000);
  printf("Thread %s done the task.\n", CurrentThread::name());
}

void func() {
  pool.run(longtimeTask);  // 这个刚放入会被取出执行
  pool.run(longtimeTask);  // 这个会占满队列
  pool.run(longtimeTask);  // 应该会阻塞在这里
}

int main() {
  pool.setMaxQueueSize(1);
  pool.start(1);

  Thread t1(func, "t1");  // 让t1放置3个任务.
  t1.start();

  CurrentThread::sleepUsec(1000000);  // 1秒后关闭pool
  pool.stop();
  printf("Pool stoped.\n");

  t1.join();// t1会一直阻塞.
  return 0;
}

上面的代码执行时不能正常退出。 让stop()也唤醒生产者,并且给run()加上if (running_)判断可以解决这个问题。 这是代码的漏洞,还是我的用法不正确?

closed time in 11 days

GGGGITFKBJG

PR merged chenshuo/muduo

fix #458
+37 -1

1 comment

3 changed files

GGGGITFKBJG

pr closed time in 11 days

pull request commentchenshuo/muduo

fix #458

Please add a test for this change.

GGGGITFKBJG

comment created time in 12 days

issue commentchenshuo/muduo

ThreadPool::run()可能会阻塞的问题。

如果你的项目确实需要支持这个应用场景,那么可以提个 PR。 或者在 run() 的前面加一条注释,告诉用户如果提前 stop()run() 有可能一直阻塞。

muduo 作为服务端开发的库,通常在设计上没有考虑程序正常退出的需求。目前 TcpClient 也对销毁的支持不够好。

GGGGITFKBJG

comment created time in 13 days

issue commentchenshuo/muduo

在AsyncLogging的109行的判断buffersToWrite.size()大于2后resize是否必要,因为后面总会clear。

代码里有一行注释,说明其目的:

// drop non-bzero-ed buffers, avoid trashing

简单说就是想反复使用前面创建的两个 newBuffer1newBuffer2,尽量把第 51 行临时分配的 Buffer 尽早释放。

Super-long

comment created time in 13 days

issue commentchenshuo/muduo

ThreadPool::run()可能会阻塞的问题。

可以算是 bug,ThreadPool 没有考虑 stop() 之后继续调用 run() 的情况,在 stop() 里也没有考虑去唤醒已经阻塞的 run()。 如果打算修复,那”stop() 之后继续调用 run()” 应该具有什么样的行为?

GGGGITFKBJG

comment created time in 13 days

issue commentchenshuo/muduo

httpserver_test logged error message when pressure test

我觉得这可能是你用的 webbench 的问题,这些 ERROR 消息说明 server 想发数据发不出去。 按照 HTTP 协议,应该是 server 发完数据之后主动关闭连接,但是你用的 webbench 却自己把连接 shutdown 了。 https://github.com/linyacool/WebBench/blob/master/webbench.c#L540

你可以换别的常用测试工具再试一下,例如 ab。

MakingL

comment created time in 18 days

issue commentchenshuo/muduo

boost:bind的函数类型不对

What's the question here? The code works just fine: https://ideone.com/Mhjl02

#include <stdio.h>
#include <functional>
 
using Callback = std::function<void(int)>;
 
void print() {
	printf("Hello\n");
}
 
int main() {
	Callback f = std::bind(print);
	f(43);  // prints "Hello"
	return 0;
}
icooperlee

comment created time in 22 days

issue commentchenshuo/muduo

boost:bind的函数类型不对

This is not a bug.

It's a feature of boost::bind and std::bind, as stated in its document [1]:

Any extra arguments are silently ignored,

[1] https://www.boost.org/doc/libs/1_73_0/libs/bind/doc/html/bind.html

icooperlee

comment created time in 23 days

issue commentchenshuo/muduo

如何去除boost依赖?

Try the cpp17 branch.

gnleaf

comment created time in a month

issue closedchenshuo/muduo

bazel build failure with llvm

ERROR: /home/wangsu/.cache/bazel/_bazel_wangsu/fed691259f92afcde51abaed59869647/external/muduo/muduo/base/BUILD.bazel:1:1: C++ compilation of rule '@muduo//muduo/base:base' failed (Exit 1) clang failed: error executing command external/llvm_toolchain/bin/clang -U_FORTIFY_SOURCE -fstack-protector -fno-omit-frame-pointer -fcolor-diagnostics -Wall -Wthread-safety -Wself-assign '-std=c++17' '-stdlib=libc++' -MD -MF ... (remaining 20 argument(s) skipped)

Use --sandbox_debug to see verbose messages from the sandbox external/muduo/muduo/base/Date.cc:57:10: error: member access into incomplete type 'const struct tm' t.tm_year+1900, ^ /usr/include/wchar.h:83:8: note: forward declaration of 'tm' struct tm; ^ external/muduo/muduo/base/Date.cc:58:10: error: member access into incomplete type 'const struct tm' t.tm_mon+1, ^ /usr/include/wchar.h:83:8: note: forward declaration of 'tm' struct tm; ^ external/muduo/muduo/base/Date.cc:59:10: error: member access into incomplete type 'const struct tm' t.tm_mday)) ^ /usr/include/wchar.h:83:8: note: forward declaration of 'tm' struct tm; ^ 3 errors generated. Target //ds:main-ds failed to build Use --verbose_failures to see the command lines of failed build steps. INFO: Elapsed time: 1.090s, Critical Path: 0.76s INFO: 0 processes. FAILED: Build did NOT complete successfully

closed time in a month

wangsu502

push eventchenshuo/muduo

Shuo Chen

commit sha f3d1725aa43befd5f2c4de8e5174b2fb1f2d793b

Fix issue #421. Cherry-pick: b55b0ac6a10d4ded1301c3172e779ec46ada2ab3

view details

zhyncs

commit sha 006f9d7450e939b1f100ad89baecb5df094582c0

fix: remove redundant std::move for a local object in a return statement Cherry-pick: 0f3cb975510ea11d984f0fb03c8f5ea776c64f3a

view details

push time in a month

created tagchenshuo/muduo

tagv2.0.2

Event-driven network library for multi-threaded Linux server in C++11

created time in a month

push eventchenshuo/muduo

hfcrwx

commit sha 1417ee111be1fe8a5cf4f3d90a23c5be1d7c875f

minor fixes (#443)

view details

Shuo Chen

commit sha c8b2cbc4d10c65bb74363c92f4dcd461ec96b76f

Fix warnings in gcc 8 (#351). Cherry-pick: 373d2d127fc2f8e94afa3a24d52f9caa5b0fc89b

view details

OjackstevensonO

commit sha bd50e5c8566c9f97ccde18957a13615d3245ed7c

fix a small 'build fail' issue caused by the deprecation of ByteSize() of protobuf message (#433) * change Legacy ByteSize() API of protobuf message to ByteSize Long(), because ByteSize() was deprecated in new version's protobuf * Replace ByteSize() by ByteSizeLong() just for 'Protobuf Message' of which version number strictly greater than v3.9.2. Cherry-pick: 6a4da5bef3ae7ed6b749b198e6a691d4c0a3c7a4

view details

Wei Tan

commit sha 46d4694155f10a003fa710067d2a311229b07d82

Fix build for Ubuntu 20.04 LTS (#451) * Fix deprecated API in Boost.Asio * Use BOOST_VERSION macro to make it work for both old and new Boost versions Cherry-pick: 52840b84ea63803cc3a41b1275851a0c9b6decf9

view details

Shuo Chen

commit sha b55b0ac6a10d4ded1301c3172e779ec46ada2ab3

Fix issue #421.

view details

push time in a month

push eventchenshuo/muduo

Shuo Chen

commit sha c8b2cbc4d10c65bb74363c92f4dcd461ec96b76f

Fix warnings in gcc 8 (#351). Cherry-pick: 373d2d127fc2f8e94afa3a24d52f9caa5b0fc89b

view details

OjackstevensonO

commit sha bd50e5c8566c9f97ccde18957a13615d3245ed7c

fix a small 'build fail' issue caused by the deprecation of ByteSize() of protobuf message (#433) * change Legacy ByteSize() API of protobuf message to ByteSize Long(), because ByteSize() was deprecated in new version's protobuf * Replace ByteSize() by ByteSizeLong() just for 'Protobuf Message' of which version number strictly greater than v3.9.2. Cherry-pick: 6a4da5bef3ae7ed6b749b198e6a691d4c0a3c7a4

view details

Wei Tan

commit sha 46d4694155f10a003fa710067d2a311229b07d82

Fix build for Ubuntu 20.04 LTS (#451) * Fix deprecated API in Boost.Asio * Use BOOST_VERSION macro to make it work for both old and new Boost versions Cherry-pick: 52840b84ea63803cc3a41b1275851a0c9b6decf9

view details

Shuo Chen

commit sha b55b0ac6a10d4ded1301c3172e779ec46ada2ab3

Fix issue #421.

view details

push time in a month

issue closedchenshuo/muduo

base/Timestamp.cc 中的静态断言提示

class Timestamp : ...
{
...
privata:
int64_t micro..;
}

static_assert(sizeof(Timestamp) == sizeof(int64_t),
              "Timestamp is same size as int64_t");

这个断言的提示信息是不是有问题呀,提示信息不是在前面条件为false才打印么 是不是该提示: size of Timestamp 不等于 int64_t

closed time in a month

zshorz

issue closedchenshuo/muduo

Compile error

#Linux distro and version? x86 or ARM? 32-bit or 64-bit? x86 ubuntu18.04 64bit

Branch (cpp98/cpp11/cpp17) and version of muduo?

cpp11

Version of cmake, gcc and boost? (If not from distro.)

cmake version 3.10.2 Boost version: 1.65.1 gcc 7.4.0 protoc 3.8.0

Building CXX object muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/rpc.pb.cc.o In file included from /home/leo/workspace/source/build/release-cpp11/muduo/net/protorpc/rpc.pb.cc:4:0: /home/leo/workspace/source/build/release-cpp11/muduo/net/protorpc/rpc.pb.h:10:10: fatal error: google/protobuf/port_def.inc: No such file or directory #include <google/protobuf/port_def.inc> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ compilation terminated. muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/build.make:69: recipe for target 'muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/rpc.pb.cc.o' failed make[2]: *** [muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/rpc.pb.cc.o] Error 1 CMakeFiles/Makefile2:1875: recipe for target 'muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/all' failed make[1]: *** [muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2

请问编译muduo库需要哪个版本的protobuf?

closed time in a month

hardway2008

push eventchenshuo/muduo

Wei Tan

commit sha 52840b84ea63803cc3a41b1275851a0c9b6decf9

Fix build for Ubuntu 20.04 LTS (#451) * Fix deprecated API in Boost.Asio * Use BOOST_VERSION macro to make it work for both old and new Boost versions

view details

push time in a month

PR merged chenshuo/muduo

Fix deprecated API in Boost.asio

get_io_service is marked as deprecated for a long time. Since Boost 1.70, it is removed. So with the latest version Boost, it will cause build fail. According to the release notes, fix the deprecated API, and confirmed with Boost 1.72.

+9 -0

2 comments

1 changed file

tan-wei

pr closed time in a month

pull request commentchenshuo/muduo

Fix deprecated API in Boost.asio

Can you make it work for both old and new Boost versions by checking the BOOST_VERSION macro?

tan-wei

comment created time in a month

Pull request review commentchenshuo/muduo

Fix deprecated API in Boost.asio

 class TtcpServerConnection : public std::enable_shared_from_this<TtcpServerConne                              muduo::noncopyable {  public:-  TtcpServerConnection(boost::asio::io_service& io_service)-    : socket_(io_service), count_(0), payload_(NULL), ack_(0)+  TtcpServerConnection(boost::asio::executor executor)

Why pass by value not by const-reference? The future readers and maintainers will have the same question here.

tan-wei

comment created time in a month

pull request commentchenshuo/muduo

优化static const 变量,减少代码量

你这个 PR 让所有使用 muduo/net/Channel.h 的文件都 include 了 <poll.h>,我不认为是合适的做法。

jiapengwen

comment created time in a month

push eventchenshuo/muduo

hfcrwx

commit sha 1417ee111be1fe8a5cf4f3d90a23c5be1d7c875f

minor fixes (#443)

view details

push time in a month

PR merged chenshuo/muduo

minor fixes
+2 -2

0 comment

2 changed files

hfcrwx

pr closed time in a month

issue commentchenshuo/recipes

recipes/reactor 中所有例子 make 之后显示 error 如下: ambigous ????

gettid(2) was added in glibc 2.30, so you may just remove the getpid() from Thread.cc.

Ref. http://man7.org/linux/man-pages/man2/gettid.2.html

DPSDL

comment created time in a month

PR opened KiCad/kicad-symbols

Fix 1N4003 description.

It's 200V not 20V from the datasheet.

+1 -1

0 comment

1 changed file

pr created time in a month

push eventchenshuo/kicad-symbols

Shuo Chen

commit sha f75e8e519e66489e3afd538cc32569aba3913758

Fix 1N4003 description. It's 200V not 20V from the datasheet.

view details

push time in a month

fork chenshuo/kicad-symbols

Official KiCad schematic symbol libraries for Kicad 5

https://kicad.github.io/symbols

fork in a month

created tagchenshuo/llvm-release

tagr10.0.0

Combined source tree of LLVM, Clang, clang-tools-extra, compiler-rt and libcxx

created time in 2 months

push eventchenshuo/llvm-release

Shuo Chen

commit sha 562216964c1d0dba0b4806ce87bafb734f59d387

Import llvm 10.0.0

view details

Shuo Chen

commit sha c27f260c4ec09e0af8db27da24ff3f61a59fe659

Import clang 10.0.0

view details

Shuo Chen

commit sha ce917f7d335b64d42894b5799ca171c529bd8fa1

Import clang-tools-extra 10.0.0

view details

Shuo Chen

commit sha cf022593fd9747053fb5587085600ad56ad12b9f

Import compiler-rt 10.0.0

view details

Shuo Chen

commit sha c2a64897fa4f538860b252dcd28a5c8c695717c2

Import libcxx 10.0.0

view details

push time in 2 months

created tagchenshuo/llvm-release

tagr9.0.1

Combined source tree of LLVM, Clang, clang-tools-extra, compiler-rt and libcxx

created time in 2 months

push eventchenshuo/llvm-release

Shuo Chen

commit sha 07fbf0ed43a0bce5dcdfe059b79dc152181ad242

Import libcxx 9.0.0

view details

Shuo Chen

commit sha 341e2ea5d42179eeb0709d9e698cc07cfea66d04

Import llvm/clang/etc 9.0.1

view details

push time in 2 months

created tagchenshuo/llvm-release

tagr9.0.0

Combined source tree of LLVM, Clang, clang-tools-extra, compiler-rt and libcxx

created time in 2 months

created tagchenshuo/llvm-release

tagr8.0.1

Combined source tree of LLVM, Clang, clang-tools-extra, compiler-rt and libcxx

created time in 2 months

push eventchenshuo/llvm-release

Shuo Chen

commit sha 7821532571f00385eda7dd413d11a074ea8d517d

Import llvm 9.0.0

view details

Shuo Chen

commit sha 66512437c5ed6c5d9c5635a4bce77fe7a85ad85a

Import clang 9.0.0

view details

Shuo Chen

commit sha e4a3efb0cc73e621b9181c1a1eb1d323252f6959

Import clang-tools-extra 9.0.0

view details

Shuo Chen

commit sha 7b44351989468b172380c12b059ba6059ae6a2be

Import compiler-rt 9.0.0

view details

Shuo Chen

commit sha 96a2339f74c3938affc5a48e44a20ce032a2e32a

Import libcxx 9.0.0

view details

push time in 2 months

push eventchenshuo/llvm-release

Shuo Chen

commit sha ca1c0d3dd5dc000c856f55de1b187817202a32cf

Import llvm 8.0.1

view details

Shuo Chen

commit sha 593bbb401bed6ae5e746a318094b4591f3e77ffb

Import clang 8.0.1

view details

Shuo Chen

commit sha e247e3f700a215b19334fe2fbe6221904cf8d5c3

Import compiler-rt 8.0.1 and clang-tools-extra (no changes)

view details

Shuo Chen

commit sha cc4dcf44acd46975c08b24a86773ed55a169e7fb

Import libcxx 8.0.1

view details

push time in 2 months

issue commentchenshuo/muduo

Build Failed: unknown value ‘native’ for -march

Try changing kMaxNumericSize to be std::numeric_limits<long double>::digits10 + 11. Looks like your ARM 64 has 128-bit long double type.

MakingL

comment created time in 2 months

issue commentchenshuo/muduo

Problem in installing muduo

If you download boost by yourself, I can't help much. Try install the version that comes with Ubuntu 16.04 libboost-dev and remove the 1.69 version.

YuzeZhang

comment created time in 2 months

issue commentchenshuo/muduo

请问下Buffer::readFd中的 char extrabuf[65536]可以定义成成员变量吗?

你如果定义成成员变量,会增加每个 Buffer 的内存开销。 我觉得就失去 stack buffer 的意义了。

如果你的 stack 够大,在 benchmark 证明确有性能提高的前提下, 可以扩大到 128K 或 256K。再大我估计就没啥意义了。

wangdongyu1989

comment created time in 2 months

Pull request review commentchenshuo/recipes

fix ttcp make error

 $(LIB): $(LIB_OBJS)  $(BINS): $(LIB) -bin/ttcp: LDFLAGS += -lboost_program_options

Changing LDFLAGS to LDLIBS is sufficient to fix it.

liuyunbin

comment created time in 3 months

more