profile
viewpoint

chenshuo/muduo 7117

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

chenshuo/4.4BSD-Lite2 267

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

chenshuo/muduo-protorpc 152

Google Protobuf RPC based on Muduo

chenshuo/muduo-tutorial 142

Tutorial of Muduo network library

chenshuo/primer 51

Source code of C++ Primer 4th ed

chenshuo/evcpp 25

A header-only C++ wrapper of libevent2

chenshuo/leanstl 23

Lean STL

issue commentchenshuo/muduo

The LogStream::Buffer

Try change kSmallBuffer to a larger number, like 15000.

841974180

comment created time in a month

issue commentchenshuo/muduo

TcpServer和EventLoop该如何正确析构

  1. 原则上你可以先在子线程析构 TcpServer 和 EventLoop,再退出。如果你确定 crash 不会对系统造成影响,也可以把相关的检查去掉,让程序安静地退出。
  2. 是,EventLoop 的生命期应该长于 TcpServer。
Jasons0215

comment created time in a month

issue commentchenshuo/muduo

The LogStream::Buffer

IIUC, you modified muduo, then there's a SEGFAULT.

What you do expect me to do without showing your modification?

841974180

comment created time in a month

push eventchenshuo/software-tools-in-c

Shuo Chen

commit sha b28c36258cd95e6c7d603cbc1b147cfc656cc31d

Add cpp/fileio/makecopy.cc

view details

push time in a month

push eventchenshuo/software-tools-in-c

Shuo Chen

commit sha 04edf81fe19ea94259370961dfc4ea4b1a854fac

converted fileio/

view details

push time in a month

push eventchenshuo/software-tools-in-c

Shuo Chen

commit sha f2d5810f08f260524b18fc167673a5b1752312d3

Add cpp/fileio/concat.cc

view details

push time in a month

push eventchenshuo/software-tools-in-c

Shuo Chen

commit sha a4798a1a30064d865e21de190451ee43428f3548

Add cpp/fileio/include.cc

view details

push time in a month

push eventchenshuo/software-tools-in-c

Shuo Chen

commit sha a58c9ec8ceadc943a6dd5bd9d0bbbbab0e44dac5

Add cpp/fileio/compare.cc

view details

push time in a month

PublicEvent

push eventchenshuo/software-tools-in-c

Shuo Chen

commit sha 2aa8a641c1fd9fe6959330e51317b99073023860

update progress.

view details

push time in a month

issue closedchenshuo/muduo

Mac 编译出错,求看

/usr/local/include/boost/concept/detail/has_constraints.hpp:44:50: error: use of old-style cast [-Werror,-Wold-style-cast] , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) ); ^ ~ /usr/local/include/boost/config/detail/suffix.hpp:394:72: note: expanded from macro 'BOOST_STATIC_CONSTANT'

define BOOST_STATIC_CONSTANT(type, assignment) static const type assignment

                                                                   ^~~~~~~~~~

In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/base/AsyncLogging.cc:6: In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/base/AsyncLogging.h:10: In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/base/BoundedBlockingQueue.h:12: In file included from /usr/local/include/boost/circular_buffer.hpp:58: In file included from /usr/local/include/boost/circular_buffer/base.hpp:22: In file included from /usr/local/include/boost/concept_check.hpp:20: In file included from /usr/local/include/boost/concept/assert.hpp:35: /usr/local/include/boost/concept/detail/general.hpp:31:29: error: use of old-style cast [-Werror,-Wold-style-cast] static void failed() { ((Model*)0)->~Model(); } ^ ~ /usr/local/include/boost/concept/detail/general.hpp:39:29: error: use of old-style cast [-Werror,-Wold-style-cast] static void failed() { ((Model*)0)->~Model(); } ^ ~ /usr/local/include/boost/concept/detail/general.hpp:47:29: error: use of old-style cast [-Werror,-Wold-style-cast] static void failed() { ((Model*)0)->constraints(); } ^ ~ In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/base/AsyncLogging.cc:6: In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/base/AsyncLogging.h:10: In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/base/BoundedBlockingQueue.h:12: In file included from /usr/local/include/boost/circular_buffer.hpp:58: In file included from /usr/local/include/boost/circular_buffer/base.hpp:22: In file included from /usr/local/include/boost/concept_check.hpp:31: /usr/local/include/boost/concept/usage.hpp:16:30: error: use of old-style cast [-Werror,-Wold-style-cast] ~usage_requirements() { ((Model*)0)->~Model(); } ^ ~ 5 errors generated. make[2]: *** [muduo/base/CMakeFiles/muduo_base.dir/AsyncLogging.cc.o] Error 1 make[1]: *** [muduo/base/CMakeFiles/muduo_base.dir/all] Error 2 make[1]: *** Waiting for unfinished jobs.... [ 2%] Building CXX object muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/RpcCodec.cc.o In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/protorpc/RpcCodec.cc:12: /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:15:10: error: 'endian.h' file not found with <angled> include; use "quotes" instead #include <endian.h> ^~~~~~~~~~ "endian.h" /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:15:10: error: non-portable path to file '<Endian.h>'; specified path differs in case from file name on disk [-Werror,-Wnonportable-include-path] #include <endian.h> ^~~~~~~~~~ <Endian.h> /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:31:10: error: use of undeclared identifier 'htobe64' return htobe64(host64); ^ /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:36:10: error: use of undeclared identifier 'htobe32' return htobe32(host32); ^ /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:41:10: error: use of undeclared identifier 'htobe16' return htobe16(host16); ^ /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:46:10: error: use of undeclared identifier 'be64toh' return be64toh(net64); ^ /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:51:10: error: use of undeclared identifier 'be32toh' return be32toh(net32); ^ /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/endian.h:56:10: error: use of undeclared identifier 'be16toh' return be16toh(net16); ^ In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/protorpc/RpcCodec.cc:13: In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/TcpConnection.h:23: In file included from /usr/local/include/boost/any.hpp:20: In file included from /usr/local/include/boost/type_index.hpp:29: In file included from /usr/local/include/boost/type_index/stl_type_index.hpp:47: In file included from /usr/local/include/boost/container_hash/hash.hpp:21: /usr/local/include/boost/container_hash/detail/hash_float.hpp:109:32: error: use of old-style cast [-Werror,-Wold-style-cast] return hash_binary((char*) &v, 4); ^ ~~ /usr/local/include/boost/container_hash/detail/hash_float.hpp:119:32: error: use of old-style cast [-Werror,-Wold-style-cast] return hash_binary((char*) &v, 8); ^ ~~ /usr/local/include/boost/container_hash/detail/hash_float.hpp:128:32: error: use of old-style cast [-Werror,-Wold-style-cast] return hash_binary((char*) &v, 10); ^ ~~ /usr/local/include/boost/container_hash/detail/hash_float.hpp:137:32: error: use of old-style cast [-Werror,-Wold-style-cast] return hash_binary((char*) &v, 16); ^ ~~ In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/protorpc/RpcCodec.cc:13: In file included from /Users/zhongrunkang/MySpace/MyGit/muduo/muduo/net/TcpConnection.h:23: In file included from /usr/local/include/boost/any.hpp:20: In file included from /usr/local/include/boost/type_index.hpp:29: In file included from /usr/local/include/boost/type_index/stl_type_index.hpp:47: /usr/local/include/boost/container_hash/hash.hpp:282:26: error: use of old-style cast [-Werror,-Wold-style-cast] seed ^= (std::size_t) (positive >> i) + (seed<<6) + (seed>>2); ^ ~~~~~~~~~~~~~~~ /usr/local/include/boost/container_hash/hash.hpp:284:22: error: use of old-style cast [-Werror,-Wold-style-cast] seed ^= (std::size_t) val + (seed<<6) + (seed>>2); ^ ~~~ /usr/local/include/boost/container_hash/hash.hpp:302:26: error: use of old-style cast [-Werror,-Wold-style-cast] seed ^= (std::size_t) (val >> i) + (seed<<6) + (seed>>2); ^ ~~~~~~~~~~ /usr/local/include/boost/container_hash/hash.hpp:304:22: error: use of old-style cast [-Werror,-Wold-style-cast] seed ^= (std::size_t) val + (seed<<6) + (seed>>2); ^ ~~~ 16 errors generated. make[2]: *** [muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/RpcCodec.cc.o] Error 1 make[1]: *** [muduo/net/protorpc/CMakeFiles/muduo_protorpc_wire.dir/all] Error 2 make: *** [all] Error 2

closed time in a month

kangzr

issue commentchenshuo/muduo

Mac 编译出错,求看

MAC is not supported.

kangzr

comment created time in a month

push eventchenshuo/muduo

OjackstevensonO

commit sha 6a4da5bef3ae7ed6b749b198e6a691d4c0a3c7a4

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.

view details

push time in a month

PR merged chenshuo/muduo

fix a small 'build fail' issue caused by the deprecation of ByteSize() of protobuf message

Hi maintainers, I use muduo/cpp17 and protobuf/cpp to do some personal projects recently. But build fail when compiling with lasted version's protobuf (3.11.2). I think the reason may be that '-Werror' parameter is enabled by default in muduo's make related files and ByteSize() API of protobuf message is deprecated in new version of protobuf, which will result in a warning in building. So there are some errors in building process. Although It is just a small issue, but I am still tried to fix it for fun. Thank you so much for your great works on muduo! : )

