GameXG / TcpRoute2

TcpRoute , TCP 层的路由器。对于 TCP 连接自动从多个线路(电信、联通、移动)、多个域名解析结果中选择最优线路。

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

可能存在的内存问题

actrace opened this issue · comments

目前在用 v0.5.9,开了一个晚上内存占用逐渐升到了500M以上,用作前置代理的privoxy只有30M左右。
系统是Centos 6

这个问题没碰到过,
是否经常出现?

是100%能够复现的,现阶段的解决方案是写了个shell检测内存占用并重启。
目前主要用在家里路由网关(移动,电信双线接入),自动选择最优线路访问外网。默认是移动直连,电信是ADSL作为辅助。

网络空闲时 tcproute 的 tcp 连接数量正常吗?

另外网络使用量大吗?
tcproute内存会缓存最优线路,这个是按照域名+端口来保存的,会保存10分钟。
但是除非做域名扫描之类的特殊情况,一般情况下不会占用内存。

看起来新版本需要增加显示缓存数量等功能。

TCP连接,我是用这个命令来看的,7070是默认的那个监听端口。上级代理是privoxy,主要用来给局域网内的机器做透明代理。

netstat -nat|grep -i "7070"|wc -l
基本都在2500-3000之间。
似乎没有必然关系。

内存占用是缓缓上涨的,偶尔会看到回收几MB,但是总体是上涨的,开了一个18个小时左右就达到500M了。不过这个上涨的速度似乎确实跟连接频率有关系,繁忙时段上涨快一些。

另外我刚刚发现 0.5.9 的发布页下回来的版本是 0.5.8

另外还想问一下编译的问题,似乎不是将源码下回来就可以用 go build 进行编译,目前无法测试这个commit。

现在可以编译了。

另外我刚刚发现 0.5.9 的发布页下回来的版本是 0.5.8
忘记改版本号了。

请教一下应该如何正确编译,直接执行go build,会提示很多包没有。
main.go:15:2: cannot find package "github.com/BurntSushi/toml" in any of:
/usr/lib/golang/src/github.com/BurntSushi/toml (from $GOROOT)
($GOPATH not set)
main.go:16:2: cannot find package "github.com/gamexg/TcpRoute2/daemon" in any of:
/usr/lib/golang/src/github.com/gamexg/TcpRoute2/daemon (from $GOROOT)
($GOPATH not set)
upstream_dialclients.go:5:2: cannot find package "github.com/gamexg/TcpRoute2/domains" in any of:
/usr/lib/golang/src/github.com/gamexg/TcpRoute2/domains (from $GOROOT)
($GOPATH not set)
main.go:17:2: cannot find package "github.com/gamexg/TcpRoute2/netchan" in any of:
/usr/lib/golang/src/github.com/gamexg/TcpRoute2/netchan (from $GOROOT)
($GOPATH not set)
handler_socks.go:13:2: cannot find package "github.com/gamexg/TcpRoute2/nettool" in any of:
/usr/lib/golang/src/github.com/gamexg/TcpRoute2/nettool (from $GOROOT)
($GOPATH not set)
upstream_dialclients.go:7:2: cannot find package "github.com/gamexg/TcpRoute2/ufile" in any of:
/usr/lib/golang/src/github.com/gamexg/TcpRoute2/ufile (from $GOROOT)
($GOPATH not set)
handler_switch.go:4:2: cannot find package "github.com/gamexg/preRead" in any of:
/usr/lib/golang/src/github.com/gamexg/preRead (from $GOROOT)
($GOPATH not set)
upstream_base.go:5:2: cannot find package "github.com/gamexg/proxyclient" in any of:
/usr/lib/golang/src/github.com/gamexg/proxyclient (from $GOROOT)
($GOPATH not set)
errconn.go:3:2: cannot find package "github.com/golang/groupcache/lru" in any of:
/usr/lib/golang/src/github.com/golang/groupcache/lru (from $GOROOT)
($GOPATH not set)
handler.go:10:2: cannot find package "github.com/inconshreveable/go-vhost" in any of:
/usr/lib/golang/src/github.com/inconshreveable/go-vhost (from $GOROOT)
($GOPATH not set)

在tcproute2目录执行
go get ./...
go build

即可。

交叉编译挂了,自动编译发布失败,需要手工根据需要的环境编译代码了。

运行了差不多一天了,情况似乎改善了很多,目前占用了240m的内容。
旧版本的话,这会儿应该超过400M并且被重启了一次了。