Git Product home page Git Product logo

acl-dev / acl Goto Github PK

View Code? Open in Web Editor NEW
2.8K 212.0 926.0 120.14 MB

C/C++ server and network library, including coroutine,redis client,http/https/websocket,mqtt, mysql/postgresql/sqlite client with C/C++ for Linux, Android, iOS, MacOS, Windows, etc..

Home Page: https://acl-dev.cn

License: GNU Lesser General Public License v3.0

Makefile 1.41% C 55.94% HTML 12.99% CSS 0.04% Java 0.12% C++ 26.88% Shell 0.33% Inno Setup 0.03% Objective-C 0.04% JavaScript 0.72% CMake 0.19% Roff 0.01% Objective-C++ 0.01% Lua 0.03% Assembly 1.19% Python 0.02% Starlark 0.05% TypeScript 0.01% Batchfile 0.01%
coroutine database fiber http-client http-server mqtt-client mqtt-protocol network redis-client smtp

acl's People

Contributors

akzi avatar artamonovevgenii avatar lday0321 avatar loongs-zhang avatar markmeson avatar meihouhao2017 avatar moehuster avatar popsky avatar qazwsxedckll avatar sidyhe avatar soratakasugano avatar waruqi avatar wfeii1980 avatar wkliu19 avatar woodlyer avatar xiaoqiang0 avatar xuchunyang avatar zhengshuxin avatar

Stargazers

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

Watchers

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

acl's Issues

redis cluster client core in acl

We used acl as clients to visit our redis cluster but in the performance test, we got segment fault and the stack trace is as follwoing.
#0 0x0000000000602c7b in acl::redis_client_cluster::set_slot (this=0x1e2cf10, slot=14780,

addr=0x20 <Address 0x20 out of bounds>) at src/redis/redis_client_cluster.cpp:88

#1 0x0000000000608b86 in acl::redis_command::run (this=0x7f81315ec500, cluster=0x1e2cf10, nchild=0)

at src/redis/redis_command.cpp:448

#2 0x000000000060932b in acl::redis_command::get_number (this=, success=0x0)

at src/redis/redis_command.cpp:603

It seems that the argument addr passed to set_slot is invalid. Our program runs in multi-thread environment, not sure if this is related.

Thanks.

[redis][renamenx] check please

os : windows 10
version : 3.4.1

In Redis, 'rename' command returns simple_string and 'renamenx' command returns integer value. But In ACL Library, both of 'rename' and 'renamenx' function return the value of bool type.
is this correct? I think that 'renamenx' function should return interger value.

build error LNK2001: unresolved external symbol "public: virtual __thiscall acl::string::~string(void)"

should be acl version 87, 修改历史列表:--87) 2015.5.21


source code in error:

const char* cmd = "ZREM"; 
std::vector<acl::string> args;
m_transaction.clear();
args.clear();

cmd = "ZREM";
args.push_back(GlobalRedisKeys::Instance()->m_key_zsetRegion.c_str());
args.push_back(cross_region_key.c_str());
if (m_transaction.run_cmd(cmd, args) == false) { //remove from  zset
    ROOT_LOGGER->error("redis: run cmd error! cmd: ZREM " + GlobalRedisKeys::Instance()->m_key_zsetRegion);
    return false;
}

ERROR:

RMBussinessLogic.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall acl::string::~string(void)" (??1string@acl@@UAE@XZ)

hgetall

Hey,
I have to include method for hgetall in your sample file "redis_client_cluster.cpp". How should I do?

Ignore more Irrelevant files

The repo is about 106M:

➜  acl git:(master) du -sh
106M    .

I think It's unnecessary to let Git to track library files, i.e. *.dll for WIN, *.a" for Linux, and in addition IDE specific project configure files like acl_vc2003.sln should be ignored too.

release acl-acl.3.4.0.rc3 windows vs2013 acl_cpp动态库编译失败

acl 和protocol 编译正常, 但是在编译acl_cpp 时出现了如下错误:

 正在创建库 C:/Users//Desktop/cppredis/acl-acl.3.4.0.rc3/mybuild/lib/Release/acl_cpp.lib 和对象 C:/Users/Desktop/cppredis/acl-acl.3.4.0.rc3/mybuild/lib/Release/acl_cpp.exp
3>stdin_stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>stdout_stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>win_iconv.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>polarssl_conf.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>polarssl_io.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>server_socket.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>socket_stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>ifstream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>istream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>ofstream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>ostream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>aio_stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>aio_timer_callback.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>aio_timer_delay_free.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>fstream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>aio_istream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>aio_listen_stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>aio_ostream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>aio_socket_stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)
3>zlib_stream.obj : error LNK2001: 无法解析的外部符号 "public: virtual bool __thiscall acl::db_mysql::rollback(void)" (?rollback@db_mysql@acl@@UAE_NXZ)

链接器附加依赖库acl和protocol都已添加
预处理器定义也未改动

WIN32
_WINDOWS
NDEBUG
ACL_WRITEABLE_CHECK
ACL_PREPARE_COMPILE
CMAKE_INTDIR="Release"
protocol_EXPORTS

是我这里配置还有什么问题吗 我是用cmake 生成的解决方案。直接用工程里面的解决方案acl_cpp也有同样的问题。

redis:subscribe接口导致程序崩溃bug

//redis.subscribe多运行几次,必现
redis_pubsub::subop
{
const char** argv = (const char**) dbuf_->dbuf_alloc(argc * sizeof(char*));
...略略略...
run{!!!may free argv}
check_channel(argv[0]) //argv已被free导致程序崩溃
}
最开始run里面不会清楚内存池,会导致内存泄露
后续加了,这个波及到了

redis_list::lpop & rpop返回值与头文件中的注释不符

acl::redis_list command;
redis.set_cluster(command);

int n = command.rpush("test_list", "value1", "value2", NULL);
EXPECT_EQ(n, 2);

acl::string str;
n = command.lpop("test_list", str);
EXPECT_EQ(n, 1);
EXPECT_EQ(str, "value1");

command.lpop返回值期望1,实际6。

File in repository triggered virus scan

Hi,

I'd like to raise your attention to a particular text file in your repository, which upon cloning, triggered my antivirus.
It appears to be a zip file encoded in base64 (attachment of that sample email).
If that file is decoded back into a zip file and then uncompressed, it appears to contain a trojan.

This is the file.

I hope this file can be scrubbed from the git history so that unsuspecting users will not accidentally unleash a trojan upon themselves.

redis sub redis.get_message read data error

代码如下

#include "acl_cpp/lib_acl.hpp"

int main(int argc, char * argv[])
{
    acl::acl_cpp_init();
    acl::log::stdout_open(true);


    acl::string redis_addr("127.0.0.1:6379");

    int  conn_timeout = 10, rw_timeout = 10;


    acl::redis_client client(redis_addr, conn_timeout, rw_timeout);

    acl::redis_pubsub redis;

    redis.set_client(&client);
    redis.clear();
    acl::string channel = "md";
    redis.subscribe(channel,NULL);

    acl::string msg;

    channel.clear();
    msg.clear();
    redis.clear();

    while(true){
        if ((redis.get_message(channel, msg)) == false)
        {
            printf("get_message error(%s)\r\n",
                   redis.result_error());
            //return false;
        }
        else
        {
            printf("message: %s, channel: %s\r\n",
                   msg.c_str(), channel.c_str());
        }
    }


    return 0;
}

Windows10 Visual Studio 2017下编译出错

严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK1104 无法打开文件“lib_acl_vc2012d.lib” mime_qp E:\迅雷下载\acl-master\lib_acl_cpp\samples\mime\mime_qp\LINK 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK1104 无法打开文件“lib_acl_d.lib” HttpClient E:\迅雷下载\acl-master\lib_acl_cpp\samples\HttpClient\LINK 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK1104 无法打开文件“lib_acl_cpp_d.lib” win_dbservice E:\迅雷下载\acl-master\lib_acl_cpp\samples\win_dbservice\LINK 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK1104 无法打开文件“lib_acl_d.lib” winaio E:\迅雷下载\acl-master\lib_acl_cpp\samples\winaio\LINK 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 LNK1104 无法打开文件“polarssl.lib” ssl_client E:\迅雷下载\acl-master\lib_acl_cpp\samples\ssl\ssl_client\LINK 1
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C3848 具有类型“const server_ttl_comp”的表达式会丢失一些 const-volatile 限定符以调用“bool server_ttl_comp::operator ()(const server_ttl *,const server_ttl *)” dispatch_manager d:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\include\xutility 946
严重性 代码 说明 项目 文件 行 禁止显示状态
错误 C1189 #error: MFC does not support WINVER less than 0x0501. Please change the definition of WINVER in your project properties or precompiled header. winaio_vc2012 d:\program files (x86)\microsoft visual studio\2017\community\vc\tools\msvc\14.10.25017\atlmfc\include\afxv_w32.h 40

support mingw on windows?

I make lib_acl with mingw on windows there're compile errors.
so please support optional compilation with mingw on windows.

libfiber

libfiber不支持kqueue所以BSD环境下不能使用(比如mac)

ACL线程池acl_pthread_pool_t工作线程有阻塞和超时机制吗

线程池中的工作线程是否存在运行超时提前被强制结束的情形:
1.acl_pthread_pool_set_schedule_warn,如果设置了该值,线程调度时间超过此值仅仅是生成警告日志吗?会不会如题所述强制结束工作线程;
2.acl_pthread_pool_set_schedule_wait,该函数是否也跟如题所述问题有关?

Chinese messy code -- some source code files contains Chinese characters in ansi

/**
 * µ±ÈÎÎñ´¦ÀíÍê±Ï»ò³ö´íʱ£¬ÄÚ²¿´¦Àí¹ý³Ì»á×Ô¶¯µ÷Óà destroy ½Ó¿Ú£¬
 * ×ÓÀà¿ÉÒÔÔڸýӿÚÄÚ½øÐÐһЩÊͷŹý³Ì£¬ÓÈÆäµ±¸Ã¶ÔÏóÊǶ¯Ì¬´´½¨Ê±£¬
 * ×ÓÀàÓ¦¸ÃÔڸú¯ÊýÄÚ delete this ÒÔɾ³ý×Ô¼º£¬ÒòΪ¸Ãº¯Êý×îÖտ϶¨
 * »á±»µ÷Óã¬ËùÒÔ×ÓÀ಻ӦÔÚÆäËüµØ·½½øÐÐÎö¹¹²Ù×÷
 */

if set it to ansi, it will be messy code on another computer which using another language.

Crashed in brpoplpush

Report for xx.exe.4952.dmp
Type of Analysis Performed Crash Analysis
Machine Name
Operating System Windows Server 2008 Service Pack 2
Number Of Processors 4
Process ID 4952
Process Image
System Up-Time 00:00:00
Process Up-Time 1 day(s) 00:05:49

Thread 0 - System ID 5032

Full Call Stack

Function Arg 1 Arg 2 Arg 3 Arg 4 Source
ntdll!RtlReportCriticalFailure+5b c0000374 77a87350 0043f288 77a4be77
ntdll!RtlpReportHeapFailure+21 00000002 b123adaf 00512bc8 00512bd8
ntdll!RtlpLogHeapFailure+a1 00000003 004c0000 00512bd8 00000000
ntdll!RtlpCoalesceFreeBlocks+4b9 004c0000 00512bd8 0043f378 00000000
ntdll!RtlpFreeHeap+1e2 00512bc8 00512bd0 02afa5e8 00512bd0
ntdll!RtlFreeHeap+14e 004c0000 00000000 00512bc8 00000001
kernel32!FormatMessageA+1aa 00000000 00000000 000003e5 00000000
lib_acl!acl_strerror+29 000003e5 02afa5e8 00000080 02afa588
lib_acl!acl_vstream_init+1dc 0043f574 0043f484 00000000 0043f490
lib_acl!acl_vstream_read+92 02afa588 0043f4bf 00000001 0043f96c
lib_acl_cpp!acl::istream::read+75 0043f4bf 00000001 00000000 02b1eb08
lib_acl_cpp!acl::istream::read+1e 0043f4bf cccccccc cccccccc 2acccccc
lib_acl_cpp!acl::redis_client::get_redis_object+2c 009eb088 cccccccc 00cccccc 02b1eae8
lib_acl_cpp!acl::redis_client::run+15e 009eb088 009dbb28 00000000 0043f5a4
lib_acl_cpp!acl::redis_command::run+9c 00000000 cccccccc 0043f5a4 0043f574
lib_acl_cpp!acl::redis_command::get_string+21 0043f5f4 00000010 cccccccc cccc0032
lib_acl_cpp!acl::redis_list::brpoplpush+b7 009db9e8 009dba10 00000002 0043f5f4
! ::Listen+1be 02b1eae8 000000e8 000000f0 7c78d356 d:\scottgu\src\ \ .cpp @ 1686

协程收包与tcp抓包的顺序偶尔乱序

image
在不可重现的极端app弱网情况下,后端svr用多线程+协程的方式, while读取 socket_stream::read(buff, size), 出现抓到第一个包延迟10多秒才收到,并且抓到的第二个包协程先收到并处理, 出现app应用异常,
流量不大, 现在已经通过应用层sequence 来解决。 但是没有从根本上解决消息先后乱序的异常,是否协程调度有影响?
出现这种情况的条件是:app 发起第一个socket并请求,然后超时close socket,然后并重新发起socket连接。
结果是: 后端协程服务器并未按照次序接受,且第一次socket延迟10多秒才收到握手,求解。

acl::redis_client destructor

Calling the destructor on acl::redis_client crashes:


        const char* redis_addr = "127.0.0.1:6379";
    int conn_timeout = 10, rw_timeout = 10;

    // the redis client connection
    acl::redis_client *conn = new acl::redis_client(redis_addr, conn_timeout, rw_timeout);
    delete conn;

redis blpop 执行几次就必然crash

[New LWP 15714]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `./cici-server'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
106 ../sysdeps/x86_64/strlen.S: 没有那个文件或目录.
(gdb) bt
#0 strlen () at ../sysdeps/x86_64/strlen.S:106
#1 0x00007f8a24511672 in acl::redis_list::bpop (
this=this@entry=0x7ffeeb82d0f0, cmd=cmd@entry=0x7f8a245588cd "BLPOP",
keys=std::vector of length 12, capacity 16 = {...},
timeout=timeout@entry=1, result=...)
at /_dev/server/external/acl/lib_acl_cpp/src/redis/redis_list.cpp:372
#2 0x00007f8a24511765 in acl::redis_list::blpop (
this=this@entry=0x7ffeeb82d0f0,
keys=std::vector of length 12, capacity 16 = {...},
timeout=timeout@entry=1, result=...)
at /_dev/server/external/acl/lib_acl_cpp/src/redis/redis_list.cpp:319
#3 0x00007f8a2451187e in acl::redis_list::blpop (this=0x7ffeeb82d0f0,
result=..., timeout=1,
first_key=0x42e982 <typeinfo name for cici::ci_restful::start(cici::ci_conf&)::{lambda(int)#1}+34> "confEEUliE")
at /_dev/server/external/acl/lib_acl_cpp/src/redis/redis_list.cpp:313
#4 0x000000000041cb6d in cici::ci_service::start(cici::ci_conf&) ()
#5 0x00007f8a239aa150 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#6 0x00007f8a239aa160 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#7 0x9e8e2a78cdcc0900 in ?? ()
#8 0x00007f8a2545df80 in ?? ()
#9 0x00007f8a239a8f40 in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#10 0x00007ffeeb82d370 in ?? ()
---Type to continue, or q to quit---

Problems with psubscribe - suite

Following issue "Problems with psubscribe":

Thank you, but the bug is not fixed. psubscribe doesn't work now.
Before, in the redis monitor, I was seeing my command line "PSUBSCRIBE" "*".
Now, there is nothing in the monitor, it seems that the client does not send the request anymore on psubscribe.

Thank you

编译失败

/tmp/acl-master/lib_acl/src/stdlib/common/acl_hash.c:500:4: note: in expansion of macro ‘HASHC’
HASHC;
^~~~~
/tmp/acl-master/lib_acl/src/stdlib/common/acl_hash.c:501:2: note: here
case 3:
^~~~
/tmp/acl-master/lib_acl/src/stdlib/common/acl_hash.c:484:17: error: this statement may fall through [-Werror=implicit-fallthrough=]
#define HASHC n = *k++ + 65599 * n
~~^~~~~~~~~~~~~~~~~~

gcc --version
gcc (GCC) 8.1.1 20180531
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

在高版本clang/gcc中,需要加入-Wno-implicit-fallthrough

另外,这个文件涉及到中文注释是gbk编码的,最好还是转成utf-8比较好

在 lib_acl/Makefile 文件中有针对 gcc 版本的判断,如下:
ifeq ($(findstring gcc, $(CC)), gcc)
CFLAGS += -Wstrict-prototypes
GCC_VERSION=$(shell gcc --version | grep ^gcc | sed 's/^.* //g')
GCC_MAJOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f1)
GCC_MINOR:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f2)
GCC_SUB:=$(shell echo "$(GCC_VERSION)" | cut -d'.' -f3)
GCC_VER:=$(shell [ $(GCC_MAJOR) -gt 4 -o ( $(GCC_MAJOR) -eq 4 -a $(GCC_MINOR) -gt 4 ) ] && echo true)
ifeq ($(GCC_VER), true)
CFLAGS += -Wno-implicit-fallthrough
endif
endif

针对字符集编码问题,主要是为了兼容 VC,VC 针对 UTF8 要求得要有 BOM,所以目前暂时还是采用 GBK 编码,你可以使用一些工具,如 iconv 进行字符集转换

我用的cmake 。。可能这个和Makefile的配置还不太一样

cmake 也支持了,你可以试一下.

UDP 服务器 遇到 UDP连接请求导致停止服务

服务端是dgate 中,端口53, UDP 接收, 客户端采用HP-SOCKET 的TestEcho-UDP-Client.exe, 客户端发起UDP连接, dgate中 ret = recvfrom(fd, ......); 返回-1,UDP接收就失效,必须重启程序。
意味着简单的攻击就可以使UDP服务器挂掉。

Ubuntu 16.04 下编译失败

我在自己的项目中引入acl时,编译出错。
C++11, 在cmakelist文件里添加如下:

add_subdirectory(thirdparty/acl/lib_acl acl) add_subdirectory(thirdparty/acl/lib_protocol protocol) add_subdirectory(thirdparty/acl/lib_acl_cpp acl_cpp)

引入acl, protocol, acl_cpp三个库

然后链接到我的项目
target_link_libraries(.... acl protocol acl_cpp)

但是make的时候报错:
cd /home/machine1/tmp/myproject/build/test && /usr/bin/cmake -E cmake_link_script CMakeFiles/myproject-unittests.dir/link.txt --verbose=1 /usr/bin/c++ CMakeFiles/myproject-unittests.dir/main.cpp.o CMakeFiles/myproject-unittests.dir/worker/worker_unittest.cpp.o CMakeFiles/myproject-unittests.dir/worker/worker_manager_unittest.cpp.o -o ../../bin/myproject-unittests -rdynamic -lboost_date_time -lboost_chrono -lboost_filesystem -lboost_serialization -lboost_program_options -lboost_regex -lboost_system -lboost_thread -lpthread ../../lib/libgtest.a ../../lib/libgtest_main.a ../../lib/libgmock.a ../../lib/libgmock_main.a ../lib/libacl_cpp.so /usr/local/lib/libzmq.so /usr/local/lib/libczmq.so ../../lib/libgtest.a -lpthread ../lib/libprotocol.so ../lib/libacl.so -Wl,-rpath,/home/machine1/tmp/myproject/build/lib:/usr/local/lib ../lib/libacl_cpp.so: undefined reference to deflateInit2_'
../lib/libacl_cpp.so: undefined reference to deflate' ../lib/libacl_cpp.so: undefined reference to deflateEnd'
../lib/libacl_cpp.so: undefined reference to crc32' ../lib/libacl.so: undefined reference to dlopen'
../lib/libacl_cpp.so: undefined reference to inflate' ../lib/libacl_cpp.so: undefined reference to inflateInit2_'
../lib/libacl_cpp.so: undefined reference to inflateEnd' ../lib/libacl.so: undefined reference to dlclose'
../lib/libacl.so: undefined reference to dlerror' ../lib/libacl.so: undefined reference to dlsym'
collect2: error: ld returned 1 exit status`

