Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用cluster模式,建立连接后发送消息报错assert((s->sending & 0xffff) != 0),导致服务器崩溃 #1437

Closed
RiceCN opened this issue Jul 9, 2021 · 3 comments

Comments

@RiceCN
Copy link

RiceCN commented Jul 9, 2021

开了两个进程(A,B),A进程先启动,B进程后启动,当B进程启动成功后,A进程通过cluster模式向B进程发送消息报错。
堆栈信息:
#0 0x00007f36c86a434e in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:67
#1 0x00007f36c86a5795 in abort () at abort.c:91
#2 0x00007f36c869d8fe in __assert_fail_base (fmt=, assertion=0x4caf54 "(s->sending & 0xffff) != 0", file=0x4cae1b "skynet-src/socket_server.c", line=,
function=) at assert.c:94
#3 0x00007f36c869d9c0 in __assert_fail (assertion=0x4caf54 "(s->sending & 0xffff) != 0", file=0x4cae1b "skynet-src/socket_server.c", line=1195, function=0x4cb390 "dec_sending_ref") at assert.c:103
#4 0x000000000040dd5e in ctrl_cmd () at skynet-src/socket_server.c:1195
#5 0x000000000040e50b in socket_server_poll () at skynet-src/socket_server.c:1483
#6 0x000000000040bcab in skynet_socket_poll ()
#7 0x000000000040a9c7 in thread_socket ()
#8 0x00007f36c9347d74 in start_thread (arg=0x7f36c57f9700) at pthread_create.c:305
#9 0x00007f36c87572cd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

对应代码:
static inline void
dec_sending_ref(struct socket_server *ss, int id) {
struct socket * s = &ss->slot[HASH_ID(id)];
// Notice: udp may inc sending while type == SOCKET_TYPE_RESERVE
if (s->id == id && s->protocol == PROTOCOL_TCP) {
assert((s->sending & 0xffff) != 0);
ATOM_DEC(&s->sending);
}
}

不知是啥原因,若忽略掉assert((s->sending & 0xffff) != 0)也能正常跑,就是不知道会造成啥后果

@cloudwu
Copy link
Owner

cloudwu commented Jul 9, 2021

  1. 能够复现吗?
  2. 更新到最新,再查问题。

@RiceCN
Copy link
Author

RiceCN commented Jul 10, 2021

不是必现,出现此问题后,我把断言去掉后,sending值每次减1(值为负数)。我更新到最新版本试试

@RiceCN
Copy link
Author

RiceCN commented Aug 18, 2021

最新版本暂未重现此问题,先关闭此issues

@RiceCN RiceCN closed this as completed Aug 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants