shadowsocks / shadowsocks-windows

A C# port of shadowsocks
Other
58.27k stars 16.4k forks source link

Always throw an exception about 'the port is occupied' when I change the shadowsocks setting and use the obfs-local plugin #1370

Closed juneszh closed 4 years ago

juneszh commented 6 years ago

I think its cause the last obfs-local.exe process haven‘t killed then the shadowsocks try to run obfs-local.exe again when it's reload config

Version(release version or AppVeyor link)

4.0.6

Environment(Operating system, .NET Framework, etc)

Windows 10

juneszh commented 6 years ago

exception

chenshaoju commented 6 years ago

请检查是否启动了多个SS,或者有其他应用占用了 1080 端口。

你也可以检查 gui-config.json 文件,找到 "localPort": 1080, ,将 1080 修改为其他端口然后重试。

juneszh commented 6 years ago

@chenshaoju No, It's just happened when I using the obfs-local plugin and change shadowsocks setting

chenshaoju commented 6 years ago

Please check https://github.com/shadowsocks/shadowsocks-windows/issues/1368#issuecomment-328313914

Edit:Not builtin .

juneszh commented 6 years ago

@chenshaoju Sorry, you may misunderstand my issure. My shadowsocks-windows and obfs-local.exe is working fine. Just when I change the shadowsocks setting then it's throw the exception like that screenshot.

But, If I kill the obfs-local.exe process before change shadowsocks setting, it's work.

So, I think this issure is cause the shadowsocks try to run obfs-local.exe again when it's been changed setting, but unfortunately the last obsf process is still running.

chenshaoju commented 6 years ago

interesting,I will test it soon.

codexss commented 6 years ago

更换服务器时有几率会出现这个问题,不知道是不是obfs-local.exe的缺陷

celeron533 commented 6 years ago

Could you please upload your gui-conf file? Please remember to sanitize you server and password.

juneszh commented 6 years ago

@celeron533 here you are. gui-config.zip

celeron533 commented 6 years ago

本地进行了简单测试,仅切换服务器,没有传输数据。未重现这个问题,奇怪

    {
      "server": "127.0.0.1",
      "server_port": 1921,
      "password": "password",
      "method": "chacha20-ietf-poly1305",
      "plugin": "plugin\\obfs-local",
      "plugin_opts": "obfs=tls;obfs-host=www.baidu.com",
      "remarks": "local debug",
      "timeout": 5
    },
    {
      "server": "127.0.0.1",
      "server_port": 1921,
      "password": "password",
      "method": "chacha20-ietf-poly1305",
      "plugin": "plugin\\obfs-local",
      "plugin_opts": "obfs=tls;obfs-host=www.baidu.com",
      "remarks": "local debug2",
      "timeout": 5
    }

  "localPort": 1921,
codexss commented 6 years ago

有这个弹窗的时候手动退出SS进程obfs-local没有杀干净需要手动任务管理器结束……

yyysuo commented 6 years ago

因为obfs支持local端添加插件和不添加插件两种连接方式,即对于libev版本的ss,服务端部署后,local端既可以启用也可以不启用,复制一份不启用obfs的ss配置,添加obfs参数后,在本地占用的都是同一个端口,IP也都是同一个IP,所以就报端口被占用的错误了,不知道这种错误应该由ss-win来改来是obfs-local来改。

其实对于不启用obfs的ss配置来说,实际是启用了obfs配置的,貌似ss-win把这两种配置当作一种配置了,表现就是如果在ss服务端去除obfs那一行配置,local端未添加ss参数的配置就无法连接了,必须删除启用了obfs参数的那一条配置,未添加obfs参数的ss配置才可以正常使用。

语文老师死得早,急死我了,用更简单的方式描述一下ss-win可能出现的bug: ss-win可能某一段代码用IP+Port的方式来判断配置是否是同一配置,而对于2条IP+Port相同,区别在于是否添加obfs参数的配置无法区分,造成楼主遇到的错误。

billysingo commented 6 years ago

同样的问题。使用obfs并且正在跑流量的时候如果切换到另一个使用obfs的节点很大几率出现此错误

celeron533 commented 6 years ago

同样的问题。使用obfs并且正在跑流量的时候如果切换到另一个使用obfs的节点很大几率出现此错误

客户端这边是不是有不止一台server配置了插件?

celeron533 commented 6 years ago

额,猜测到一个可能的原因 当更换服务器或者进行任何配置变化的时候,_listener会通过_tcpSocket.Close()_udpSocket.Close()关闭连接。然后立刻再重开端口监听。 大流量下tcp不能在第一时间关闭导致端口不能及时释放?

ghost commented 4 years ago

两年以来未见更多报告,obfs插件也已停止更新,先关了。如果问题还在,可以重开。