davecheney / httpstat

It's like curl -v, with colours.
MIT License
7.07k stars 385 forks source link

http2 tracing is broken on windows #90

Closed aitva closed 8 years ago

aitva commented 8 years ago

I'm testing httpstat on a Windows machine and I get a huge TCP Connection time.

D:\>httpstat http://139.110.74.200/dsrv/status

Connected to 139.110.74.200:80

HTTP/1.1 200 OK
Server: Apache/2.4.6 (Red Hat Enterprise Linux) PHP/5.4.16
Content-Type: text/xml
Date: Thu, 11 Aug 2016 09:36:27 GMT
X-Powered-By: PHP/5.4.16

Body discarded

   DNS Lookup   TCP Connection   Server Processing   Content Transfer
[       0ms  |     9223372036854ms  |              9ms  |             1ms  ]
             |                |                   |                  |
    namelookup:0ms            |                   |                  |
                        connect:9223372036854ms         |                  |
                                      starttransfer:9223372036854ms        |
                                                                 total:922337203
6854ms

I have tried changing the HTTP_PROXY variable and when using a local cntlm proxy it goes back to something reasonable:

D:\>set HTTP_PROXY=localhost:3128

D:\>set HTTPS_PROXY=localhost:3128

D:\>httpstat http://139.110.74.200/dsrv/status

Connected to 127.0.0.1:3128

HTTP/1.1 200 OK
Server: Apache/2.4.6 (Red Hat Enterprise Linux) PHP/5.4.16
Accept-Ranges: none
Content-Length: 415
Content-Type: text/xml
Date: Thu, 11 Aug 2016 09:43:50 GMT
Proxy-Connection: close
Via: 1.1 gproxy.postal.local:8080
X-Powered-By: PHP/5.4.16

Body discarded

   DNS Lookup   TCP Connection   Server Processing   Content Transfer
[       0ms  |           0ms  |             29ms  |             0ms  ]
             |                |                   |                  |
    namelookup:0ms            |                   |                  |
                        connect:0ms               |                  |
                                      starttransfer:29ms             |
                                                                 total:29ms

I can provide additional information if needed.

(Thanks for this tool, it is awesome !)

davecheney commented 8 years ago

@aitva how reproducible is this?

moorereason commented 8 years ago

I can reproduce it on Windows 10 but only when making HTTP/2 requests. t3 (WroteRequest) and t4 (GotFirstResponseByte) are coming back with zero time values. The request appears to be completing, but the httptrace hooks don't appear to be firing.

HTTP/1.1 requests (http and https) work fine for me, which is different from what @aitva is reporting.

moorereason commented 8 years ago

We've likely found a bug in Go 1.7.1 windows/amd64.

On an HTTP/2 trace, I only see the following hooks firing (in this order):

$ go run main.go https://www.google.com/
GetConn
DNSStart
DNSDone
ConnectStart
ConnectDone

On a working, non-HTTP/2 trace, I get hooks firing in this order:

$ go run main.go http://www.google.com/
GetConn
DNSStart
DNSDone
ConnectStart
ConnectDone
GotConn
WroteHeaders
WroteRequest
GotFirstResponseByte
PutIdleConn

I've created a test branch that prints out when each httptrace hook fires if anyone wants to test it.

/cc @bradfitz @rakyll

PS - Dave, can you update the title of this issue? "http2 tracing is broken on windows"

h1k0n commented 8 years ago

I know how to reproduce it. If we directly set proxy server's ip in set https_proxy=${ip}:${port} httpstat https://www.google.com or directly set server's ip like this: httpstat http://${ip}:${port} then this issue happen. The reason is DNSStart and DNSDone are not triggered.

moorereason commented 8 years ago

@h1k0n, thanks for the heads up, but that's a separate issue. See #97

moorereason commented 8 years ago

Works correctly on Windows 7.

moorereason commented 8 years ago

@h1k0n was right about the original report being about skipping DNS, which means I hijacked this ticket. My apologies. The original report should be resolved along with #97.

Now, back to Windows...

I tested on a standard Windows 10 machine (version 1511, build 10586.589) this morning, and it works fine. Last night I was testing on Windows 10 Insider edition, but I don't have that device with me right now. I'll try to do more testing this evening (that's about 8 hours from now).

aitva commented 8 years ago

I am having this issue on Windows 7. I have tried with a different server and I get the same result :

D:\>httpstat http://159.217.43.49

Connected to 159.217.43.49:80

HTTP/1.1 200 OK
Server: Apache/2.2.11 (Win32) PHP/5.3.0
Content-Length: 4959
Content-Type: text/html
Date: Thu, 29 Sep 2016 15:42:17 GMT
X-Powered-By: PHP/5.3.0

Body discarded

   DNS Lookup   TCP Connection   Server Processing   Content Transfer
[       0ms  |     9223372036854ms  |             11ms  |             0ms  ]
             |                |                   |                  |
    namelookup:0ms            |                   |                  |
                        connect:9223372036854ms         |                  |
                                      starttransfer:9223372036854ms        |
                                                                 total:922337203
6854ms

But, when doing the same request with the hostname the issue goes away :

D:\>httpstat http://srv-dbovs

Connected to 159.217.43.49:80

HTTP/1.1 200 OK
Server: Apache/2.2.11 (Win32) PHP/5.3.0
Content-Length: 4959
Content-Type: text/html
Date: Thu, 29 Sep 2016 15:42:22 GMT
X-Powered-By: PHP/5.3.0

Body discarded

   DNS Lookup   TCP Connection   Server Processing   Content Transfer
[       5ms  |           5ms  |             10ms  |             0ms  ]
             |                |                   |                  |
    namelookup:5ms            |                   |                  |
                        connect:10ms              |                  |
                                      starttransfer:20ms             |
                                                                 total:21ms

I have also tried on a Debian 8 computer and I can't reproduce the problem.

The issue seems to arise on Windows 7 and only without DNS lookup. I can provide you more information, but I will need guidance. There might be something in the corporate network or in my configuration which causes the issue.

moorereason commented 8 years ago

@aitva, The issue you're seeing should have been fixed already.

What version of httpstat are you running (httpstat -v)? If you're building manually, what git commit are you using (git log --oneline -1).

moorereason commented 8 years ago

Confirming that I'm seeing this issue on Windows 10 Pro Insider Preview Build 14379.rs1_release.160627-1607. I'm not sure what this Insider build could be doing to break the network stack, so we may can just close this, or at least remove it from the Stable release milestone.

This Insider build is about to expire anyway, so I'll need to install the newest build and test after the upgrade.

davecheney commented 8 years ago

@aitva can you please use the 1.0.0-beta.1 release binary that I made last night. If it fails please include the output of httpstat -v with your report.

On Fri, 30 Sep 2016, 09:10 Cameron Moore notifications@github.com wrote:

Confirming that I'm seeing this issue on Windows 10 Pro Insider Preview Build 14379.rs1_release.160627-1607. I'm not sure what this Insider build could be doing to break the network stack, so we may can just close this as, or at least remove it from the Stable release milestone.

This Insider build is about to expire anyway, so I'll need to install the newest build and test after the upgrade.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/davecheney/httpstat/issues/90#issuecomment-250617853, or mute the thread https://github.com/notifications/unsubscribe-auth/AAAcA_VmhnUN4jnBOQIuRcGvFqpPSxiqks5qvEVjgaJpZM4KInLK .

aitva commented 8 years ago

I have just tried the binary release, everything is working. @moorereason @davecheney thank you for the correction!

moorereason commented 8 years ago

@davecheney, I installed the latest Windows 10 Pro Insider Preview last night, and it bricked my laptop. :trophy:

Please close this issue. The stable Windows 10 builds appear to be working just fine.