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

ERR_INVALID_ARGUMENT as HAProxy upstream #41

Closed
bluesimke opened this issue Feb 23, 2020 · 9 comments
Closed

ERR_INVALID_ARGUMENT as HAProxy upstream #41

bluesimke opened this issue Feb 23, 2020 · 9 comments

Comments

@bluesimke
Copy link

bluesimke commented Feb 23, 2020

问题已经解决。降低 HAProxy 版本到 1.8.x 可解。

@Abreto
Copy link

Abreto commented Feb 29, 2020

如果没法降级呢?我现在找不到参考,关于 ERR_INVALID_ARGUMENT 也没找到多少有用的信息

@klzgrad
Copy link
Owner

klzgrad commented Mar 1, 2020

问题没有解决。

之前我的经验是HAProxy可能对h2隧道大量上传的流量限制有点问题,不知道是不是同样的问题。

你确认一下HAProxy 2.0.x 是不是客户端大量上传就一定会重现

@klzgrad klzgrad reopened this Mar 1, 2020
@Abreto
Copy link

Abreto commented Mar 2, 2020

我现在的配置大概这样 (HAProxy 2.1)

global
    log stdout format raw local0 info
    maxconn 100000
    tune.h2.initial-window-size 1048576

defaults
    log global
    mode http

    option httplog
    option redispatch
    option forwardfor
    option http-keep-alive
    option persist
    http-reuse always

    timeout connect 4s
    timeout queue 5s
    timeout client 30s
    timeout server 30s
    timeout tunnel 1h
    timeout http-request 10s
    timeout http-keep-alive 2s
    timeout client-fin 1s
    timeout server-fin 1s

userlist users
    user name insecure-password pass

frontend besides-trojan
    bind *:80

    option http-use-proxy-header
    use_backend naive if { http_auth(users) }

    use_backend v2ray_vmess_h2 if { path -i -m beg /filesync/v2ray/h2/vmess }

    default_backend sb

backend naive
    server naive naive:1080

backend v2ray_vmess_h2
    server v2ray v2ray:280 proto h2

backend sb
    server sb sb:80

这样的配置下,h2 传输的 vmess 正常,上传可以跑到 30Mbps 左右。naive 这边单纯连下 http://gstatic.com/generate_204 也有很大几率 ERR_INVALID_ARGUMENT

$ all_proxy='socks5h://127.0.0.1:8999' curl -v http://gstatic.com/generate_204
* Uses proxy env variable all_proxy == 'socks5h://127.0.0.1:8999'
*   Trying 127.0.0.1...
* TCP_NODELAY set
* SOCKS5 communication to gstatic.com:80
* SOCKS5 request granted.
* Connected to 127.0.0.1 (127.0.0.1) port 8999 (#0)
> GET /generate_204 HTTP/1.1
> Host: gstatic.com
> User-Agent: curl/7.64.1
> Accept: */*
>
* Empty reply from server
* Connection #0 to host 127.0.0.1 left intact
curl: (52) Empty reply from server
* Closing connection 0

@bluesimke
Copy link
Author

我完全是试出来的,因为我也没有找到任何可供参考的资料
在尝试过 Debian 和 CentOS 各个发行版原生 repo 的 HAProxy 版本之后,乃至自己编译 HAProxy,我始终会莫名奇妙获得标题上所示的报错
但是在使用了 CentOS 7.x + IUS 第三方库的 HAProxy 1.8.x 之后,问题消失
@klzgrad 大概率是你所说的问题,而恰好我用的这个 HAProxy 版本,没有这个问题
我已经在内网中进行了大流量测试
在 PVE 上的两台万兆互连的虚拟机(1T1G)上,iperf3 显示经过 NaiveProxy 隧道过的流量,速度能吃到 2Gbps,我尝试过长时间不间断测试,发现再也没有报错。

@bluesimke
Copy link
Author

原因不得而知,我只能给后来者一个实践过的结论
同样的 HAProxy 1.8.x,刚刚好只有我上面提到那个版本,不会出错
而各种版本甚至报错都不一样,出错表现也不一样
配置一致,大版本号一致,1.8.x,同样是 CentOS,但是来自 Software Collection 的 HA 1.8.x 就会出现大流量后导致连接意外断开,然后后续的连接全部报错
而我当时编译的 latest 版本的 HA,出错的表现就是,第一次连接没问题,但是第一个长连接释放后,第二个长连接始终报错。

@klzgrad klzgrad changed the title 服务端报错:Invalid Argument ERR_INVALID_ARGUMENT as HAProxy upstream Mar 7, 2020
@klzgrad
Copy link
Owner

klzgrad commented Mar 7, 2020

Ok, this is actually a bug which naiveproxy does not handle correctly when HAProxy coalesces two HTTP headers into one TCP packet.

@klzgrad
Copy link
Owner

klzgrad commented Mar 7, 2020

@klzgrad
Copy link
Owner

klzgrad commented Mar 12, 2020

问题有没有解决?

@Abreto
Copy link

Abreto commented Sep 20, 2020

It's now fixed. Thanks.

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

3 participants