-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
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
progress: Track total times following redirects #1602
Conversation
Coverage decreased (-73.8%) to 0.0% when pulling 6d4cac17fd64bf0fa8e74194fb18c01045399849 on rylwin:total-times-on-redirect into 8de8f4e on curl:master. |
6d4cac1
to
7852e3c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks good to me!
tests/unit/unit1399.c
Outdated
static void complete_aggregate_timed_activities(struct Curl_easy *data) | ||
{ | ||
for(unsigned int i = 0; i < sizeof(aggregate_timerids); i++) { | ||
Curl_pgrsTime(data, aggregate_timerids[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a comment above the Curl_pgrsTime() function in progress.c to mention @unittest: 1399
. We marked other unit-tested functions that way before and it could be worth keeping that tradition (to help us slowly test more and more functions).
7852e3c
to
d7ab12b
Compare
Thanks for the review @bagder! I've added the A couple other items to flag in case they are issues:
I'll drop another note in this conversation once the new builds finish to confirm the |
The ranges are only for convenience, but I see that we also have 1600-1699 marked for unit tests so I think we should be good a little longer! |
Coverage decreased (-73.8%) to 0.0% when pulling 7852e3ccf4ada32b3ee60fecc87de1d3c8fabafd on rylwin:total-times-on-redirect into 8de8f4e on curl:master. |
I suspect it is. It ls the lib500.c and seems to detect that the starttransfer time is larger than the total time, which does sound odd:
|
Coverage decreased (-73.8%) to 0.0% when pulling d7ab12bb81dfa8b86dc733557e5576ebaa9ecba5 on rylwin:total-times-on-redirect into 9b167fd on curl:master. |
Coverage decreased (-73.8%) to 0.0% when pulling 46e6cce453bb83edcc4e191038083ad32d24922f on rylwin:total-times-on-redirect into 9b167fd on curl:master. |
I noticed something interesting when looking into the issue of starttransfer being greater than total, and I could use some input on what the correct behavior is and/or how to further debug. What I've found is that sometimes
Previously, capturing the time of Even more interesting is that I can apply the same debug/logging code to Conceptually, I wouldn't think it would be correct for |
I agree that setting I think the reason for the double setting is simply because the state in which it sets it doesn't change when set so it can detect a believed start situation again! |
Makes sense to resolve before merging this PR. I'm happy to take a stab at it, though not being very familiar with the code I could use some guidance on what you think the best approach might be. Do you think it's as simple as checking within Or is the double invocation a symptom of a larger problem that needs to be solved? e.g., perhaps there's a bug in Let me know your thoughts and I'll start working on this in a new issue/PR. Thanks! |
I think that should be enough. And at least an improvement from what we have now. |
Prevent `Curl_pgrsTime` from modifying `t_starttransfer` when invoked with `TIMER_STARTTRANSFER` more than once during a single request. When a redirect occurs, this is considered a new request and `t_starttransfer` can be updated to reflect the `t_starttransfer` time of the redirect request. Closes #1616 Bug: #1602 (comment)
568e24b
to
826ee42
Compare
Update the progress timers `t_nslookup`, `t_connect`, `t_appconnect`, `t_pretransfer`, and `t_starttransfer` to track the total times for these activities when a redirect is followed. Previously, only the times for the most recent request would be tracked. Related changes: - Rename `Curl_pgrsResetTimesSizes` to `Curl_pgrsResetTransferSizes` now that the function only resets transfer sizes and no longer modifies any of the progress timers. - Add a bool to the `Progress` struct that is used to prevent double-counting `t_starttransfer` times. Added test case 1399. Fixes curl#522 and Known Bug 1.8 Reported-by: joshhe
826ee42
to
6872ff8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've updated this PR now that f8f040e
(progress: prevent resetting t_starttransfer) and related fixes for broken tests are in master.
The logic for handling multiple invocations of Curl_pgrsTime
with TIMER_STARTTRANSFER
had to change a bit: I've adding a bool to track whether we should be modifying t_starttransfer (or not if it is a repeated call for the same request).
Looking forward to your comments!
@@ -1255,6 +1255,8 @@ struct Progress { | |||
struct timeval t_startop; | |||
struct timeval t_acceptdata; | |||
|
|||
bool is_t_startransfer_set; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK to modify the Progress
struct? And to insert this variable in the middle of the struct? Is there any code (internal or external) that would depend on specific offsets accessing vars here?
I'm on track for merging this now. Minor edit needed since 4dee50b but I fixed it locally. |
Thank you, and sorry for taking so long to merge it! |
Not a problem--thanks for the support and guidance on this and the related PRs! |
Update the progress timers
t_nslookup
,t_connect
,t_appconnect
,t_pretransfer
, andt_starttransfer
to track the total times forthese activities when a redirect is followed. Previously, only the times
for the most recent request would be tracked.
As a related change, rename
Curl_pgrsResetTimesSizes
toCurl_pgrsResetTransferSizes
now that the function only resets transfersizes and no longer modified any of the progress timers.
Added test case 1399.
Fixes #522 and Known Bug 1.8
Reported-by: joshhe