v2ray-plugin icon indicating copy to clipboard operation
v2ray-plugin copied to clipboard

plugin service exit unexpectedly

Open richman167 opened this issue 4 years ago • 9 comments

When I restart shadowsocks,the screen will show that the startup is successful, but the log shows: Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: using tcp fast open Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: plugin "/usr/bin/v2ray-plugin" enabled Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: UDP relay enabled Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: enable TCP no-delay Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: initializing ciphers... aes-256-gcm Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: using nameserver: 1.1.1.1 Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: tcp server listening at 127.0.0.1:39061 Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: tcp port reuse enabled Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: udp server listening at 127.0.0.1:54321 Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: udp port reuse enabled Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: plugin service exit unexpectedly Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: closed gracefully Apr 27 11:49:00 hklawyer /usr/local/bin/ss-server[1800]: error on terminating the plugin. my config.json is : { "server":"127.0.0.1", "server_port":54321, "password":"IOMpWsP", "timeout":300, "user":"nobody", "method":"aes-256-gcm", "fast_open":true, "reuse_port":true, "no_delay":true, "nameserver":"8.8.8.8", "nameserver":"1.1.1.1", "mode":"tcp_and_udp", "plugin":"/usr/bin/v2ray-plugin", "plugin_opts":"server;path=/;loglevel=none" } my v2ray-plugin version is 1.3.1,please help me

richman167 avatar Apr 27 '21 04:04 richman167

{"server":"0.0.0.0", "server_port":0000, "method":"aes-256-gcm", "timeout":300, "password":"", "fast_open":false, "nameserver":"8.8.8.8", "mode":"tcp_and_udp", "plugin":"v2ray-plugin", "plugin_opts":"server" }

luii2020 avatar May 01 '21 10:05 luii2020

{"server":"0.0.0.0", "server_port":0000, "method":"aes-256-gcm", "timeout":300, "password":"", "fast_open":false, "nameserver":"8.8.8.8", "mode":"tcp_and_udp", "plugin":"v2ray-plugin", "plugin_opts":"server" }

Thank you for your reply, according to your method, the problem is still not solved

richman167 avatar May 06 '21 01:05 richman167

Only restart the machine service to start normally, but if you restart the shadowsocks service, it will not start again, unless the machine is restarted

richman167 avatar May 06 '21 01:05 richman167

Server address: 0.0.0.0, server port: modify by yourself, generally there is no problem。 If you want to make ss restart automatically, you can refer to: vi /etc/systemd/system/shadowsocks-libev.service [Unit] Description=Shadowsocks-libev Server After=network.target

[Service] Type=simple ExecStart=/usr/local/bin/ss-server -c /etc/shadowsocks-libev/config.json -u Restart=on-abort

[Install] WantedBy=multi-user.target

and then enter : systemctl start shadowsocks-libev && systemctl enable shadowsocks-libev

luii2020 avatar May 06 '21 10:05 luii2020

pkill v2ray-plugin then restart ss

om2mo avatar May 06 '21 18:05 om2mo

pkill v2ray-plugin then restart ss

Your method works, but it's a bit troublesome, thank you

richman167 avatar May 07 '21 02:05 richman167

Server address: 0.0.0.0, server port: modify by yourself, generally there is no problem。 If you want to make ss restart automatically, you can refer to: vi /etc/systemd/system/shadowsocks-libev.service [Unit] Description=Shadowsocks-libev Server After=network.target

[Service] Type=simple ExecStart=/usr/local/bin/ss-server -c /etc/shadowsocks-libev/config.json -u Restart=on-abort

[Install] WantedBy=multi-user.target

and then enter : systemctl start shadowsocks-libev && systemctl enable shadowsocks-libev

The problem is still not solved。Too bad, the same method of construction is no problem before

richman167 avatar May 07 '21 02:05 richman167

The problem is that v2ray-plugin may reside in memory

[Unit]
Description=Shadowsocks-libev Server
After=network.target

[Service]
Type=simple
pkill v2ray-plugin
ExecStart=/usr/local/bin/ss-server -c /etc/shadowsocks-libev/config.json -u
Restart=on-abort

[Install]
WantedBy=multi-user.target

Or to make it easier,write a shell script.

#!/bin/sh
pkill v2ray-plugin
pkill ss-server
ss-server -c /etc/shadowsocks-libev/config.json -u

chmod +x

om2mo avatar May 07 '21 18:05 om2mo

The problem is that v2ray-plugin may reside in memory

[Unit]
Description=Shadowsocks-libev Server
After=network.target

[Service]
Type=simple
pkill v2ray-plugin
ExecStart=/usr/local/bin/ss-server -c /etc/shadowsocks-libev/config.json -u
Restart=on-abort

[Install]
WantedBy=multi-user.target

Or to make it easier,write a shell script.

#!/bin/sh
pkill v2ray-plugin
pkill ss-server
ss-server -c /etc/shadowsocks-libev/config.json -u

chmod +x

too weird,The same ubuntu version, the same v2ray-plugin and shadowsocks worked well before。 There is a shadowsocks service in the "/etc/init.d" directory, the content inside is: #!/usr/bin/env bash

BEGIN INIT INFO

Provides: Shadowsocks-libev

Required-Start: $network $local_fs $remote_fs

Required-Stop: $network $local_fs $remote_fs

Default-Start: 2 3 4 5

Default-Stop: 0 1 6

Short-Description: Fast tunnel proxy that helps you bypass firewalls

Description: Start or stop the Shadowsocks-libev server

END INIT INFO

Author: Teddysun [email protected]

if [ -f /usr/local/bin/ss-server ]; then DAEMON=/usr/local/bin/ss-server elif [ -f /usr/bin/ss-server ]; then DAEMON=/usr/bin/ss-server fi NAME=Shadowsocks-libev CONF=/etc/shadowsocks-libev/config.json PID_DIR=/var/run PID_FILE=$PID_DIR/shadowsocks-libev.pid RET_VAL=0

[ -x $DAEMON ] || exit 0

if [ ! -d $PID_DIR ]; then mkdir -p $PID_DIR if [ $? -ne 0 ]; then echo "Creating PID directory $PID_DIR failed" exit 1 fi fi if [ ! -f $CONF ]; then echo "$NAME config file $CONF not found" exit 1 fi

check_running() { if [ -r $PID_FILE ]; then read PID < $PID_FILE if [ -d "/proc/$PID" ]; then return 0 else rm -f $PID_FILE return 1 fi else return 2 fi }

do_status() { check_running case $? in 0) echo "$NAME (pid $PID) is running..." ;; 1|2) echo "$NAME is stopped" RET_VAL=1 ;; esac }

do_start() { if check_running; then echo "$NAME (pid $PID) is already running..." return 0 fi $DAEMON -v -c $CONF -f $PID_FILE if check_running; then echo "Starting $NAME success" else echo "Starting $NAME failed" RET_VAL=1 fi }

do_stop() { if check_running; then kill -9 $PID rm -f $PID_FILE echo "Stopping $NAME success" else echo "$NAME is stopped" RET_VAL=1 fi }

do_restart() { do_stop sleep 0.5 do_start }

case "$1" in start|stop|restart|status) do_$1 ;; *) echo "Usage: $0 { start | stop | restart | status }" RET_VAL=1 ;; esac

exit $RET_VAL

richman167 avatar May 08 '21 01:05 richman167