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

result.ContentTransfer freezed value since update Go1.8 #13

Open
bennneuh opened this issue Apr 11, 2017 · 11 comments
Open

result.ContentTransfer freezed value since update Go1.8 #13

bennneuh opened this issue Apr 11, 2017 · 11 comments

Comments

@bennneuh
Copy link

Hello,

Thanks again for the update in 1.8

I have a small issue since the update. I'm not sure it's linked to the update, but i don't understand.

i always have the same fix value for ContentTransfert:

with:

end := time.Now()
fmt.Println("result.ContentTransfer(end) ", result.ContentTransfer(end))

The result is always:
result.ContentTransfer(end) 2562047h47m16.854775807s

Thanks for your help,

Benoît

@bennneuh
Copy link
Author

FYI i have tested in the example "_example" by adding:
` end := time.Now()

log.Printf("YO Name Lookup:    %d ms", int(result.NameLookup/time.Millisecond))
log.Printf("YO Connect:        %d ms", int(result.Connect/time.Millisecond))
log.Printf("YO Start Transfer: %d ms", int(result.StartTransfer/time.Millisecond))
log.Printf("YO Total:          %d ms", int(result.Total(end)/time.Millisecond))`

i have the same issue.

But no issue with
fmt.Printf("%+v\n", result)

@bennneuh
Copy link
Author

For the moment i have fixed the issue like that:

`func (r *Result) ContentTransfer(t time.Time) time.Duration {
//return t.Sub(r.t4)
return r.contentTransfer
}

// Total returns the duration of total http request.
// It is from dns lookup start time to the given time. The
// time must be time after read body (go-httpstat can not detect that time).
func (r *Result) Total(t time.Time) time.Duration {
//return t.Sub(r.t0)
return r.total
}`

But i'm sure it's not the best way :) because the "t" is useless and i need to run result.End(end) before.

@yanc0
Copy link

yanc0 commented May 1, 2017

On yanc0/beeping we locked this package on commit fae40520f4ba0a112874d1f0deb9498ebb2198cb before the regression.

[[dependencies]]
  name = "github.com/tcnksm/go-httpstat"
  revision = "fae40520f4ba0a112874d1f0deb9498ebb2198cb"

@davinchia
Copy link

davinchia commented May 8, 2017

Also facing this issue.

Its constantly returning 9223372036854 ms for me.

Printing out results gives me TLSHandshake: 193 ms, ServerProcessing: 100 ms, ContentTransfer: - ms, so seems to be not recording anything.

@bennneuh
Copy link
Author

Up :)

@tzdybal
Copy link

tzdybal commented Nov 9, 2017

I was googling for 2562047h47m16.854775807s and found this post (we also have a problem with dates ethereumproject/go-ethereum#366).

The root of the problem is: time difference is calculated against zero value of time.Time. This causes overflow intime.Sub, which causes returning maxDuration constant.

The value for this constant is exactly 2562047h47m16.854775807s or 9223372036854 or 1<<63 -1 (nanoseconds).

@rif
Copy link

rif commented Nov 21, 2017

Yes, looks like the variables t0-t4 are no longer populated but they are still used by ContentTransfer and Total methods, resulting the duration since zero time.
But I only had this issue because I was using dep tool with the latest release, switching to master solved this issue.

@anthonynsimon
Copy link

I also found this issue when using dep, in my case it's resolving to the latest release (v0.2.0).

Probably adding a new release with the corresponding bump in the semver would fix this for other dep users?

@johannesfritsch
Copy link

Same problem here. Fixed at some older revision for now.

@vincentvdk
Copy link

using go get github.com/tcnksm/go-httpstat@master fixed it for me.

@teja42
Copy link

teja42 commented Dec 24, 2021

using go get github.com/tcnksm/go-httpstat@master fixed it for me.

Yep this worked for me. I'm using go v1.17

aboritskiy pushed a commit to sitewards/crowlet that referenced this issue Nov 11, 2022
before it was printing the same huge number for all requests,
see tcnksm/go-httpstat#13 (comment)
Pixep pushed a commit to Pixep/crowlet that referenced this issue Nov 12, 2022
before it was printing the same huge number for all requests,
see tcnksm/go-httpstat#13 (comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants