soulteary / apt-proxy

[Ubuntu / Debian / CentOS / Alpine] Lightweight APT / YUM / APK CHACHE PROXY with only 2MB+ size!
https://soulteary.com/2022/11/20/linux-package-download-acceleration-tool-apt-proxy.html
Apache License 2.0
181 stars 19 forks source link

较大的包下载过程出错 #14

Open zsy5172 opened 1 year ago

zsy5172 commented 1 year ago

docker环境下,以较慢的速度(kb/s)下载大文件的时候,时不时会出错

2022/11/23 09:11:21 172.31.1.82 "GET http://mirrors.tuna.tsinghua.edu.cn/ubuntu/pool/main/n/networkd-dispatcher/networkd-dispatcher_2.1-2%7eubuntu20.04.3_all.deb HTTP/1.1" (OK) 15476 MISS 454.480627ms
2022/11/23 09:11:21 rewrote "/ubuntu/pool/main/s/systemd/udev_245.4-4ubuntu3.19_amd64.deb" to "http://mirrors.tuna.tsinghua.edu.cn/ubuntu/pool/main/s/systemd/udev_245.4-4ubuntu3.19_amd64.deb"
2022/11/23 09:12:13 rewrote "/ubuntu/pool/main/s/systemd/udev_245.4-4ubuntu3.19_amd64.deb" to "http://mirrors.tuna.tsinghua.edu.cn/ubuntu/pool/main/s/systemd/udev_245.4-4ubuntu3.19_amd64.deb"
panic: net/http: abort Handler
goroutine 760 [running]:
net/http/httputil.(*ReverseProxy).ServeHTTP(0xc000262e60, {0x79ef78?, 0xc000016510}, 0xc0002f0000)
    /opt/hostedtoolcache/go/1.19.2/x64/src/net/http/httputil/reverseproxy.go:363 +0xee9
github.com/soulteary/apt-proxy/pkg/httpcache.(*Handler).passUpstream.func1()
    /home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:253 +0x3d
created by github.com/soulteary/apt-proxy/pkg/httpcache.(*Handler).passUpstream
    /home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:252 +0x1fb
soulteary commented 1 year ago

@zsy5172

感谢反馈,推测和 “timeout” 有关。我试试模拟下较慢速度 lol

JoeyZhu commented 1 year ago

类似问题: 2023/02/01 22:25:54 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/main/a/avahi/avahi-daemon_0.7-3.1ubuntu1.3_arm64.deb HTTP/1.1" (OK) 56156 ^[[31;1mMISS^[[0m 1.140665658s 2023/02/01 22:25:55 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/main/a/avahi/avahi-utils_0.7-3.1ubuntu1.3_arm64.deb HTTP/1.1" (OK) 22200 ^[[31;1mMISS^[[0m 1.026803982s 2023/02/01 22:25:59 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/main/b/binutils/binutils-common_2.30-21ubuntu1%7e18.04.8_arm64.deb HTTP/1.1" (OK) 196816 ^[[31;1mMISS^[[0m 3.791026443s 2023/02/01 22:26:00 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/main/b/binutils/binutils_2.30-21ubuntu1%7e18.04.8_arm64.deb HTTP/1.1" (OK) 3364 ^[[31;1mMISS^[[0m 486.296309ms 2023/02/01 22:26:05 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/main/b/binutils/binutils-aarch64-linux-gnu_2.30-21ubuntu1%7e18.04.8_arm64.deb HTTP/1.1" (OK) 2167732 ^[[31;1mMISS^[[0m 5.246591655s 2023/02/01 22:26:08 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/main/b/binutils/libbinutils_2.30-21ubuntu1%7e18.04.8_arm64.deb HTTP/1.1" (OK) 416460 ^[[31;1mMISS^[[0m 3.400437817s 2023/02/01 22:26:11 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/main/b/bluez/bluez-obexd_5.48-0ubuntu3.9_arm64.deb HTTP/1.1" (OK) 141384 ^[[31;1mMISS^[[0m 2.260814118s 2023/02/01 22:26:16 192.168.2.144 "GET http://ports.ubuntu.com/ubuntu-ports/pool/universe/r/runc/runc_1.1.0-0ubuntu1%7e18.04.1_arm64.deb HTTP/1.1" (OK) 3329220 ^[[31;1mMISS^[[0m 5.402605655s 2023/02/01 22:28:12 httputil: ReverseProxy read error during body copy: read tcp 192.168.2.171:41000->185.125.190.36:80: read: connection reset by peer panic: net/http: abort Handler

goroutine 3790 [running]: net/http/httputil.(ReverseProxy).ServeHTTP(0xc00056a820, {0x79efb8?, 0xc0001aa1b0}, 0xc0000d2000) /opt/hostedtoolcache/go/1.19.3/x64/src/net/http/httputil/reverseproxy.go:363 +0xee9 github.com/soulteary/apt-proxy/pkg/httpcache.(Handler).passUpstream.func1() /home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:253 +0x3d created by github.com/soulteary/apt-proxy/pkg/httpcache.(*Handler).passUpstream /home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:252 +0x1fb

HorseLuke commented 1 year ago

确实存在类似问题:

Mar 06 19:10:28 localhost bash[1458814]: 2023/03/06 19:10:28 172.17.0.2 "GET https://mirrors.tuna.tsinghua.edu.cn/debian/dists/bullseye-updates/main/binary-amd64/by-hash/SHA256/2d610aa901b664eca2109e5cfb03cf8eecefaf95746ce7398e360f2ab02c010c HTTP/1.1" (OK) 14608 MISS 649.125916ms
Mar 06 19:10:46 localhost bash[1458814]: panic: net/http: abort Handler
Mar 06 19:10:46 localhost bash[1458814]: goroutine 506 [running]:
Mar 06 19:10:46 localhost bash[1458814]: net/http/httputil.(*ReverseProxy).ServeHTTP(0xc00024e140, {0x79efb8?, 0xc000a86120}, 0xc0004a4000)
Mar 06 19:10:46 localhost bash[1458814]:         /opt/hostedtoolcache/go/1.19.3/x64/src/net/http/httputil/reverseproxy.go:363 +0xee9
Mar 06 19:10:46 localhost bash[1458814]: github.com/soulteary/apt-proxy/pkg/httpcache.(*Handler).pipeUpstream.func1()
Mar 06 19:10:46 localhost bash[1458814]:         /home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:218 +0x3d
Mar 06 19:10:46 localhost bash[1458814]: created by github.com/soulteary/apt-proxy/pkg/httpcache.(*Handler).pipeUpstream
Mar 06 19:10:46 localhost bash[1458814]:         /home/runner/work/apt-proxy/apt-proxy/pkg/httpcache/handler.go:217 +0x165