在MacOS下一摸一样的代码可以正确编译使用,但是ubuntu系统下无法编译通过。
已经在3台MacOS电脑,3台Ubuntu16.04电脑下测试。

Problems with psubscribe

Hi,

I'm trying to use the following code and I am not receiving any of the published messages.
What's more the method publish() returns me 1 (as only one connection is listening to the channel).
Do you know why it's not working ? A bug or something wrong on my side ?
Many thanks

 // subscribe
    acl::redis_client connection(_redis_addr);
    acl::redis_pubsub sub(&connection);
    const char* pattern = "*";
    int out = sub.psubscribe(pattern, NULL);

    // then listen
    while(!_stop) {
      acl::string channel, message;
      if(sub.get_message(channel, message)) {
          do stuff ...
     }
  }

arm_v5t4_le-gcc交叉编译lib_acl的问题。

main函数使用 -acl的方式链接动态库 libacl.so。在libtool: link的时候出现
libacl.so: undefined reference to '__tync_lock_test_and_set_8'
libacl.so: undefined reference to '__sync_fetch_and_add_8'
libacl.so: undefined reference to '__sync_fetch_and_fetch_8'
但是使用-acl的方式链接静态库却没有出现上述错误。动态库有问题,静态库没有问题。

目前还没找到解决办法。麻烦帮忙看一下大概有什么解决方法。

acl::string.format("%u", uint64) issue

Boost::uint64_t timeInMs=1446202713817;
acl::string recvTimeInMilliSec;
recvTimeInMilliSec.format("%u", timeInMs); 
//recvTimeInMilliSec== "3093702361"

文件编码问题,想转成utf-8

file json.hpp
json.hpp: C++ source text, ISO-8859 text, with CRLF line terminators

