Fasthttp: client.DoTimeout "invalid memory address or nil pointer dereference"

Created on 11 Apr 2019  路  2Comments  路  Source: valyala/fasthttp

req := fasthttp.AcquireRequest()
...
err := client.DoTimeout(req, nil, time.Second)

panic: runtime error: invalid memory address or nil pointer dereference

github.com/valyala/fasthttp.clientDoDeadline(0xc000a34000, 0x0, 0xbf23ec19e394166b, 0x3c853c05, 0xe24720, 0xa76c20, 0xc0009f2000, 0xc000a460c0, 0xc000a460c0)
    /Users/vesninandrey/go/src/github.com/valyala/fasthttp/client.go:990 +0x211
github.com/valyala/fasthttp.clientDoTimeout(0xc000a34000, 0x0, 0x3b9aca00, 0xa76c20, 0xc0009f2000, 0xc000a460c0, 0x0)
    /Users/vesninandrey/go/src/github.com/valyala/fasthttp/client.go:966 +0x7f
github.com/valyala/fasthttp.(*Client).DoTimeout(...)
    /Users/vesninandrey/go/src/github.com/valyala/fasthttp/client.go:330

Comment here tells me that i can use nil resp:
https://github.com/valyala/fasthttp/blob/master/client.go#L950

But, after that, here is nil pointer dereference:
https://github.com/valyala/fasthttp/blob/master/client.go#L990

Is that error or i do something wrong?

bug

Most helpful comment

I have just pushed a fix.

All 2 comments

That is indeed a bug, I'll see if I can commit a fix tonight.

I have just pushed a fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

LeMoussel picture LeMoussel  路  3Comments

kirillDanshin picture kirillDanshin  路  5Comments

djannot picture djannot  路  3Comments

danilobuiatti picture danilobuiatti  路  3Comments

Fenny picture Fenny  路  3Comments