Details are list as following: ----------------------------------------START---------------------------------------------- Deprecation of ByteSize() may from protobuf 3.11.0 Ref: line 578 at https://github.com/protocolbuffers/protobuf/blob/master/CHANGES.txt (de75651 on 21 Nov)

Test platform: Ubuntu WSL in windows 10 1903 Protocol Buffers 3.11.2 / cpp

$gcc -v Thread model: posix gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)

$cat /proc/version Linux version 4.4.0-18362-Microsoft (Microsoft@Microsoft.com) (gcc version 5.4.0 (GCC) ) #476-Microsoft Fri Nov 01 16:53:00 PST 2019

$lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 18.04.2 LTS Release: 18.04 Codename: bionic

Protocol Buffers Test Result:

PASS: protobuf-test PASS: protobuf-lazy-descriptor-test PASS: protobuf-lite-test PASS: google/protobuf/compiler/zip_output_unittest.sh PASS: protobuf-lite-arena-test PASS: no-warning-test Testsuite summary for Protocol Buffers 3.11.2 TOTAL: 6 PASS: 6 SKIP: 0 XFAIL: 0 FAIL: 0 XPASS: 0 ERROR: 0

Output of "./build.sh": /home/***/temp/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:114:36: error: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Werror=deprecated-declarations] int byte_size = message.ByteSize(); ^ In file included from /usr/local/include/google/protobuf/generated_enum_util.h:36:0, from /usr/local/include/google/protobuf/generated_enum_reflection.h:44, from /usr/local/include/google/protobuf/generated_message_reflection.h:48, from /usr/local/include/google/protobuf/message.h:122, from /home/***/temp/muduo/muduo/net/protorpc/google-inl.h:39, from /home/***/temp/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:15: /usr/local/include/google/protobuf/message_lite.h:402:7: note: declared here int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); } ^~~~~~~~ /home/***/temp/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:121:58: error: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Werror=deprecated-declarations] ByteSizeConsistencyError(byte_size, message.ByteSize(), static_cast<int>(end - start)); ^ In file included from /usr/local/include/google/protobuf/generated_enum_util.h:36:0, from /usr/local/include/google/protobuf/generated_enum_reflection.h:44, from /usr/local/include/google/protobuf/generated_message_reflection.h:48, from /usr/local/include/google/protobuf/message.h:122, from /home/***/temp/muduo/muduo/net/protorpc/google-inl.h:39, from /home/***/temp/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:15: /usr/local/include/google/protobuf/message_lite.h:402:7: note: declared here int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); } ^~~~~~~~ cc1plus: all warnings being treated as errors muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/build.make:62: recipe for target 'muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/ProtobufCodecLite.cc.o' failed make[2]: *** [muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/ProtobufCodecLite.cc.o] Error 1 CMakeFiles/Makefile2:1776: recipe for target 'muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/all' failed make[1]: *** [muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2

/home/**/temp/muduo/examples/protobuf/codec/codec.cc: In static member function ‘static void ProtobufCodec::fillEmptyBuffer(muduo::net::Buffer, const google::protobuf::Message&)’: /home/***/temp/muduo/examples/protobuf/codec/codec.cc:35:36: error: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Werror=deprecated-declarations] int byte_size = message.ByteSize(); ^ In file included from /usr/local/include/google/protobuf/generated_enum_util.h:36:0, from /usr/local/include/google/protobuf/generated_enum_reflection.h:44, from /usr/local/include/google/protobuf/generated_message_reflection.h:48, from /usr/local/include/google/protobuf/message.h:122, from /home/***/temp/muduo/examples/protobuf/codec/codec.h:15, from /home/***/temp/muduo/examples/protobuf/codec/codec.cc:9: /usr/local/include/google/protobuf/message_lite.h:402:7: note: declared here int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); } ^~~~~~~~ /home/***/temp/muduo/examples/protobuf/codec/codec.cc:42:58: error: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Werror=deprecated-declarations] ByteSizeConsistencyError(byte_size, message.ByteSize(), static_cast<int>(end - start)); ^ In file included from /usr/local/include/google/protobuf/generated_enum_util.h:36:0, from /usr/local/include/google/protobuf/generated_enum_reflection.h:44, from /usr/local/include/google/protobuf/generated_message_reflection.h:48, from /usr/local/include/google/protobuf/message.h:122, from /home/***/temp/muduo/examples/protobuf/codec/codec.h:15, from /home/***/temp/muduo/examples/protobuf/codec/codec.cc:9: /usr/local/include/google/protobuf/message_lite.h:402:7: note: declared here int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); } ^~~~~~~~ cc1plus: all warnings being treated as errors examples/protobuf/codec/CMakeFiles/protobuf_codec.dir/build.make:62: recipe for target 'examples/protobuf/codec/CMakeFiles/protobuf_codec.dir/codec.cc.o' failed make[2]: *** [examples/protobuf/codec/CMakeFiles/protobuf_codec.dir/codec.cc.o] Error 1 CMakeFiles/Makefile2:5557: recipe for target 'examples/protobuf/codec/CMakeFiles/protobuf_codec.dir/all' failed make[1]: *** [examples/protobuf/codec/CMakeFiles/protobuf_codec.dir/all] Error 2 Makefile:140: recipe for target 'all' failed make: *** [all] Error 2