iconv -l | grep 8859
CP819 IBM819 ISO-8859-1 ISO-IR-100 ISO8859-1 ISO_8859-1 ISO_8859-1:1987 L1 LATIN1 CSISOLATIN1
ISO-8859-2 ISO-IR-101 ISO8859-2 ISO_8859-2 ISO_8859-2:1987 L2 LATIN2 CSISOLATIN2
ISO-8859-3 ISO-IR-109 ISO8859-3 ISO_8859-3 ISO_8859-3:1988 L3 LATIN3 CSISOLATIN3
ISO-8859-4 ISO-IR-110 ISO8859-4 ISO_8859-4 ISO_8859-4:1988 L4 LATIN4 CSISOLATIN4
CYRILLIC ISO-8859-5 ISO-IR-144 ISO8859-5 ISO_8859-5 ISO_8859-5:1988 CSISOLATINCYRILLIC
ARABIC ASMO-708 ECMA-114 ISO-8859-6 ISO-IR-127 ISO8859-6 ISO_8859-6 ISO_8859-6:1987 CSISOLATINARABIC
ECMA-118 ELOT_928 GREEK GREEK8 ISO-8859-7 ISO-IR-126 ISO8859-7 ISO_8859-7 ISO_8859-7:1987 ISO_8859-7:2003 CSISOLATINGREEK
HEBREW ISO-8859-8 ISO-IR-138 ISO8859-8 ISO_8859-8 ISO_8859-8:1988 CSISOLATINHEBREW
ISO-8859-9 ISO-IR-148 ISO8859-9 ISO_8859-9 ISO_8859-9:1989 L5 LATIN5 CSISOLATIN5
ISO-8859-10 ISO-IR-157 ISO8859-10 ISO_8859-10 ISO_8859-10:1992 L6 LATIN6 CSISOLATIN6
ISO-8859-11 ISO8859-11 ISO_8859-11
ISO-8859-13 ISO-IR-179 ISO8859-13 ISO_8859-13 L7 LATIN7
ISO-8859-14 ISO-CELTIC ISO-IR-199 ISO8859-14 ISO_8859-14 ISO_8859-14:1998 L8 LATIN8
ISO-8859-15 ISO-IR-203 ISO8859-15 ISO_8859-15 ISO_8859-15:1998 LATIN-9
ISO-8859-16 ISO-IR-226 ISO8859-16 ISO_8859-16 ISO_8859-16:2001 L10 LATIN10

都没法转换,用的什么编辑器这么奇怪的文件编码,能写个脚本把所有文件都转成utf-8吗?

redisClient在MFC中不能释放

1 如果用DEMO中的
acl::redis_client client (addr.c_str(), conn_timeout, rw_timeout);
刚只在当前函数中有效,无法在其他部分使用。

2 所以采用指针, acl::redis_client* client;
然后 client = new acl::redis_client(addr.c_str(), conn_timeout, rw_timeout);
但这样 delete client无效,delete 之后,还是内存泄露。

3 上面delete之后,立即引起程序崩溃。应该是底层哪里对内存有影响。

4 console模式下没问题。MFC下根本不能用。

master服务器下的master_ctld服务进程频繁重启

make install 后,利用acl\dist\master下安装脚本,会自动将几个acl\app\master\tools几个工具考到libexec\目录下,运行后发现master_ctld服务被启动后会自动退出,被master进程反复重启,经过分析发现,启动服务时参数带入了‘-v’选项,而app\master\tools\master_ctld\main\main.c中check_version()函数在判断-v时会调用exit()。

redis_auth死循环问题

我们使用ACL库连接REDIS服务器,REDIS服务器前有haproxy做反向代理。
当REDIS服务器未启动时,执行任意redis命令,会导致死循环。
初步判断是由于haproxy的特性,当后端redis不存在时,redis_client可以成功建立TCP链,但无法执行auth命令。于是陷入建链和认证的死循环。

调用栈如下:

#16873 0xf6ec78fe in acl::redis_client::open (this=0x8a09f10) at src/redis/redis_client.cpp:75
#16874 0xf6ec875b in acl::redis_client::run (this=0x8a09f10, pool=0xab9a3e8, req=..., nchildren=0) at src/redis/redis_client.cpp:324
#16875 0xf6ec48c6 in acl::redis_command::run (this=0xff974ef4, nchild=0) at src/redis/redis_command.cpp:643
#16876 0xf6ec4ff4 in acl::redis_command::check_status (this=this@entry=0xff974ef4, success=success@entry=0xf6f29462 "OK") at src/redis/redis_command.cpp:757
#16877 0xf6ec9198 in acl::redis_connection::auth (this=this@entry=0xff974ef0, passwd=0x89dccd0 "test") at src/redis/redis_connection.cpp:44
#16878 0xf6ec78fe in acl::redis_client::open (this=0x8a09f10) at src/redis/redis_client.cpp:75
#16879 0xf6ec875b in acl::redis_client::run (this=0x8a09f10, pool=0xab98260, req=..., nchildren=0) at src/redis/redis_client.cpp:324
#16880 0xf6ec48c6 in acl::redis_command::run (this=0xff975074, nchild=0) at src/redis/redis_command.cpp:643
#16881 0xf6ec4ff4 in acl::redis_command::check_status (this=this@entry=0xff975074, success=success@entry=0xf6f29462 "OK") at src/redis/redis_command.cpp:757
#16882 0xf6ec9198 in acl::redis_connection::auth (this=this@entry=0xff975070, passwd=0x89dccd0 "test") at src/redis/redis_connection.cpp:44
#16883 0xf6ec78fe in acl::redis_client::open (this=0x8a09f10) at src/redis/redis_client.cpp:75
#16884 0xf6ec875b in acl::redis_client::run (this=0x8a09f10, pool=0xab960d8, req=..., nchildren=0) at src/redis/redis_client.cpp:324
#16885 0xf6ec48c6 in acl::redis_command::run (this=0xff9751f4, nchild=0) at src/redis/redis_command.cpp:643
#16886 0xf6ec4ff4 in acl::redis_command::check_status (this=this@entry=0xff9751f4, success=success@entry=0xf6f29462 "OK") at src/redis/redis_command.cpp:757
#16887 0xf6ec9198 in acl::redis_connection::auth (this=this@entry=0xff9751f0, passwd=0x89dccd0 "test") at src/redis/redis_connection.cpp:44
#16888 0xf6ec78fe in acl::redis_client::open (this=0x8a09f10) at src/redis/redis_client.cpp:75

ACL3.4中redis效率问题

我通过压力测试,发现ACL3.4的redis效率很低,我改成ACL3.3版本就解决了问题,你们是否遇到过类似的问题,难道在3.4中需要有什么开关配置或者使用上有区别?

redis load脚本崩溃(3.4.0版本)

/opt/mcu/sodir/librediswrap.so(acl_default_free+0x8b) [0x5626873b]
/opt/mcu/sodir/librediswrap.so(acl_free_glue+0x3c) [0x56246bac]
/opt/mcu/sodir/librediswrap.so(acl_array_free+0x5f) [0x5624bf0f]
/opt/mcu/sodir/librediswrap.so( +0xf3) [0x56242613]
/opt/mcu/sodir/librediswrap.so(_ZN3acl6stream5closeEv+0x56) [0x5622cf96]
/opt/mcu/sodir/librediswrap.so(_ZN3acl12redis_client5closeEv+0x2e) [0x5620551e]
/opt/mcu/sodir/librediswrap.so(_ZN3acl12redis_client3runEPNS_9dbuf_poolERKNS_6stringEjPi+0x60) [0x56206130]
/opt/mcu/sodir/librediswrap.so(_ZN3acl13redis_command3runEjPi+0xf1) [0x5620cd61]
/opt/mcu/sodir/librediswrap.so(_ZN3acl13redis_command10get_stringERNS_6stringE+0x2c) [0x5620d5ac]
/opt/mcu/sodir/librediswrap.so(ZN3acl12redis_script11script_loadERKNS_6stringERS1+0xa2) [0x5621abb2]
/opt/mcu/sodir/librediswrap.so(_ZN10CRedisWrap17LoadScriptContentEPKcRSs+0x68) [0x561fff08]
崩溃堆栈如上
其他信息:
. 触发的SIGABRT信号
. 程序是多线程模型,每个redis操作已加锁保护

publish return 0, but there is peer listening and peer seems do receive the message

Hi,

There is a redis cluster, and I use redis client redis-cli to subscribe to certain channel.

Then I use acl redis publish command to publish to the channel, but the result is unexpected,
it returns 1 for one time, then 0 for the next time, then continue in this 1 0 1 0 ... pattern.

And actually redis-cli displays all messages, so I would expect all return 1, why some not?

Any idea?

Thanks

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

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

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.