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

kcptun服务器端进程被系统kill #425

Closed
yingziwu opened this issue Mar 24, 2017 · 2 comments
Closed

kcptun服务器端进程被系统kill #425

yingziwu opened this issue Mar 24, 2017 · 2 comments

Comments

@yingziwu
Copy link

系统

server:debian 8 x64
client:archlinux x64

kcptun版本

server:version 20170322
client:version 20170322

问题描述

服务器端运行一段时间后,进程会被系统kill,systemctl start kcptun_new.service后即可恢复,一段时间后再次被kill。
仅运行服务,不跑流量,不会被kill。
问题与#422相似。

日志

服务器端

[root@xxxx ~ #4]# systemctl status kcptun_new.service
● kcptun_new.service - Kcptun service
   Loaded: loaded (/etc/systemd/system/kcptun_new.service; enabled)
   Active: inactive (dead) since Thu 2017-03-23 09:45:07 EDT; 17h ago
  Process: 27693 ExecStop=/bin/kill -s QUIT $MAINPID (code=exited, status=0/SUCCESS)
  Process: 26818 ExecStart=/usr/bin/server_linux_amd64 -c /etc/kcptun/ss_new.json (code=killed, signal=PIPE)
 Main PID: 26818 (code=killed, signal=PIPE)

Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream closed
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream opened
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream closed
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream opened
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream closed
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream opened
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream closed
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream opened
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream closed
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream opened

journalctl -u kcptun_new.service (仅结束部分)

Mar 23 09:40:12 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:40:12 broken pipe
Mar 23 09:40:12 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:40:12 stream closed
Mar 23 09:40:13 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:40:13 remote address: 124.207.xxx.xxx:2455
Mar 23 09:40:43 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:40:43 remote address: 124.207.xxx.xxx:3429
Mar 23 09:40:43 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:40:43 stream opened
Mar 23 09:40:43 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:40:43 broken pipe
Mar 23 09:42:29 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:29 stream closed
Mar 23 09:42:29 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:29 stream opened
Mar 23 09:42:30 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:30 stream closed
Mar 23 09:42:30 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:30 stream opened
Mar 23 09:42:30 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:30 stream closed
Mar 23 09:42:30 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:30 stream opened
Mar 23 09:42:30 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:30 stream closed
Mar 23 09:42:30 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:30 stream opened
Mar 23 09:42:30 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:30 stream closed
Mar 23 09:42:37 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:37 stream opened
Mar 23 09:42:37 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:37 stream closed
Mar 23 09:42:37 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:37 stream opened
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream closed
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream opened
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream closed
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream opened
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream closed
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream opened
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream closed
Mar 23 09:42:49 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:42:49 stream opened
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream closed
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream opened
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream closed
Mar 23 09:43:40 xxxx.xxxx server_linux_amd64[26818]: 2017/03/23 09:43:40 stream opened

kcptun_new.service

[Unit]
Description=Kcptun service
After=network.target

[Service]
Type=simple
User=nobody
ExecStart=/usr/bin/server_linux_amd64 -c /etc/kcptun/ss_new.json
ExecStop=/bin/kill -s QUIT $MAINPID
KillMode=process
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
[root@xxxx ~ #8]# cat /etc/kcptun/ss_new.json
{
"target":"127.0.0.1:31247",
"listen":":21762",
"mode":"fast2",
"key":"thekcppassword",
"crypt":"salsa20",
"nocomp":true
}

用户端

仅相关时间段

2017/03/23 22:38:06 stream closed
2017/03/23 22:38:06 stream opened
2017/03/23 22:38:10 stream closed
2017/03/23 22:38:10 stream opened
2017/03/23 22:38:14 stream closed
2017/03/23 22:38:14 stream opened
2017/03/23 22:38:16 stream closed
2017/03/23 22:39:20 session marked as expired
2017/03/23 22:39:20 connection: 10.110.132.200:37115 -> 159.203.xxx.xxx:21762
2017/03/23 22:39:20 stream opened
2017/03/23 22:39:21 session normally closed
2017/03/23 22:39:24 stream closed
2017/03/23 22:39:24 stream opened
2017/03/23 22:39:28 stream closed
2017/03/23 22:39:28 stream opened
2017/03/23 22:39:32 stream closed
2017/03/23 22:39:32 stream opened
2017/03/23 22:39:36 stream closed
2017/03/23 22:39:36 stream opened
2017/03/23 22:39:40 stream closed
2017/03/23 22:39:40 stream opened
2017/03/23 22:39:44 stream closed
2017/03/23 22:39:44 stream opened
2017/03/23 22:39:48 stream closed
2017/03/23 22:39:48 stream opened
2017/03/23 22:39:50 stream closed
2017/03/23 22:40:54 session marked as expired
2017/03/23 22:40:55 session normally closed
2017/03/23 22:40:55 connection: 10.110.132.200:58820 -> 159.203.xxx.xxx:21762
2017/03/23 22:40:55 stream opened
2017/03/23 22:40:58 stream closed
2017/03/23 22:40:58 stream opened
2017/03/23 22:41:02 stream closed
2017/03/23 22:41:02 stream opened
2017/03/23 22:41:06 stream closed
2017/03/23 22:41:06 stream opened
2017/03/23 22:41:10 stream closed
2017/03/23 22:41:10 stream opened
2017/03/23 22:41:14 stream closed
2017/03/23 22:41:14 stream opened
2017/03/23 22:41:18 stream closed
2017/03/23 22:41:18 stream opened
2017/03/23 22:41:22 stream closed
2017/03/23 22:41:22 stream opened
2017/03/23 22:41:25 stream closed
2017/03/23 22:42:29 session marked as expired
2017/03/23 22:42:29 connection: 10.110.132.200:47197 -> 159.203.xxx.xxx:21762
2017/03/23 22:42:29 stream opened
2017/03/23 22:42:30 session normally closed
2017/03/23 22:42:33 stream closed
2017/03/23 22:42:33 stream opened
2017/03/23 22:42:37 stream closed
2017/03/23 22:42:37 stream opened
2017/03/23 22:42:41 stream closed
2017/03/23 22:42:45 stream closed
2017/03/23 22:42:45 stream opened
2017/03/23 22:42:49 stream closed
2017/03/23 22:42:49 stream opened
2017/03/23 22:42:53 stream closed
2017/03/23 22:42:53 stream opened
2017/03/23 22:42:57 stream closed
2017/03/23 22:42:57 stream opened
2017/03/23 22:42:59 stream closed
2017/03/23 22:44:03 session marked as expired
2017/03/23 22:44:03 connection: 10.110.132.200:58870 -> 159.203.xxx.xxx:21762
2017/03/23 22:44:03 stream opened
2017/03/23 22:44:04 session normally closed
2017/03/23 22:44:07 stream closed
2017/03/23 22:44:07 stream opened
2017/03/23 22:44:11 stream closed
2017/03/23 22:44:11 stream opened
2017/03/23 22:44:15 stream closed
2017/03/23 22:44:15 stream opened
2017/03/23 22:44:19 stream closed
2017/03/23 22:44:19 stream opened
2017/03/23 22:44:23 stream closed
2017/03/23 22:44:23 stream opened
2017/03/23 22:44:27 stream closed
2017/03/23 22:44:27 stream opened
2017/03/23 22:44:31 stream closed
2017/03/23 22:44:31 stream opened
2017/03/23 22:44:33 stream closed
2017/03/23 22:45:37 session marked as expired
2017/03/23 22:45:38 session normally closed
2017/03/23 22:45:42 connection: 10.110.132.200:48884 -> 159.203.xxx.xxx:21762
2017/03/23 22:45:42 stream opened
2017/03/23 22:45:42 stream opened
2017/03/23 22:45:42 stream closed
2017/03/23 22:45:45 stream closed
2017/03/23 22:45:45 stream opened
2017/03/23 22:45:49 stream closed
2017/03/23 22:45:49 stream opened
2017/03/23 22:45:53 stream closed
2017/03/23 22:45:53 stream opened
2017/03/23 22:45:57 stream closed
2017/03/23 22:45:57 stream opened
2017/03/23 22:46:01 stream closed
2017/03/23 22:46:01 stream opened
2017/03/23 22:46:05 stream closed
2017/03/23 22:46:05 stream opened
2017/03/23 22:46:09 stream closed
2017/03/23 22:46:09 stream opened
2017/03/23 22:46:12 stream closed
2017/03/23 22:47:16 session marked as expired
2017/03/23 22:47:17 session normally closed
2017/03/23 22:47:46 connection: 10.110.132.200:57953 -> 159.203.xxx.xxx:21762
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream opened
2017/03/23 22:47:46 stream closed
2017/03/23 22:47:46 stream closed
2017/03/23 22:47:46 stream closed
2017/03/23 22:47:46 stream closed
2017/03/23 22:47:46 stream closed
2017/03/23 22:47:46 stream closed
2017/03/23 22:47:46 stream closed
2017/03/23 22:47:48 stream closed
2017/03/23 22:47:48 stream opened
2017/03/23 22:47:52 stream closed
2017/03/23 22:47:52 stream opened
2017/03/23 22:47:56 stream closed
2017/03/23 22:47:56 stream opened
2017/03/23 22:48:00 stream closed
2017/03/23 22:48:00 stream opened
2017/03/23 22:48:04 stream closed
2017/03/23 22:48:04 stream opened
2017/03/23 22:48:08 stream closed
2017/03/23 22:48:08 stream opened
2017/03/23 22:48:12 stream closed
2017/03/23 22:48:12 stream opened
2017/03/23 22:48:16 stream closed
2017/03/23 22:48:16 stream opened
2017/03/23 22:48:16 stream closed
2017/03/23 22:49:20 session marked as expired
2017/03/23 22:49:21 session normally closed
2017/03/23 22:49:25 connection: 10.110.132.200:43871 -> 159.203.xxx.xxx:21762
2017/03/23 22:49:25 stream opened
2017/03/23 22:49:25 stream opened
@xtaci
Copy link
Owner

xtaci commented Mar 24, 2017

moby/moby#7087
这个看上去是systemd的问题, 没有忽略掉Sigpipe信号

@xtaci
Copy link
Owner

xtaci commented Mar 24, 2017

hashicorp/consul#1688
golang/go#11845
http://blog.csdn.net/xingwangc2014/article/details/51592026

相关问题, 看来这是个坑。

根据讨论1.6之后的go版本不会出现此问题,我是1.8编译的,应无此问题,也从未出现过此情况。

可以在下一个版本尝试忽略掉sigpipe信号。

@xtaci xtaci closed this as completed Mar 27, 2017
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