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

Issues when testing Windows Update #37

Closed
nexusofdoom opened this issue Mar 31, 2017 · 67 comments
Closed

Issues when testing Windows Update #37

nexusofdoom opened this issue Mar 31, 2017 · 67 comments

Comments

@nexusofdoom
Copy link
Collaborator

[crit] 686#0: *271 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.179, server: microsoft, request: "GET /d/msdownload/update/software/updt/2017/03/windows10.0-kb4015438-x64_3_aadae06fd0885db7996e702e453f784b4683d978.psf HTTP/1.1", upstream: "http://[2001:1900:2302:2f04::ff]:80/d/msdownload/update/software/updt/2017/03/windows10.0-kb4015438-x64_3_aadae06fd0885db7996e702e453f784b4683d978.psf", host: "download.windowsupdate.com"
2017/03/30 21:27:44 [crit] 692#0: *274 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.179, server: microsoft, request: "GET /d/msdownload/update/software/updt/2017/03/windows10.0-kb4015438-x64_1_9881d994bf0f17a1120e12723450b6e54e499075.psf HTTP/1.1", upstream: "http://[2001:1900:2304:8f0a::ff]:80/d/msdownload/update/software/updt/2017/03/windows10.0-kb4015438-x64_1_9881d994bf0f17a1120e12723450b6e54e499075.psf", host: "download.windowsupdate.com"
2017/03/30 21:27:51 [crit] 692#0: *269 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.179, server: microsoft, request: "HEAD /d/msdownload/update/software/updt/2017/03/windows10.0-kb4015438-x64_3_aadae06fd0885db7996e702e453f784b4683d978.psf HTTP/1.1", upstream: "http://[2001:1900:2304:af07::ff]:80/d/msdownload/update/software/updt/2017/03/windows10.0-kb4015438-x64_3_aadae06fd0885db7996e702e453f784b4683d978.psf", host: "download.windowsupdate.com"

@bntjah bntjah added the bug label Mar 31, 2017
@nexusofdoom
Copy link
Collaborator Author

this might be the issue for ms updates

http://mailman.nginx.org/pipermail/nginx/2007-May/000961.html

@nexusofdoom
Copy link
Collaborator Author

Hi guys Im just trying to work out what the cause of this error is

crit] 29494#0: *788901 sendfile() failed (22: Invalid argument) while
sending response to client
It only appears to happen on 1 3gig file the file gets downloaded over
1000
times a day this happens about 5 times.

What nginx version? The latest changelog (0.5.19) includes this:

*) Bugfix: the files more than 2G could not be transferred using
sendfile and limit_rate on 64-bit platforms.

*) Bugfix: the files more than 2G could not be transferred using
sendfile on 64-bit Linux.

Possibly related? If you are running 0.5.19, I don't have a fix but I
do
have a
workaround. Put "sendfile off;" in your config, and nginx will use a
different
system call to send the dat

@wendelj
Copy link
Contributor

wendelj commented Apr 3, 2017

Change this line in nginx.conf:
resolver 8.8.8.8;

To this:
resolver 8.8.8.8 ipv6=off;

@nexusofdoom
Copy link
Collaborator Author

ok will give a try this week and let you know

@nexusofdoom
Copy link
Collaborator Author

still getting this when doing updates , note it looks like a windows 10 updates are the one having the issues , I do not get any errors when doing updates with windows 7

017/04/03 18:31:35 [crit] 688#0: *3450 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /d/msdownload/update/software/crup/2017/03/windows10.0-kb4013418-x64_e35782f290df71c9f00a52b0203a772b876d6e97.psf HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/d/msdownload/update/software/crup/2017/03/windows10.0-kb4013418-x64_e35782f290df71c9f00a52b0203a772b876d6e97.psf", host: "au.download.windowsupdate.com"
2017/04/03 18:31:36 [crit] 685#0: *3412 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.159, server: microsoft, request: "GET /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:38 [crit] 690#0: *3457 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:41 [crit] 685#0: *3352 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab", host: "au.download.windowsupdate.com"
2017/04/03 18:31:43 [crit] 690#0: *3460 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:43 [crit] 690#0: *3461 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:44 [crit] 685#0: *3421 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.159, server: microsoft, request: "GET /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
^C
travus@lancache:/srv/lancache/logs/Errors$ tail microsoft.log -f
2017/04/03 18:31:25 [crit] 688#0: *3446 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /d/msdownload/update/software/crup/2017/03/windows10.0-kb4013418-x64_e35782f290df71c9f00a52b0203a772b876d6e97.psf HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/d/msdownload/update/software/crup/2017/03/windows10.0-kb4013418-x64_e35782f290df71c9f00a52b0203a772b876d6e97.psf", host: "au.download.windowsupdate.com"
2017/04/03 18:31:26 [crit] 685#0: *3426 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "GET /c/msdownload/update/software/uprl/2017/03/windows-kb890830-x64-v5.46_dda7f98e0f03bcab3bdba5eb0ca799771c79f141.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/uprl/2017/03/windows-kb890830-x64-v5.46_dda7f98e0f03bcab3bdba5eb0ca799771c79f141.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:31 [crit] 688#0: *3402 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "GET /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:35 [crit] 688#0: *3450 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /d/msdownload/update/software/crup/2017/03/windows10.0-kb4013418-x64_e35782f290df71c9f00a52b0203a772b876d6e97.psf HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/d/msdownload/update/software/crup/2017/03/windows10.0-kb4013418-x64_e35782f290df71c9f00a52b0203a772b876d6e97.psf", host: "au.download.windowsupdate.com"
2017/04/03 18:31:36 [crit] 685#0: *3412 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.159, server: microsoft, request: "GET /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:38 [crit] 690#0: *3457 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:41 [crit] 685#0: *3352 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab", host: "au.download.windowsupdate.com"
2017/04/03 18:31:43 [crit] 690#0: *3460 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:43 [crit] 690#0: *3461 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "HEAD /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:44 [crit] 685#0: *3421 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.159, server: microsoft, request: "GET /c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/c/msdownload/update/software/defu/2017/03/am_base_a831173843a3f8112c305c588effcd399968b87c.exe", host: "au.download.windowsupdate.com"
2017/04/03 18:31:53 [crit] 688#0: *3471 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab", host: "au.download.windowsupdate.com"
2017/04/03 18:31:53 [crit] 690#0: *3472 bind(10.0.4.21) failed (22: Invalid argument) while connecting to upstream, client: 10.0.4.158, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab HTTP/1.1", upstream: "http://[2a01:111:2003::50]:80/d/msdownload/update/software/secu/2017/03/windows10.0-kb4013429-x64-express_f112f73709fe89085542b03bf2b0332ca2c3b9b8.cab", host: "au.download.windowsupdate.com"

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 3, 2017

new dns
looks like new dns hosts needs to be added to the configs

Microsoft Windows Updates °|-lc-host-vint:7

so I added this to the unbound.conf and it --- still testing !!!
local-zone: "fe2.update.microsoft.com." redirect
local-data: "fe2.update.microsoft.com. 600 IN A 10.0.4.28"
local-zone: "download.windowsupdate.com." redirect
local-data: "download.windowsupdate.com. 600 IN A 10.0.4.28"

@nexusofdoom
Copy link
Collaborator Author

this is the ip that all the updates are coming from

13.107.4.50 it looks like a cdn for MS updates .. still trying to find out what the DNS name or cname is for this ip

@nexusofdoom
Copy link
Collaborator Author

more on this IP Address
https://www.rtsak.com/dns-lookup/tlu.graystore.msedge.net

@nexusofdoom
Copy link
Collaborator Author

@nexusofdoom
Copy link
Collaborator Author

Names pointing to same IP address as this host name (45 shown)
Which hostnames and domains point to the same IP address as this host name?
download.windowsupdate.com
au.au-msedge.net
b1fgds.au-msedge.net
b1fgv4.au-msedge.net
b1ns.au-msedge.net
b1w7dl.au-msedge.net
b1w8au.au-msedge.net
edges.au-msedge.net
c-0001.c-msedge.net
graystore.msedge.net
7.download.windowsupdate.com
au.download.windowsupdate.com
b1.download.windowsupdate.com
www.download.windowsupdate.com
tlu.graystore.au-msedge.net
au.c-0001.c-msedge.net
b1fgds.c-0001.c-msedge.net
b1fgv4.c-0001.c-msedge.net
b1ns.c-0001.c-msedge.net
b1w7dl.c-0001.c-msedge.net
b1w8au.c-0001.c-msedge.net
graystore.c-0001.c-msedge.net
2-01-3cf7-0009.cdx.cedexis.net
2-01-3cf7-000c.cdx.cedexis.net
2-01-3cf7-000d.cdx.cedexis.net
nontlu.graystore.msedge.net
tlu.graystore.msedge.net
5.perf.msedge.net
audownload.windowsupdate.nsatc.net
dl.delivery.mp.microsoft.com
au.b1.download.windowsupdate.com
au.v4.download.windowsupdate.com
au.www.download.windowsupdate.com
7.dl.delivery.mp.microsoft.com
tlu.dl.delivery.mp.microsoft.com
au.ds.b1.download.windowsupdate.com
fg.ds.b1.download.windowsupdate.com
aupl.v4.b1.download.windowsupdate.com
b1.dl.windowsupdate.com.nsatc.net
graystore.msedge.net.redirect.media.akamaihd.net
au.b1.dl.windowsupdate.com.nsatc.net
bg.v4.dl.windowsupdate.com.nsatc.net
au.ds.b1.dl.windowsupdate.com.nsatc.net
au.v4.b1.dl.windowsupdate.com.nsatc.net
aupl.v4.b1.dl.windowsupdate.com.nsatc.net

@bntjah
Copy link
Owner

bntjah commented Apr 4, 2017

Let me know how it goes; I still haven't had the chance to set up my lancache as I'm debugging an error on my internet wich is causing random disconnects on bf1 :-S

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 4, 2017 via email

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 4, 2017 via email

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 4, 2017 via email

@nexusofdoom
Copy link
Collaborator Author

so at this point disabled proxybind in nginx config for mswindows and this is the error I am getting now

2017/04/04 14:14:31 [error] 859#0: *1 connect() to [2001:1900:2302:6f01::ff]:80 failed (101: Network is unreachable) while connecting to upstream, client: 192.168.30.211, server: microsoft, request: "GET /c/msdownload/update/sof tware/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c3ec6c1f992476f1ad9f58e0f16.psf HTTP/1.1", upstream: "http://[2001:1900:2302:6f01::ff]:80/c/msdownload/update/software/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c 3ec6c1f992476f1ad9f58e0f16.psf", host: "download.windowsupdate.com"
2017/04/04 14:14:31 [error] 859#0: *1 connect() to [2001:1900:2304:8f05::ff]:80 failed (101: Network is unreachable) while connecting to upstream, client: 192.168.30.211, server: microsoft, request: "GET /c/msdownload/update/sof tware/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c3ec6c1f992476f1ad9f58e0f16.psf HTTP/1.1", upstream: "http://[2001:1900:2304:8f05::ff]:80/c/msdownload/update/software/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c 3ec6c1f992476f1ad9f58e0f16.psf", host: "download.windowsupdate.com"
2017/04/04 14:14:33 [error] 859#0: *1 connect() to [2001:1900:2302:2f05::ff]:80 failed (101: Network is unreachable) while connecting to upstream, client: 192.168.30.211, server: microsoft, request: "GET /c/msdownload/update/sof tware/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c3ec6c1f992476f1ad9f58e0f16.psf HTTP/1.1", upstream: "http://[2001:1900:2302:2f05::ff]:80/c/msdownload/update/software/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c 3ec6c1f992476f1ad9f58e0f16.psf", host: "download.windowsupdate.com"
2017/04/04 14:14:38 [error] 859#0: *1 connect() to [2001:1900:2304:8f0c::ff]:80 failed (101: Network is unreachable) while connecting to upstream, client: 192.168.30.211, server: microsoft, request: "GET /c/msdownload/update/sof tware/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c3ec6c1f992476f1ad9f58e0f16.psf HTTP/1.1", upstream: "http://[2001:1900:2304:8f0c::ff]:80/c/msdownload/update/software/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c 3ec6c1f992476f1ad9f58e0f16.psf", host: "download.windowsupdate.com"
2017/04/04 14:14:38 [error] 859#0: *1 connect() to [2001:1900:2302:2f05::ff]:80 failed (101: Network is unreachable) while connecting to upstream, client: 192.168.30.211, server: microsoft, request: "GET /c/msdownload/update/sof tware/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c3ec6c1f992476f1ad9f58e0f16.psf HTTP/1.1", upstream: "http://[2001:1900:2302:2f05::ff]:80/c/msdownload/update/software/secu/2017/03/windows6.1-kb4012215-x64_31cc0bb569162c 3ec6c1f992476f1ad9f58e0f16.psf", host: "download.windowsupdate.com"

@nexusofdoom
Copy link
Collaborator Author

ok did this and testing now

Re: disable ipV6 solves lookup slowness for Debian but not for Ubuntu
sysctl net.ipv6.conf.all.disable_ipv6=1
ref
https://ubuntuforums.org/showthread.php?t=1668964

@wendelj
Copy link
Contributor

wendelj commented Apr 5, 2017

I missed where the resolver was set in a second place.
/usr/local/nginx/conf/lancache/resolver

Change this:
resolver 8.8.8.8 4.2.2.2;

To this:
resolver 8.8.8.8 4.2.2.2 ipv6=off;

@nexusofdoom
Copy link
Collaborator Author

I did find the other location for ipv6=off in lancache resolver and did the change but it was still looking up ipv6

the errors only stopped when I did the command
sudo sysctl net.ipv6.conf.all.disable_ipv6=1

@bntjah
Copy link
Owner

bntjah commented Apr 5, 2017 via email

@nexusofdoom
Copy link
Collaborator Author

still doing some tweaks for windows 10 and testing and testing :-)

this is what i have so for for nginx settings

#Windows Updates
server {
listen lancache-microsoft bind ipv6only=off deferred default;
server_name microsoft _;
access_log /srv/lancache/logs/Access/microsoft.log main buffer=128k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_range buffer=128k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log;

    # Default Node
    include lancache/resolver;
    include lancache/cache-key-default;
location / {
     set $no_cache "";
    if ($request_uri ~* \.filestreamingservice$) {
        set $no_cache "1";
    }
    proxy_no_cache $no_cache;
    proxy_cache_bypass $no_cache;
    proxy_connect_timeout 600;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    # Some downloads are very large so we cache based on range to keep single downloads quick and hence ensure interactivity is good.
    #proxy_bind 192.168.30.99;
    proxy_cache_valid 200 206 60d;
    proxy_cache microsoft;
    proxy_read_timeout 150;
    include lancache/proxy-cache;
    include lancache/cache-range;
}

}

once I am all done I will attache a tar with all the changes

@nexusofdoom
Copy link
Collaborator Author

trying to get this folder to not cache

set $no_cache "";
if ($request_uri ~* .filestreamingservice$) {
set $no_cache "1";
}
proxy_no_cache $no_cache;
proxy_cache_bypass $no_cache;

something that windows 10 is doing with updates i think its something like a update list it pushes and it pulls it down over and over

there might also be a way to block it so still checking in ref url below

ref.
https://social.technet.microsoft.com/Forums/en-US/e9531028-4bfe-40c0-af5c-8873c42b6bae/massive-download?forum=win10itprogeneral

@nexusofdoom
Copy link
Collaborator Author

more fun :-)

https://answers.microsoft.com/en-us/insider/forum/insider_wintp-insider_update/windows10-windows-automatic-update-and-store/17f48b91-c12c-41de-8c3a-63954cd40639

Hello,
Yes, the URL tlu.dl.delivery.mp.microsoft.com is from the app store.
I had the same problem with high bandwidth usage. In my case it was caused because the proxy (privoxy) was filtering the HTTP Range header from the HTTP requests. This caused the app store download everything in an endless loop.
Maybe your proxy is doing something similar?
Be the first person to like this

@nexusofdoom
Copy link
Collaborator Author

so don't know if i need to remove this uri from caching?
URI="/filestreamingservice/files/ --- so anything in this folder to not cache ..

any one know how I could do this ?
Thanks

REQUEST="GET /filestreamingservice/files/3787205b-0105-4bfb-a64e-985d61a84e3b?P1=1491419171&P2=301&P3=2&P4=7L1llVny%2fZSfMprTfHkBkhZ0hiELzvopzaXFgiJ%2frIU%3d HTTP/1.1" - REQUEST_URI="/filestreamingservice/files/3787205b-0105-4bfb-a64e-985d61a84e3b?P1=1491419171&P2=301&P3=2&P4=7L1llVny%2fZSfMprTfHkBkhZ0hiELzvopzaXFgiJ%2frIU%3d" - URI="/filestreamingservice/files/3787205b-0105-4bfb-a64e-985d61a84e3b"

@wendelj
Copy link
Contributor

wendelj commented Apr 5, 2017

After setting ipv6=off for both resolver definitions and restarting nginx I was able to update a fresh install of Windows 10 without seeing those errors about Invalid Argument.

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 5, 2017

current setup

#Windows Updates
server {
listen lancache-microsoft bind ipv6only=off deferred default;
server_name microsoft _;
access_log /srv/lancache/logs/Access/microsoft.log main buffer=128k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_range buffer=128k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log;

    # Default Node
    include lancache/resolver;
    include lancache/cache-key-default;
location / {
    proxy_connect_timeout 300;
    set $no_cache 0;
    if ($request_uri ~* "(filestreamingservice/files)") {
        set $no_cache 1;
    }
    proxy_no_cache $no_cache;
    proxy_cache_bypass $no_cache;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Host $http_host;
    # Some downloads are very large so we cache based on range to keep single downloads quick and hence ensure interactivity is good.
    #proxy_bind 192.168.30.99;
    #proxy_cache_valid 200 206 120d;
    proxy_cache microsoft;
    proxy_read_timeout 150;
    include lancache/proxy-cache;
    include lancache/cache-range;
}

}

Microsoft Windows Updates °|-lc-host-vint:7

    local-zone: "windowsupdate.com." redirect
    local-data: "windowsupdate.com. 600 IN A 192.168.30.106"
    #local-zone: "dlassets.xboxlive.com." redirect
    #local-data: "dlassets.xboxlive.com. 600 IN A 192.168.30.106"
    #local-zone: "msxbassets.loris.llnwd.net." redirect
    #local-data: "msxbassets.loris.llnwd.net. 600 IN A 192.168.30.106"
    #local-zone: "xboxone.loris.llnwd.net." redirect
    #local-data: "xboxone.loris.llnwd.net. 600 IN A 192.168.30.106"
    #local-zone: "xboxone.vo.llnwd.net." redirect
    #local-data: "xboxone.vo.llnwd.net. 600 IN A 192.168.30.106"
    #local-zone: "images-eds.xboxlive.com." redirect
    #local-data: "images-eds.xboxlive.com. 600 IN A 192.168.30.106"
    #local-zone: "xbox-mbr.xboxlive.com." redirect
    #local-data: "xbox-mbr.xboxlive.com. 600 IN A 192.168.30.106"
    #local-zone: "assets1.xboxlive.com.nsatc.net." redirect
    #local-data: "assets1.xboxlive.com.nsatc.net. 600 IN A 192.168.30.106"
    #local-zone: "assets1.xboxlive.com." redirect
    #local-data: "assets1.xboxlive.com. 600 IN A 192.168.30.106"
    local-zone: "audownload.windowsupdate.nsatc.net." redirect
    local-data: "audownload.windowsupdate.nsatc.net. 600 IN A 192.168.30.106"
    local-zone: "windowsupdate.com.nsatc.net." redirect
    local-data: "windowsupdate.com.nsatc.net. 600 IN A 192.168.30.106"
    #local-zone: "delivery.mp.microsoft.com." redirect
    #local-data: "delivery.mp.microsoft.com. 600 IN A 192.168.30.106"
    local-zone: "graystore.msedge.net.redirect.media.akamaihd.net." redirect
    local-data: "graystore.msedge.net.redirect.media.akamaihd.net. 600 IN A 192.168.30.106"
    local-zone: "msedge.net." redirect
    local-data: "msedge.net. 600 IN A 192.168.30.106"
    local-zone: "c-msedge.net." redirect
    local-data: "c-msedge.net. 600 IN A 192.168.30.106"
    local-zone: "au-msedge.net." redirect
    local-data: "au-msedge.net. 600 IN A 192.168.30.106"

also did keep the ipv6=off in both configs -- and also have a "bind ipv6only=off" on the top of the lancahce-microsoft.conf

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 5, 2017

wendelj
when you do all the windows updates

if you are looking at nload do you still see it pulling down data..
what I am getting is it keeps pulling down data once all the windows updates are done and it does not show it caching

image

@nexusofdoom
Copy link
Collaborator Author

if I use all the defaults along with all the ipv6 disabled not every update for windows comes over the lancache it routes over the internet direct

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 5, 2017

going to attache wireshark logs
this image is showing it pulling from another location not just from MS domains. some type of cdn or other locations I do see that it pulls some updates from adobe in the windows update but there is some other windows updates getting pulled from another domain
image

@nexusofdoom
Copy link
Collaborator Author

dns wireshark file csv on pc that was doing windows updates

DNS.txt

@nexusofdoom
Copy link
Collaborator Author

lancache config ms office

#Windows Updates
server {
listen lancache-microsoft deferred default;
server_name microsoft _;
access_log /srv/lancache/logs/Access/microsoft.log main buffer=128k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_range buffer=128k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log;

    # Default Node
    include lancache/resolver;
    include lancache/cache-key-default;
location / {
    #proxy_send_timeout 300s;
    proxy_connect_timeout 300;
    # Some downloads are very large so we cache based on range to keep single downloads quic$
    proxy_bind 192.168.30.99;
    #proxy_cache_valid 200 400 206 320d;
    proxy_cache microsoft;
    proxy_read_timeout 300;
    include lancache/proxy-cache;
    include lancache/cache-slice;
}

}

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 11, 2017

when getting new updates I get this error
when using slice.. testing again with range and some other settings.

8a385923ff85ddc95ecd75ea41.psf HTTP/1.1", upstream: "http://8.254.220.190:80/c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_1_b8835f35c094b78a385923ff85ddc95ecd75ea41.psf", host: "download.windowsupdate.com"
2017/04/10 22:02:15 [error] 3375#0: *169 upstream timed out (110: Connection timed out) while reading upstream, client: 192.168.30.247, server: microsoft, request: "GET /c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_2_f96caff54f77da6bd303d7672fcb2ed6f61005a5.psf HTTP/1.1", upstream: "http://8.253.185.249:80/c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_2_f96caff54f77da6bd303d7672fcb2ed6f61005a5.psf", host: "download.windowsupdate.com"
2017/04/10 22:02:15 [error] 3377#0: *176 upstream timed out (110: Connection timed out) while reading upstream, client: 192.168.30.247, server: microsoft, request: "GET /c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_1_b8835f35c094b78a385923ff85ddc95ecd75ea41.psf HTTP/1.1", upstream: "http://8.12.206.30:80/c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_1_b8835f35c094b78a385923ff85ddc95ecd75ea41.psf", host: "download.windowsupdate.com"
2017/04/10 22:02:32 [error] 3378#0: *42 upstream prematurely closed connection while reading upstream, client: 192.168.30.247, server: microsoft, request: "GET /c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_4_a3e35c6ecf8fcf7dff322cd1ef1c4fc7afcbbc88.psf HTTP/1.1", upstream: "http://8.253.32.174:80/c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_4_a3e35c6ecf8fcf7dff322cd1ef1c4fc7afcbbc88.psf", host: "download.windowsupdate.com"
2017/04/10 22:02:34 [error] 3378#0: *211 upstream prematurely closed connection while reading upstream, client: 192.168.30.247, server: microsoft, request: "GET /c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_1_b8835f35c094b78a385923ff85ddc95ecd75ea41.psf HTTP/1.1", upstream: "http://8.254.250.78:80/c/msdownload/update/software/secu/2017/03/windows10.0-kb4013198-x64_1_b8835f35c094b78a385923ff85ddc95ecd75ea41.psf", host: "download.windowsupdate.com"

