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

socket_server core #294

Closed
flashjay opened this issue Jun 25, 2015 · 1 comment
Closed

socket_server core #294

flashjay opened this issue Jun 25, 2015 · 1 comment

Comments

@flashjay
Copy link
Contributor

我用的是tag 0.4.0版本,但是看下来现在的版本貌似并没有相关的修复;这个问题不是经常出现,可能运行几个月出现一次。
编译环境: Linux 2.6.32-431.17.1.el6.x86_64, gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
使用环境: Linux VM_139_120_tlinux 2.6.32.57-tlinux_xenU-1.1.rc10-default
skynet版本: tag 0.4.0

问题出现行数: 522
512 static int
513 send_socket(struct socket_server *ss, struct request_send * request, struct socket_message *result, int priority) {
514 int id = request->id;
515 struct socket * s = &ss->slot[HASH_ID(id)];
516 if (s->type == SOCKET_TYPE_INVALID || s->id != id
517 || s->type == SOCKET_TYPE_HALFCLOSE
518 || s->type == SOCKET_TYPE_PACCEPT) {
519 FREE(request->buffer);
520 return -1;
521 }
522 assert(s->type != SOCKET_TYPE_PLISTEN && s->type != SOCKET_TYPE_LISTEN)

错误coredump查看如下:
Program terminated with signal 6, Aborted.
(gdb) bt
#0 0x00007fbc08870885 in raise () from /lib64/libc.so.6

Missing separate debuginfos, use: debuginfo-install glibc-2.12-1.49.tl1.x86_64 libgcc-4.4.6-4.tl1.x86_64
(gdb) bt
#0 0x00007fbc08870885 in raise () from /lib64/libc.so.6
#1 0x00007fbc08872065 in abort () from /lib64/libc.so.6
#2 0x00007fbc088699fe in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007fbc08869ac0 in __assert_fail () from /lib64/libc.so.6
#4 0x000000000064b33e in send_socket (ss=0x7fbc0843d010, request=0x7fbc07035cd0, result=0x7fbc07035e50, priority=0)

at skynet/skynet-src/socket_server.c:522

#5 0x000000000064bbc6 in ctrl_cmd (ss=0x7fbc0843d010, result=0x7fbc07035e50) at /skynet/skynet-src/socket_server.c:717
#6 0x000000000064c156 in socket_server_poll (ss=0x7fbc0843d010, result=0x7fbc07035e50, more=0x7fbc07035e4c)

at /skynet/skynet-src/socket_server.c:865

#7 0x0000000000649e46 in skynet_socket_poll () at /skynet/skynet-src/skynet_socket.c:75
#8 0x0000000000647698 in _socket (p=0x2a3f9f0) at /skynet/skynet-src/skynet_start.c:56
#9 0x00007fbc0906f7f1 in start_thread () from /lib64/libpthread.so.0
#10 0x00007fbc08923ccd in clone () from /lib64/libc.so.6

(gdb) p *s
$2 = {fd = 10, id = 1, type = 3, size = 64, wb_size = 0, opaque = 9, high = {head = 0x0, tail = 0x0}, low = {head = 0x0, tail = 0x0}}

即:s->type 此刻等于 SOCKET_TYPE_LISTEN,断言失败导致core

@cloudwu
Copy link
Owner

cloudwu commented Jun 25, 2015

这里不应该是 assert, 而应该返回错误.
你的上层逻辑有别的问题,因为你向一个 listen 的 fd 写数据了.

bttscut pushed a commit to bttscut/skynet that referenced this issue Jun 26, 2015
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