---------------------------------------END-----------------------------------------------

+38 -4

2 comments

2 changed files

OjackstevensonO

pr closed time in a month

pull request commentchenshuo/muduo

fix a small 'build fail' issue caused by the deprecation of ByteSize() of protobuf message

Unfortunately, ByteSizeLong() is not available in lower versions of protobuf, so the continuous build fails. You may need to wrap it with #if / #endif.

OjackstevensonO

comment created time in 2 months

issue closedchenshuo/muduo

code wrong

path:muduo/base/noncopyable.h change:const noncopyable& operator=(const noncopyable&) = delete;

closed time in 2 months

yk0211

issue commentchenshuo/muduo

code wrong

It is correct.

yk0211

comment created time in 2 months

created tagchenshuo/muduo

tagv2.0.1

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

created time in 2 months

issue closedchenshuo/muduo

编译错误

[ 33%] Building CXX object muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/ProtobufCodecLite.cc.o /root/home/muduo/muduo/net/protobuf/ProtobufCodecLite.cc: In member function ‘virtual int muduo::net::ProtobufCodecLite::serializeToBuffer(const google::protobuf::Message&, muduo::net::Buffer*)’: /root/home/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:114:36: error: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Werror=deprecated-declarations] int byte_size = message.ByteSize(); ^ In file included from /usr/local/include/google/protobuf/generated_enum_util.h:36:0, from /usr/local/include/google/protobuf/generated_enum_reflection.h:44, from /usr/local/include/google/protobuf/generated_message_reflection.h:48, from /usr/local/include/google/protobuf/message.h:122, from /root/home/muduo/muduo/net/protorpc/google-inl.h:39, from /root/home/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:15: /usr/local/include/google/protobuf/message_lite.h:402:7: note: declared here int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); } ^ /root/home/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:121:58: error: ‘int google::protobuf::MessageLite::ByteSize() const’ is deprecated: Please use ByteSizeLong() instead [-Werror=deprecated-declarations] ByteSizeConsistencyError(byte_size, message.ByteSize(), static_cast<int>(end - star ^ In file included from /usr/local/include/google/protobuf/generated_enum_util.h:36:0, from /usr/local/include/google/protobuf/generated_enum_reflection.h:44, from /usr/local/include/google/protobuf/generated_message_reflection.h:48, from /usr/local/include/google/protobuf/message.h:122, from /root/home/muduo/muduo/net/protorpc/google-inl.h:39, from /root/home/muduo/muduo/net/protobuf/ProtobufCodecLite.cc:15: /usr/local/include/google/protobuf/message_lite.h:402:7: note: declared here int ByteSize() const { return internal::ToIntSize(ByteSizeLong()); } ^ cc1plus: all warnings being treated as errors muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/build.make:62: recipe for target 'muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/ProtobufCodecLite.cc.o' failed make[2]: *** [muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/ProtobufCodecLite.cc.o] Error 1 CMakeFiles/Makefile2:1976: recipe for target 'muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/all' failed make[1]: *** [muduo/net/protobuf/CMakeFiles/muduo_protobuf_codec.dir/all] Error 2 Makefile:138: recipe for target 'all' failed make: *** [all] Error 2

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

Ubuntu16.04 x86_64 64-bit

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

master

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

cmake version 3.5.1 gcc 5.4.0 libboost1.58-dev:amd64

closed time in 2 months

eclair-lumiere

issue commentchenshuo/muduo

boost version is wrong.

Try boost 1.69 or below, get_io_service() was removed in 1.70.0.

https://github.com/boostorg/asio/blob/95f7e936356810addf3a6b54dbd1129d10f3ba98/doc/history.qbk#L153

eternally123

comment created time in 2 months

issue closedchenshuo/muduo

Log and thread mix,advice to adjust some functions

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 2 months

lzx2017lzx

issue closedchenshuo/muduo

编译muduo库时报boost错误

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

Linux version 3.10.0-327.el7.x86_64 x86 64-bit

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

cpp11 muduo-2.0.0

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

cmake: 3.3.2 gcc: 4.8.5 boost: boost_1_71_0

准备在项目中使用muduo库,希望能尽快解答,非常感谢。 1. /home/zz/lib/boost_1_71_0/boost/concept/detail/has_constraints.hpp:44:58: error: use of old-style cast [-Werror=old-style-cast] , value = sizeof( detail::has_constraints_((Model*)0) ) == sizeof(detail::yes) );

/home/lj/lib/boost_1_71_0/boost/circular_buffer/base.hpp:1023:5: error: declaration of ‘alloc’ shadows a member of 'this' [-Werror=shadow] : base(boost::empty_init_t(), alloc), m_buff(0), m_end(0), m_first(0), m_last(0), m_size(0) {}

closed time in 2 months

liujiejie

issue closedchenshuo/muduo

编译muduo时报找不到protobuf

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

Linux 64

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

cpp11

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

[xx@local muduo-2.0.0]$ echo $PROTOBUF_INCLUDE_DIR /home/xx/lib/protobuf-3.10.1/release/include/ [xx@local muduo-2.0.0]$ echo^C [xx@local muduo-2.0.0]$ echo $PROTOBUF_LIBRARY /home/xx/lib/protobuf-3.10.1/release/lib/

`[@local muduo-2.0.0]$ ./build.sh protobuf_all ++ pwd

  • SOURCE_DIR=/home/xx/lib/muduo-2.0.0
  • BUILD_DIR=../build
  • BUILD_TYPE=release
  • INSTALL_DIR=../release-install-cpp11
  • CXX=g++
  • ln -sf ../build/release-cpp11/compile_commands.json
  • mkdir -p ../build/release-cpp11
  • cd ../build/release-cpp11
  • cmake -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=../release-install-cpp11 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /home/lj/lib/muduo-2.0.0 -- Boost version: 1.71.0 -- Could NOT find PROTOBUF (missing: PROTOBUF_LIBRARY PROTOBUF_INCLUDE_DIR) -- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) -- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) -- CXX_FLAGS = -DCHECK_PTHREAD_RETURN_VALUE -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Werror -Wno-unused-parameter -Woverloaded-virtual -Wpointer-arith -Wwrite-strings -march=native -std=c++11 -rdynamic -O2 -DNDEBUG -- Configuring done -- Generating done -- Build files have been written to: /home/lj/lib/build/release-cpp11
  • make protobuf_all make: *** No rule to make target protobuf_all'. Stop.

已经指定了protobuf的目录,但是编译muduo还是会报找不到protobuf,这是什么原因啊??

closed time in 2 months

liujiejie

issue commentchenshuo/muduo

Log and thread mix,advice to adjust some functions

What does this issue differ from #426 ? What's your advice?

lzx2017lzx

comment created time in 2 months

issue closedchenshuo/muduo

一次收到消息太多,导致Buffer结构不断拷贝扩大,使服务短暂停止

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?

Linux

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

cpp11

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

boost:1.71

你好,我在实际使用muduo的过程中,有这样一个场景: 1.客户端,往服务端不断发送512字节数据,并从服务端收响应,确认服务端收到多少条消息。 2.服务端,从客户端收消息,每获取一次消息,按消息大小获取当前收到多少条消息,然后把这个消息条数返回给客户端。 问题是,当服务端收到的数据量太大,Buffer结构会不断拷贝扩大,使服务短暂停止,也会导致客户端一段时间收不到服务端的响应。以下是客户端收到消息的响应,最后几条,20多秒才收到响应,RECV 关键字后面跟的是收到响应消息的条数。 server.cpp:

void onMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp) { LOG_WARN << "begin "; size_t recv_size = buf->readableBytes(); int count = recv_size / 128; recv_msg_count += count; return_index_str.appendInt64(recv_msg_count); conn->send(&return_index_str);

buf->retrieveAsString(128 * count);
LOG_WARN << "recv_msg_count " << recv_msg_count << " recv_size " << recv_size;

}

client.cpp: void* SyncDataThread(void* arg) { std::string message; for (int i = 0; i < 128; ++i) { message.push_back(static_cast<char>(47)); }

ThreadData* thread_data = (ThreadData*)arg;
while (run_g)
{
	thread_data->conn->send(message);
}

return NULL;

} void onMessage(const TcpConnectionPtr& conn, Buffer* buf, Timestamp time) { size_t recv_size = buf->readableBytes(); int count = recv_size / 8; int read_index = count * 8 - 8; if (read_index > 0) { buf->retrieve(read_index); int64_t current_index = buf->readInt64(); LOG_INFO << "onMessage RECV " << current_index; } }

会出现: 20191128 08:33:05.447646Z 2791 WARN begin - server.cpp:31 20191128 08:33:05.447653Z 2791 WARN recv_msg_count 2533178 recv_size 21796 - server.cpp:47 20191128 08:33:10.485236Z 2791 WARN begin - server.cpp:31 20191128 08:33:10.485300Z 2791 WARN recv_msg_count 2534171 recv_size 127104 - server.cpp:47

如果我把server的LOG_WARN删掉了就会出现: 20191128 07:09:13.081419Z 6365 INFO onMessage RECV 900491321 - client.cpp:109 20191128 07:09:13.094496Z 6365 INFO onMessage RECV 930739343 - client.cpp:109 20191128 07:09:13.128861Z 6365 INFO onMessage RECV 989184792 - client.cpp:109 20191128 07:09:13.237572Z 6365 INFO onMessage RECV 1175997802 - client.cpp:109 20191128 07:09:13.512062Z 6365 INFO onMessage RECV 1705829539 - client.cpp:109 20191128 07:09:14.196504Z 6365 INFO onMessage RECV 3632626542 - client.cpp:109 20191128 07:09:16.291605Z 6365 INFO onMessage RECV 9913869110 - client.cpp:109 20191128 07:09:20.893491Z 6365 INFO onMessage RECV 18108680633 - client.cpp:109 20191128 07:09:30.928978Z 6365 INFO onMessage RECV 27940861681 - client.cpp:109 20191128 07:09:52.150305Z 6365 INFO onMessage RECV 39357650013 - client.cpp:109

我想要的效果是每一秒中,都会有很多响应回来,请问这个要怎么修改下呢?

closed time in 2 months

liujiejie

issue closedchenshuo/muduo

log and thread coupling much,adjust some function whould be appreciate

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 2 months

lzx2017lzx

issue commentchenshuo/muduo

log and thread coupling much,adjust some function whould be appreciate

Closed as unclear question.

lzx2017lzx

comment created time in 2 months

push eventchenshuo/muduo

Subenlele

commit sha 0edc4c9ddfaeecbede71229673eefc48bcb6fe8c

remove redundant semicolon ';' remove redundant semicolon ';'

view details

zhyncs

commit sha 0f3cb975510ea11d984f0fb03c8f5ea776c64f3a

fix: remove redundant std::move for a local object in a return statement

view details

push time in 2 months

push eventchenshuo/muduo

Shuo Chen

commit sha 2b91f68d638334c02830ea21fcb2f7ee6463d7e4

update README.md

view details

push time in 2 months

push eventchenshuo/muduo

Shuo Chen

commit sha a96eeeed28b00af6774e68daa9c0dea08393f06f

Set theme jekyll-theme-slate

view details

Shuo Chen

commit sha 1fed96d724d92bd080fabfba40b5fbc77fb40436

add README.md

view details

push time in 2 months

issue closedchenshuo/muduo

后期会添加数据库方面的东西么

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 2 months

upckz

issue commentchenshuo/muduo

后期会添加数据库方面的东西么

This is very unprofessional.

upckz

comment created time in 2 months

push eventchenshuo/muduo

Shuo Chen

commit sha 04445ac4b2e2698fe9a6b73d279edf052c468914

Set theme jekyll-theme-slate

view details

push time in 2 months

push eventchenshuo/practical-network-programming

Shuo Chen

commit sha 82d9008dedac6249ac75dffcfb98a827b6639fd2

update link

view details

push time in 3 months

issue commentchenshuo/muduo

一次收到消息太多,导致Buffer结构不断拷贝扩大,使服务短暂停止

采用 Non-blocking IO 的 client 是不能用一个 white(true) 循环来不停地发送消息,你要么在收到 server 的响应之后发送下一批消息,要么用 high water mark callback 在本地发送缓冲区清空之后发送下一批消息。

liujiejie

comment created time in 3 months

push eventchenshuo/muduo

zhyncs

commit sha 0f3cb975510ea11d984f0fb03c8f5ea776c64f3a

fix: remove redundant std::move for a local object in a return statement

view details

push time in 3 months

issue closedchenshuo/muduo

BoundedBlockingQueue.h moving a local object in a return statement prevents copy elision

distro

Ubuntu 19.10 Desktop

gcc

9.2.1

cmake

3.13.4

libboost-dev

1.67.0.2

muduo

master branch HEAD 0edc4c

BUILD ERROR

++ pwd
+ SOURCE_DIR=/home/zhyncs/Documents/muduo
+ BUILD_DIR=../build
+ BUILD_TYPE=release
+ INSTALL_DIR=../release-install-cpp11
+ CXX=g++
+ ln -sf ../build/release-cpp11/compile_commands.json
+ mkdir -p ../build/release-cpp11
+ cd ../build/release-cpp11
+ cmake -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX=../release-install-cpp11 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON /home/zhyncs/Documents/muduo
-- The C compiler identification is GNU 9.2.1
-- The CXX compiler identification is GNU 9.2.1
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Boost version: 1.67.0
-- Could NOT find Protobuf (missing: Protobuf_INCLUDE_DIR) 
-- Could NOT find CURL (missing: CURL_LIBRARY CURL_INCLUDE_DIR) 
-- Could NOT find ZLIB (missing: ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
-- CXX_FLAGS = -g -DCHECK_PTHREAD_RETURN_VALUE -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Werror -Wconversion -Wno-unused-parameter -Wold-style-cast -Woverloaded-virtual -Wpointer-arith -Wshadow -Wwrite-strings -march=native -std=c++11 -rdynamic -O2 -DNDEBUG
-- Looking for accept4
-- Looking for accept4 - found
-- Configuring done
-- Generating done
-- Build files have been written to: /home/zhyncs/Documents/build/release-cpp11
+ make
Scanning dependencies of target muduo_base
[  1%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/AsyncLogging.cc.o
[  1%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/Condition.cc.o
[  1%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/CountDownLatch.cc.o
[  1%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/CurrentThread.cc.o
[  2%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/Date.cc.o
[  2%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/Exception.cc.o
[  2%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/FileUtil.cc.o
[  3%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/LogFile.cc.o
[  3%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/Logging.cc.o
[  3%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/LogStream.cc.o
[  3%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/ProcessInfo.cc.o
[  5%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/Timestamp.cc.o
[  5%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/Thread.cc.o
[  5%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/ThreadPool.cc.o
[  6%] Building CXX object muduo/base/CMakeFiles/muduo_base.dir/TimeZone.cc.o
[  6%] Linking CXX static library ../../lib/libmuduo_base.a
[  6%] Built target muduo_base
Scanning dependencies of target logging_test
[  6%] Building CXX object muduo/base/tests/CMakeFiles/logging_test.dir/Logging_test.cc.o
[  6%] Linking CXX executable ../../../bin/logging_test
[  6%] Built target logging_test
Scanning dependencies of target logfile_test
[  6%] Building CXX object muduo/base/tests/CMakeFiles/logfile_test.dir/LogFile_test.cc.o
[  7%] Linking CXX executable ../../../bin/logfile_test
[  7%] Built target logfile_test
Scanning dependencies of target processinfo_test
[  7%] Building CXX object muduo/base/tests/CMakeFiles/processinfo_test.dir/ProcessInfo_test.cc.o
[  8%] Linking CXX executable ../../../bin/processinfo_test
[  8%] Built target processinfo_test
Scanning dependencies of target date_unittest
[  8%] Building CXX object muduo/base/tests/CMakeFiles/date_unittest.dir/Date_unittest.cc.o
[  8%] Linking CXX executable ../../../bin/date_unittest
[  8%] Built target date_unittest
Scanning dependencies of target boundedblockingqueue_test
[ 10%] Building CXX object muduo/base/tests/CMakeFiles/boundedblockingqueue_test.dir/BoundedBlockingQueue_test.cc.o
In file included from /home/zhyncs/Documents/muduo/muduo/base/tests/BoundedBlockingQueue_test.cc:1:
/home/zhyncs/Documents/muduo/muduo/base/BoundedBlockingQueue.h: In instantiation of ‘T muduo::BoundedBlockingQueue<T>::take() [with T = std::__cxx11::basic_string<char>]’:
/home/zhyncs/Documents/muduo/muduo/base/tests/BoundedBlockingQueue_test.cc:71:33:   required from here
/home/zhyncs/Documents/muduo/muduo/base/BoundedBlockingQueue.h:65:27: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
   65 |     return std::move(front);
      |                           ^
/home/zhyncs/Documents/muduo/muduo/base/BoundedBlockingQueue.h:65:27: note: remove ‘std::move’ call
/home/zhyncs/Documents/muduo/muduo/base/BoundedBlockingQueue.h: In instantiation of ‘T muduo::BoundedBlockingQueue<T>::take() [with T = std::unique_ptr<int>]’:
/home/zhyncs/Documents/muduo/muduo/base/tests/BoundedBlockingQueue_test.cc:91:39:   required from here
/home/zhyncs/Documents/muduo/muduo/base/BoundedBlockingQueue.h:65:27: error: moving a local object in a return statement prevents copy elision [-Werror=pessimizing-move]
/home/zhyncs/Documents/muduo/muduo/base/BoundedBlockingQueue.h:65:27: note: remove ‘std::move’ call
cc1plus: all warnings being treated as errors
make[2]: *** [muduo/base/tests/CMakeFiles/boundedblockingqueue_test.dir/build.make:63: muduo/base/tests/CMakeFiles/boundedblockingqueue_test.dir/BoundedBlockingQueue_test.cc.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:340: muduo/base/tests/CMakeFiles/boundedblockingqueue_test.dir/all] Error 2
make: *** [Makefile:141: all] Error 2

closed time in 3 months

zhyncs

issue commentchenshuo/muduo

一次收到消息太多,导致Buffer结构不断拷贝扩大,使服务短暂停止

你说的“每秒发10w都发不了”是指 client 还是 server? “数据发不出去,堵住占用内存”是指占 client 内存还是 server 内存?

你前面说“问题是,当服务端收到的数据量太大,Buffer结构会不断拷贝扩大,使服务短暂停止”,是说 server 的内存占用太多?后面又说 client 数据发不出去,占用太多 client 内存?我完全看糊涂了。

liujiejie

comment created time in 3 months

issue commentchenshuo/muduo

Optimize: Reduce one copy in setReadCallback

If you change the parameter to ReadEventCallback&, it will break use case like

channel->setReadCallback(std::bind(&ThisClass::onMessage, this, _1, _2, _3));
hankai17

comment created time in 3 months

issue commentchenshuo/muduo

一次收到消息太多,导致Buffer结构不断拷贝扩大,使服务短暂停止

“把server的LOG_WARN删掉”为什么会影响程序的行为?

liujiejie

comment created time in 3 months

issue commentchenshuo/muduo

一次收到消息太多,导致Buffer结构不断拷贝扩大,使服务短暂停止

你什么时候在 Server 端调用 Buffer::retrieve() ?

liujiejie

comment created time in 3 months

issue commentchenshuo/muduo

Compile error

Try deleting release-cpp11/ and rebuild. You probably upgraded protobuf but didn't re-generate .pb.cc files.

hardway2008

comment created time in 3 months

issue commentchenshuo/muduo

bazel build failure with llvm

Try include time.h in Date.cc

wangsu502

comment created time in 3 months

issue closedchenshuo/muduo

old-style

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 4 months

txkgithub

issue closedchenshuo/muduo

formatSI and formatIEC

dose formatSI and formatIEC method of LogStream have any use in the current version of muduo?

closed time in 4 months

jxq96

issue commentchenshuo/muduo

多个TcpServer共享EventLoopThreadPool问题

欢迎提 pull request。

chenyahui

comment created time in 4 months

issue commentchenshuo/muduo

TcpConnection::send中关于std::bind和StringPiece的问题

我想问的是bind保存的是一个怎样的拷贝,是string还是stringpiece

如果有人告诉你答案,你有办法验证他说的是对还是错吗?

zshorz

comment created time in 4 months

issue commentchenshuo/muduo

编译错误

Change ByteSize() to ByteSizeLong() if your protobuf library is too new.

eclair-lumiere

comment created time in 4 months

push eventchenshuo/muduo-tutorial

Sebastian Bergt

commit sha d7b76eded2139ecea9dcfc0996c461b0f58cd144

Update to bazel 1.0.0 (#4) * Update bazel WORKSPACE for bazel 1.0.0 how to add a remote repository changed in bazel in the last months. * changed link to work with original authors repo

view details

push time in 4 months

PR closed chenshuo/muduo

add some Chinese document

Add some Chinese documents.

+197 -0

1 comment

10 changed files

Dwyane05

pr closed time in 5 months

issue commentchenshuo/muduo

安装问题

Please answer the questions in the template:

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.)

beastsam

comment created time in 5 months

issue commentchenshuo/muduo

为什么需要Boost 库

Use cpp17 branch if you don't want boost.

githublaohu

comment created time in 5 months

issue commentchenshuo/muduo

EventLoopThread.cc中条件变量wait和notify的顺序好像并没有保障

This is not a bug.

zshorz

comment created time in 5 months

push eventchenshuo/notes

Shuo Chen

commit sha 580c21317d34849966f098d2474a242c6588a200

add video for fft basis.

view details

push time in 5 months

push eventchenshuo/notes

Shuo Chen

commit sha ddbfd3788fdff9b43285af1d6035ed30324ece51

Deployed 179d800 with MkDocs version: 1.0.4

view details

push time in 5 months

push eventchenshuo/notes

Shuo Chen

commit sha 179d800dc661bf2b699772ed24548faa287c8aed

add video for fft basis.

view details

push time in 5 months

push eventchenshuo/notes

Shuo Chen

commit sha 3dfd0e3bc87b1d271e0698cc069272d2fbd42d92

Deployed 179d800 with MkDocs version: 1.0.4

view details

push time in 5 months

push eventchenshuo/notes

Shuo Chen

commit sha 3a993ee470cd71fb5fd81c594b5d436a273e566c

Deployed 02ca5da with MkDocs version: 1.0.4

view details

push time in 5 months

push eventchenshuo/notes

Shuo Chen

commit sha 02ca5da94d76c914c2504860e0abd1a9e13431c6

update for kernel 4.12

view details

push time in 5 months

more