• Tom Bergan's avatar
    http2: log Framer reads and writes when a server test fails · cbed01e8
    Tom Bergan authored
    To help debug rare nondeterministic server_test failures, log Framer
    reads and writes. Sample output from an injected test failure:
    
    $ go test golang.org/x/net/http2
    --- FAIL: TestServer_Request_Reject_Pseudo_scheme_invalid (0.00s)
        server_test.go:998: server request made it to handler; should've been rejected
        server_test.go:514: got a *http2.HeadersFrame; want *RSTStreamFrame
        server_test.go:229: Framer read log:
            2016-12-07 17:06:11.907199013 Framer 0xc4212665b0: read SETTINGS len=18, settings: MAX_FRAME_SIZE=1048576, MAX_CONCURRENT_STREAMS=250, MAX_HEADER_LIST_SIZE=1048896
            2016-12-07 17:06:11.907523124 Framer 0xc4212665b0: read SETTINGS flags=ACK len=0
            2016-12-07 17:06:11.908090453 Framer 0xc4212665b0: read HEADERS flags=END_STREAM|END_HEADERS stream=1 len=48
        server_test.go:235: Framer write log:
            2016-12-07 17:06:11.907152927 Framer 0xc4212665b0: wrote SETTINGS len=0
            2016-12-07 17:06:11.907207016 Framer 0xc4212665b0: wrote SETTINGS flags=ACK len=0
            2016-12-07 17:06:11.907550525 Framer 0xc4212665b0: wrote HEADERS flags=END_STREAM|END_HEADERS stream=1 len=16
    
    Framer logs are written at the end of a test only if the test failed
    and only if http2debug!=2. (If http2debug=2, then Framer logs are already
    written to stdout.)
    
    Hopefully this will help debug flaky tests. Or it might not.
    The code is kind of ugly.
    
    Updates golang/go#18235
    
    Change-Id: I74c8ef82521d81f123663c98c883c71d9843964f
    Reviewed-on: https://go-review.googlesource.com/34130
    Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
    Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
    cbed01e8
Name
Last commit
Last update
bpf Loading commit data...
context Loading commit data...
dict Loading commit data...
html Loading commit data...
http2 Loading commit data...
icmp Loading commit data...
idna Loading commit data...
internal Loading commit data...
ipv4 Loading commit data...
ipv6 Loading commit data...
lex/httplex Loading commit data...
lif Loading commit data...
nettest Loading commit data...
netutil Loading commit data...
proxy Loading commit data...
publicsuffix Loading commit data...
route Loading commit data...
trace Loading commit data...
webdav Loading commit data...
websocket Loading commit data...
xsrftoken Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
AUTHORS Loading commit data...
CONTRIBUTING.md Loading commit data...
CONTRIBUTORS Loading commit data...
LICENSE Loading commit data...
PATENTS Loading commit data...
README Loading commit data...
codereview.cfg Loading commit data...