@nexusofdoom
Copy link
Collaborator Author

trying this setup again

#Windows Updates
server {
listen lancache-microsoft deferred default;
server_name microsoft _;
access_log /srv/lancache/logs/Access/microsoft.log main buffer=128k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_range buffer=128k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log;

    # Default Node
    include lancache/resolver;
    include lancache/cache-key-default;
location / {
    #proxy_set_header   X-Real-IP $remote_addr;
    #proxy_set_header   Host      $http_host;
    proxy_http_version 1.1;
    proxy_set_header Connection "";
    proxy_send_timeout 1000s;
    proxy_connect_timeout 1000;
    # Some downloads are very large so we cache based on range to keep single downloads quick and hence ensure interactivity is good.
    proxy_bind 192.168.30.99;
    #proxy_cache_valid 200 400 206 320d;
    proxy_cache microsoft;
    proxy_read_timeout 1000;
    include lancache/proxy-cache;
    include lancache/cache-range;
}

}

@nexusofdoom
Copy link
Collaborator Author

got a message like this

unexpected status code 400 in slice response while reading response header from upstream

[error] 5801#0: *954 unexpected status code 400 in slice response while reading response header from upstream, client: 192.168.30.150, server: microsoft, request: "GET /c/msdownload/update/software/secu/2017/04/windows6.1-kb4015549-x64_bf8033c1dbede1fcd8b09e29328fddea5c44f8f4.psf HTTP/1.1", subrequest: "/c/msdownload/update/software/secu/2017/04/windows6.1-kb4015549-x64_bf8033c1dbede1fcd8b09e29328fddea5c44f8f4.psf", upstream: "http://13.107.4.50:80/c/msdownload/update/software/secu/2017/04/windows6.1-kb4015549-x64_bf8033c1dbede1fcd8b09e29328fddea5c44f8f4.psf", host: "au.download.windowsupdate.com"

@nexusofdoom
Copy link
Collaborator Author

maybe try this ?
If nginx is running as a proxy / reverse proxy

that is, for users of ngx_http_proxy_module

In addition to fastcgi, the proxy module also saves the request header in a temporary buffer.

So you may need also to increase the proxy_buffer_size and the proxy_buffers, or disable it totally (Please read the nginx documentation).

Example of proxy buffering configuration

http {
proxy_buffer_size 128k;
proxy_buffers 4 256k;
proxy_busy_buffers_size 256k;
}
Example of disabling your proxy buffer (recommended for long polling servers)

http {
proxy_buffering off;
}
For more information: Nginx proxy module documentation

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 12, 2017

# sudo service nginx status
● lancache.service - LSB: starts the lancache nginx web server
Loaded: loaded (/etc/init.d/lancache)
Active: active (running) since Tue 2017-04-11 19:45:37 CDT; 35s ago
Process: 6085 ExecStop=/etc/init.d/lancache stop (code=exited, status=0/SUCCESS)
Process: 6088 ExecStart=/etc/init.d/lancache start (code=exited, status=0/SUCCESS)
CGroup: /system.slice/lancache.service
├─6090 nginx: master process /usr/local/nginx/sbin/nginx
├─6091 nginx: worker process
├─6092 nginx: worker process
├─6093 nginx: worker process
├─6094 nginx: worker process
├─6095 nginx: cache manager process
└─6096 nginx: cache loader process

Apr 11 19:45:37 lancache-server lancache[6088]: Starting : nginx: [warn] could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or pr..._bucket_size
Apr 11 19:45:37 lancache-server lancache[6088]: nginx: [warn] could not build optimal proxy_headers_hash, you should increase either proxy_headers_hash_max_size: 512 or proxy_headers..._bucket_size
Apr 11 19:45:37 lancache-server lancache[6088]: lancache.
Apr 11 19:45:37 lancache-server systemd[1]: Started LSB: starts the lancache nginx web server.

there is a "warn" about proxy header hash size

change this in my ms-config "proxy_headers_hash_bucket_size 512;"

#Windows Updates
server {
listen lancache-microsoft deferred default;
server_name microsoft _;
access_log /srv/lancache/logs/Access/microsoft.log main buffer=256k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_slice buffer=256k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log debug;
proxy_ignore_client_abort on;
# Default Node
include lancache/resolver;
include lancache/cache-key-default;
location / {
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Accept-Encoding "";
proxy_headers_hash_bucket_size 512;
#proxy_set_header X-Real-IP $remote_addr;
#proxy_set_header Host $http_host;
#fastcgi_buffers 16 16k;
#fastcgi_buffer_size 32k;
#proxy_buffer_size 128k;
#proxy_buffers 4 256k;
#proxy_busy_buffers_size 256k;
proxy_http_version 1.1;
proxy_set_header Connection "";
#proxy_send_timeout 1000s;
#proxy_connect_timeout 1000;
# Some downloads are very large so we cache based on range to keep single downloads quick and hence ensure interactivity is good.
proxy_bind 192.168.30.99;
proxy_cache_valid 206 200 320d;
proxy_buffering off;
proxy_cache microsoft;
proxy_read_timeout 1000;
include lancache/proxy-cache;
include lancache/cache-slice;
}
}

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 12, 2017

so i see it still does try to download over and over

can we try this ?

http://serverfault.com/questions/526441/nginx-cant-handle-multiple-downloads

also should the file name be ?windows6.1-kb4015549-x64_bf8033c1dbede1fcd8b09e29328fddea5c44f8f4.psf" - KEY="microsoft/c/msdownload/update/software/secu/2017/04/windows6.1-kb4015549-x64_bf8033c1dbede1fcd8b09e29328fddea5c44f8f4.psf

when it downloads ?

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 12, 2017

https://www.mail-archive.com/nginx-devel@nginx.org/msg06079.html ??

added this to the ms config
etag off;

*1230 etag mismatch in slice response while reading response header from upstream, client: 192.168.30.126, server: microsoft, request: "GET /msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_fabe284ceaa1403debb09fad96cd5c0806f08648.psf HTTP/1.1", subrequest: "/msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_fabe284ceaa1403debb09fad96cd5c0806f08648.psf", upstream: "http://8.254.250.190:80/msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_fabe284ceaa1403debb09fad96cd5c0806f08648.psf", host: "download.windowsupdate.com"
2017/04/12 16:11:03 [error] 7047#0: *846 upstream prematurely closed connection while reading upstream, client: 192.168.30.126, server: microsoft, request: "HEAD /msdownload/update/software/secu/2012/01/windows6.1-kb2654428-x64_23e8331e1520a90b09a4e8bdc8b112f16aa5db28.psf HTTP/1.1", upstream: "http://13.107.4.50:80/msdownload/update/software/secu/2012/01/windows6.1-kb2654428-x64_23e8331e1520a90b09a4e8bdc8b112f16aa5db28.psf", host: "au.download.windowsupdate.com"

@nexusofdoom
Copy link
Collaborator Author

do we need to have proxy_pass ?

https://www.liaohuqiu.net/posts/nginx-proxy-pass/
'
in the config?

@nexusofdoom
Copy link
Collaborator Author

any issue whit this setup that any one can see ?

#Windows Updates
server {
listen lancache-microsoft deferred default;
server_name microsoft _;
proxy_ignore_client_abort on;
proxy_headers_hash_bucket_size 512;
etag off;
proxy_http_version 1.1;
proxy_set_header Connection "";
#proxy_buffering off;

access_log /srv/lancache/logs/Access/microsoft.log main buffer=256k flush=1m;
#access_log /srv/lancache/logs/Keys/microsoft.log keys_range buffer=256k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_uri;
error_log /srv/lancache/logs/Errors/microsoft.log;

    # Default Node
    include lancache/resolver;
    include lancache/cache-key-default;
location / {
    # new testing for the loop issue #
    proxy_ignore_headers Expires;
    proxy_cache_key "$server_name$uri";
    # Use Microsoft cache
    proxy_cache microsoft;
    proxy_read_timeout 300;
    include lancache/proxy-cache;
    }
    # Store results from /serverlist/ request as they should allow
    # us to determine if we are missing an DNS entries for content
    # servers
    location /serverlist/ {
    proxy_bind 10.0.4.21;
    proxy_store /srv/lancache/data/microsoft$uri/servers.txt;
    proxy_store_access user:rw group:rw all:r;
    include lancache/proxy-base;
    # Some downloads are very large so we cache based on range to keep single downloads quic$
}

}

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 15, 2017

can some one test this config

I tested with windows 7 and windows 10

#Windows Updates
server {
listen lancache-microsoft deferred default;
server_name microsoft _;

proxy_connect_timeout 300s;
proxy_send_timeout 300s;
proxy_read_timeout 300s;
send_timeout 300s;

#New Working Test
proxy_ignore_client_abort on;
proxy_headers_hash_bucket_size 512;
# Ensure we don't cache redirects to 3rd party CDNs
error_page 301 302 307 = @redirect;
recursive_error_pages on;
proxy_intercept_errors on;
proxy_hide_header Etag;
proxy_ignore_headers Expires;

access_log /srv/lancache/logs/Access/microsoft.log main buffer=128k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_slice buffer=128k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log;

    # Default Node
    include lancache/resolver;
    #include lancache/cache-key-default;


     location / {
             # Some downloads are very large so we cache based on range to keep single downloads quick and $
             proxy_http_version     1.1;
             proxy_set_header       Connection "";

             proxy_bind lc-host-proxybind;

             # Use Microsoft cache
             proxy_cache microsoft;
             proxy_read_timeout 300;
             proxy_connect_timeout 300;
             proxy_redirect off;
             include lancache/proxy-cache;
             include lancache/cache-slice;
     }

}

@nexusofdoom
Copy link
Collaborator Author

@nexusofdoom
Copy link
Collaborator Author

2017/04/15 07:49:19 [error] 1806#0: *555 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "HEAD /msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_fabe284ceaa1403debb09fad96cd5c0806f08648.psf HTTP/1.1", upstream: "http://8.254.250.78:80/msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_fabe284ceaa1403debb09fad96cd5c0806f08648.psf", host: "download.windowsupdate.com"
2017/04/15 07:49:19 [alert] 1806#0: *555 header already sent while sending to client, client: 10.0.4.146, server: microsoft, request: "HEAD /msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_fabe284ceaa1403debb09fad96cd5c0806f08648.psf HTTP/1.1", upstream: "http://8.254.250.78:80/msdownload/update/software/crup/2011/05/windows6.1-kb2533552-x64_fabe284ceaa1403debb09fad96cd5c0806f08648.psf", host: "download.windowsupdate.com"
2017/04/15 07:49:20 [error] 1806#0: *671 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /msdownload/update/software/updt/2013/01/windows6.1-kb2773072-x64_e2c4226095d8875ad3afb6c099e60bfa5841d501.psf HTTP/1.1", upstream: "http://8.254.247.46:80/msdownload/update/software/updt/2013/01/windows6.1-kb2773072-x64_e2c4226095d8875ad3afb6c099e60bfa5841d501.psf", host: "download.windowsupdate.com"
2017/04/15 07:49:22 [error] 1806#0: *686 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /d/msdownload/update/software/updt/2016/09/windows6.1-kb3184143-x64_65d06038aed40176c12ba906afacf3a559661f8f.psf HTTP/1.1", upstream: "http://8.253.185.120:80/d/msdownload/update/software/updt/2016/09/windows6.1-kb3184143-x64_65d06038aed40176c12ba906afacf3a559661f8f.psf", host: "download.windowsupdate.com"
2017/04/15 07:49:34 [error] 1806#0: *636 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /msdownload/update/software/updt/2013/01/windows6.1-kb2773072-x64_e2c4226095d8875ad3afb6c099e60bfa5841d501.psf HTTP/1.1", upstream: "http://8.254.255.248:80/msdownload/update/software/updt/2013/01/windows6.1-kb2773072-x64_e2c4226095d8875ad3afb6c099e60bfa5841d501.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:11 [error] 1806#0: *387 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /d/msdownload/update/software/updt/2015/08/windows6.1-kb3080149-x64_7f04209359a70696ec3ef1bb9fff418f9141677a.psf HTTP/1.1", upstream: "http://8.253.185.120:80/d/msdownload/update/software/updt/2015/08/windows6.1-kb3080149-x64_7f04209359a70696ec3ef1bb9fff418f9141677a.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:17 [error] 1806#0: *646 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /d/msdownload/update/software/secu/2015/12/windows6.1-kb3124275-x64_66b70b88da1494e5d52264fbdd67b1f44b1b7625.psf HTTP/1.1", upstream: "http://8.254.247.46:80/d/msdownload/update/software/secu/2015/12/windows6.1-kb3124275-x64_66b70b88da1494e5d52264fbdd67b1f44b1b7625.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:28 [error] 1803#0: *725 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /msdownload/update/software/secu/2011/10/windows6.1-kb2620704-x64_3ede4d815869dafe88622a9311e9c90ba526f13a.psf HTTP/1.1", upstream: "http://8.253.110.107:80/msdownload/update/software/secu/2011/10/windows6.1-kb2620704-x64_3ede4d815869dafe88622a9311e9c90ba526f13a.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:29 [error] 1806#0: *710 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /msdownload/update/software/secu/2012/10/windows6.1-kb2758857-x64_34f2ef52c0343937eaf53c4785f11eca4ff79482.psf HTTP/1.1", upstream: "http://8.254.250.78:80/msdownload/update/software/secu/2012/10/windows6.1-kb2758857-x64_34f2ef52c0343937eaf53c4785f11eca4ff79482.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:31 [error] 1803#0: *761 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /d/msdownload/update/software/secu/2016/01/windows6.1-kb3126587-x64_2afc8c530cac4bf8a5a30e1e509cd980a00cf3da.psf HTTP/1.1", upstream: "http://8.253.185.121:80/d/msdownload/update/software/secu/2016/01/windows6.1-kb3126587-x64_2afc8c530cac4bf8a5a30e1e509cd980a00cf3da.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:34 [error] 1804#0: *775 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /d/msdownload/update/software/secu/2016/01/windows6.1-kb3126587-x64_2afc8c530cac4bf8a5a30e1e509cd980a00cf3da.psf HTTP/1.1", upstream: "http://8.254.220.142:80/d/msdownload/update/software/secu/2016/01/windows6.1-kb3126587-x64_2afc8c530cac4bf8a5a30e1e509cd980a00cf3da.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:36 [error] 1804#0: *754 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /msdownload/update/software/secu/2011/01/windows6.1-kb2479943-x64_559c771d26760deb788ff433107616428b0587b9.psf HTTP/1.1", upstream: "http://8.254.250.62:80/msdownload/update/software/secu/2011/01/windows6.1-kb2479943-x64_559c771d26760deb788ff433107616428b0587b9.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:38 [error] 1805#0: *771 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /msdownload/update/software/secu/2011/01/windows6.1-kb2479943-x64_559c771d26760deb788ff433107616428b0587b9.psf HTTP/1.1", upstream: "http://8.254.220.142:80/msdownload/update/software/secu/2011/01/windows6.1-kb2479943-x64_559c771d26760deb788ff433107616428b0587b9.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:40 [error] 1805#0: *767 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /c/msdownload/update/software/secu/2014/09/windows6.1-kb2972100-x64_d1d976cfab848a0cf7d093a1ebc0e557548676aa.psf HTTP/1.1", upstream: "http://8.253.134.121:80/c/msdownload/update/software/secu/2014/09/windows6.1-kb2972100-x64_d1d976cfab848a0cf7d093a1ebc0e557548676aa.psf", host: "download.windowsupdate.com"
2017/04/15 07:50:43 [error] 1804#0: *747 upstream prematurely closed connection while reading upstream, client: 10.0.4.146, server: microsoft, request: "GET /msdownload/update/software/secu/2011/10/windows6.1-kb2620704-x64_3ede4d815869dafe88622a9311e9c90ba526f13a.psf HTTP/1.1", upstream: "http://8.253.110.235:80/msdownload/update/software/secu/2011/10/windows6.1-kb2620704-x64_3ede4d815869dafe88622a9311e9c90ba526f13a.psf", host: "download.windowsupdate.com"

@nexusofdoom
Copy link
Collaborator Author

upstream prematurely closed connection while reading upstream
header already sent while sending to client, client
readv() failed (104: Connection reset by peer) while reading upstream

@nexusofdoom
Copy link
Collaborator Author

nexusofdoom commented Apr 15, 2017

so this looks like a issue.

Too small listen queue on a backend resulting in occasional listen queue overflows (Linux is usually configured to just drop SYN packet in this case, thus making it indestinguishable from a packet loss; see netstat -s | grep listen to find out if it's the problem).

1 times the listen queue of a socket overflowed

@nexusofdoom
Copy link
Collaborator Author

@nexusofdoom
Copy link
Collaborator Author

so what I am running into is fresh install windows 7 sp1 has 194 updates
it caches most of it then about 61% in it re downloads files and looks like it does not cache. over and over
every time I try it does that. with windows 7

@nexusofdoom
Copy link
Collaborator Author

@nexusofdoom
Copy link
Collaborator Author

might want to add this also
Avoid caching 0-byte files on NGINX
ref
http://syshero.org/post/49594172838/avoid-caching-0-byte-files-on-nginx

map $upstream_http_content_length $flag_cache_empty {
default 0;
0 1;
}


my log file
10.0.4.179 - [15/Apr/2017:14:49:35 -0500] - REQUEST="GET /d/msdownload/update/software/defu/2017/04/am_base_8c3b35fb8998d3ae3595643def49cecaec6effc9.exe HTTP/1.1" - REQUEST_URI="/d/msdownload/update/software/defu/2017/04/am_base_8c3b35fb8998d3ae3595643def49cecaec6effc9.exe" - URI="/d/msdownload/update/software/defu/2017/04/am_base_8c3b35fb8998d3ae3595643def49cecaec6effc9.exe" - STATUS="206" - BYTES="0"

@nexusofdoom
Copy link
Collaborator Author

another config working with

map $upstream_http_content_length $flag_cache_empty {
default 0;
0 1;
}

#Windows Updates
server {
listen lancache-microsoft deferred default;
server_name microsoft _;
proxy_headers_hash_bucket_size 512;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_hide_header Etag;
proxy_ignore_headers Expires;
etag off;

proxy_set_header Host http://download.windowsupdate.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

access_log /srv/lancache/logs/Access/microsoft.log main buffer=128k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_range buffer=128k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log;

# Default Node
include lancache/resolver;

location / {
# Some downloads are very large so we cache based on range to keep single downloads quick and hen$

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_bind 10.0.4.21;
proxy_cache_valid 206 90d;
proxy_cache microsoft;
proxy_read_timeout 600;
include lancache/proxy-cache;
include lancache/cache-slice;

}
}

####################################################
errors that I get ...

2017/04/15 17:13:30 [error] 5761#0: *434 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_3_075b7dc98dbdf6ef5bc42128cb7b23cdeb8e1291.psf HTTP/1.1", upstream: "http://8.253.185.121:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_3_075b7dc98dbdf6ef5bc42128cb7b23cdeb8e1291.psf", host: "download.windowsupdate.com"
2017/04/15 17:13:35 [error] 5758#0: *245 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_1_fa92e751594b5a6722458ca9c6026e722cca39de.psf HTTP/1.1", upstream: "http://8.253.32.174:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_1_fa92e751594b5a6722458ca9c6026e722cca39de.psf", host: "download.windowsupdate.com"
2017/04/15 17:13:46 [error] 5758#0: *365 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_1_fa92e751594b5a6722458ca9c6026e722cca39de.psf HTTP/1.1", upstream: "http://8.253.32.174:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_1_fa92e751594b5a6722458ca9c6026e722cca39de.psf", host: "download.windowsupdate.com"
2017/04/15 17:13:46 [error] 5760#0: *271 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_3_075b7dc98dbdf6ef5bc42128cb7b23cdeb8e1291.psf HTTP/1.1", upstream: "http://8.253.32.174:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_3_075b7dc98dbdf6ef5bc42128cb7b23cdeb8e1291.psf", host: "download.windowsupdate.com"
2017/04/15 17:13:47 [error] 5758#0: *366 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_2_defd131e4bd52ae6ccdae18de6a7b378f3904881.psf HTTP/1.1", upstream: "http://8.254.250.94:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_2_defd131e4bd52ae6ccdae18de6a7b378f3904881.psf", host: "download.windowsupdate.com"
2017/04/15 17:13:55 [error] 5761#0: *246 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_1_fa92e751594b5a6722458ca9c6026e722cca39de.psf HTTP/1.1", upstream: "http://8.253.134.248:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_1_fa92e751594b5a6722458ca9c6026e722cca39de.psf", host: "download.windowsupdate.com"
2017/04/15 17:13:58 [error] 5758#0: *314 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_2_defd131e4bd52ae6ccdae18de6a7b378f3904881.psf HTTP/1.1", upstream: "http://8.253.32.174:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_2_defd131e4bd52ae6ccdae18de6a7b378f3904881.psf", host: "download.windowsupdate.com"
2017/04/15 17:14:00 [error] 5759#0: *235 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_4_be4b06ce500451f924ff664bad44089ca5b198e9.psf HTTP/1.1", upstream: "http://8.253.32.174:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_4_be4b06ce500451f924ff664bad44089ca5b198e9.psf", host: "download.windowsupdate.com"
2017/04/15 17:14:05 [error] 5758#0: *531 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_5_c4f85bcbb3c0b561032dd705509abbb3a3a30fcd.psf HTTP/1.1", upstream: "http://8.254.250.94:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_5_c4f85bcbb3c0b561032dd705509abbb3a3a30fcd.psf", host: "download.windowsupdate.com"
2017/04/15 17:14:10 [error] 5758#0: *233 upstream prematurely closed connection while reading upstream, client: 10.0.4.122, server: microsoft, request: "GET /d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_5_c4f85bcbb3c0b561032dd705509abbb3a3a30fcd.psf HTTP/1.1", upstream: "http://8.254.220.174:80/d/msdownload/update/software/secu/2017/04/windows10.0-kb4015217-x64_5_c4f85bcbb3c0b561032dd705509abbb3a3a30fcd.psf", host: "download.windowsupdate.com"

@nexusofdoom
Copy link
Collaborator Author

will it still cache the updates ?

When buffering is disabled, a response is passed to a client synchronously, as soon as it is received from the back-end.

nginx will not try to read the whole response from the proxied server.

The maximum size of the data that nginx can receive from the server at a time is set by the proxy_buffer_size directive.

proxy_buffering off;
proxy_buffer_size 128k;
proxy_buffers 100 128k;

https://tweaked.io/guide/nginx-proxying/

will it still cache the files ?

@nexusofdoom
Copy link
Collaborator Author

--------------------- the working config that I am using at my office -------------

map $upstream_http_content_length $flag_cache_empty {
default 0;
0 1;
}

#Windows Updates
server {

listen lancache-microsoft deferred default;
server_name microsoft _;

proxy_ignore_client_abort on;
proxy_headers_hash_bucket_size 512;

proxy_http_version 1.1;
proxy_set_header Connection "";

proxy_hide_header Etag;
#proxy_ignore_headers Expires;
etag off;

proxy_set_header Host http://download.windowsupdate.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_cache_key "$scheme$proxy_host$request_uri $http_range";
proxy_set_header Range $http_range;

#proxy_buffering off;
#proxy_buffer_size 128k;
#proxy_buffers 100 128k;

access_log /srv/lancache/logs/Access/microsoft.log main buffer=128k flush=1m;
access_log /srv/lancache/logs/Keys/microsoft.log keys_range buffer=128k flush=1m;
error_log /srv/lancache/logs/Errors/microsoft.log;

# Default Node
include lancache/resolver;
#include lancache/cache-key-default;
#include lancache/cache-key-range;

location / {
# Some downloads are very large so we cache based on range to keep single downloads quick and hen$

proxy_bind 192.168.30.106;
#proxy_cache_valid 206 90d;
proxy_cache microsoft;

proxy_connect_timeout 150s;
proxy_send_timeout 150s;
proxy_read_timeout 150s;
send_timeout 150s;

include lancache/proxy-cache;
include lancache/cache-range;

}
}

@bntjah
Copy link
Owner

bntjah commented Apr 28, 2017

Closing this as it works now and config is adapted as posted by Nexusofdoom

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants