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

Panic on invalid response #159

Closed
igorwwwwwwwwwwwwwwwwwwww opened this issue Sep 11, 2016 · 5 comments
Closed

Panic on invalid response #159

igorwwwwwwwwwwwwwwwwwwww opened this issue Sep 11, 2016 · 5 comments
Labels
Milestone

Comments

@igorwwwwwwwwwwwwwwwwwwww

Fabio version: 1.3.1

Consul service definition:

{
    "service": {
        "name": "web",
        "tags": ["urlprefix-/"],
        "port": 7778,
        "check": {"script": "true", "interval": "10s"}
    }
}

Note that there is nothing listening on that port.

Curl command:

curl http://localhost:9999

Error:

2016/09/11 18:05:01 http: panic serving [::1]:64335: runtime error: invalid memory address or nil pointer dereference
goroutine 99 [running]:
net/http.(*conn).serve.func1(0xc420070c80)
        /usr/local/Cellar/go/1.7.1/libexec/src/net/http/server.go:1491 +0x12a
panic(0x3da840, 0xc42000c0f0)
        /usr/local/Cellar/go/1.7.1/libexec/src/runtime/panic.go:458 +0x243
github.com/eBay/fabio/proxy.(*meteredRoundTripper).RoundTrip(0xc42022c9d0, 0xc420166a50, 0xf, 0xc42022c921, 0x3)
        /private/tmp/fabio-20160909-52715-13mnwwi/fabio-1.3.1/src/github.com/eBay/fabio/proxy/http.go:28 +0x7f
net/http/httputil.(*ReverseProxy).ServeHTTP(0xc4201a3040, 0x630da0, 0xc4201b69c0, 0xc420166960)
        /usr/local/Cellar/go/1.7.1/libexec/src/net/http/httputil/reverseproxy.go:214 +0x335
github.com/eBay/fabio/proxy.(*httpProxy).ServeHTTP(0xc4200da0e0, 0x630da0, 0xc4201b69c0, 0xc420166960)
        /private/tmp/fabio-20160909-52715-13mnwwi/fabio-1.3.1/src/github.com/eBay/fabio/proxy/proxy.go:64 +0x2c2
net/http.serverHandler.ServeHTTP(0xc420107000, 0x630da0, 0xc4201b69c0, 0xc420166960)
        /usr/local/Cellar/go/1.7.1/libexec/src/net/http/server.go:2202 +0x7d
net/http.(*conn).serve(0xc420070c80, 0x631560, 0xc4201a2fc0)
        /usr/local/Cellar/go/1.7.1/libexec/src/net/http/server.go:1579 +0x4b7
created by net/http.(*Server).Serve
        /usr/local/Cellar/go/1.7.1/libexec/src/net/http/server.go:2293 +0x44d

I hope that's enough information for you to reproduce the issue.

@magiconair
Copy link
Contributor

Could you add the config from the log please and maybe the startup parameters?

@magiconair
Copy link
Contributor

I think I know what the problem is. I'll fix it later and push a patch. Thanks for submitting

@magiconair magiconair changed the title Panic on invalid port number Panic on invalid response Sep 11, 2016
@magiconair magiconair added the bug label Sep 11, 2016
@magiconair magiconair added this to the 1.3.2 milestone Sep 11, 2016
@magiconair
Copy link
Contributor

I thought I had fixed that one already. The meteredRoundtripper is not checking whether the http.Response is valid before trying to get the statusCode.

magiconair added a commit that referenced this issue Sep 11, 2016
The metered roundtripper is not checking whether the
response is valid before registering the status code.
This leads to a panic on that handler. This patch
fixes this behavior.
@magiconair
Copy link
Contributor

Merged and released v1.3.2

@igorwwwwwwwwwwwwwwwwwwww
Copy link
Author

Awesome, thanks for the quick response and fix! 💖

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

No branches or pull requests

2 participants