-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Fix courier "request already started" bug #6651
Fix courier "request already started" bug #6651
Conversation
this._all = queue.slice(0); | ||
|
||
// Send the initial fetch status | ||
this._reportStatus(); | ||
|
||
return super.start(); |
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.
Moving this may be a problem. I'm not 100% on that, but I seem to remember there being a very specific reason why the parent constructor wasn't invoked until after the queue was created. Gross as hell though, and I really should have left a comment about it in the code.
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.
Yeah, I went looking for the discussion we had about it, but I'm pretty sure it's just what I talked about in the last paragraph of my description:
It feels wrong to me that the request is marked "started" before it's start() method is done, but the only other solution I have in mind requires that only one courier fetch cycle can initialize at a time (a much more impactful change).
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.
Thankfully the AbstractRequest#start()
method is pretty simple and really only exists for reporting purposes and to make sure that requests aren't being executed multiple times.
I updated the PR description to reference the ticket. |
This LGTM. Assigning to @epixa to merge |
--------- **Commit 1:** [courier/segmentedRequest] mark the request "started" synchronously * Original sha: 8a49926 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:00Z **Commit 2:** [courier/fetch] detect aborted requests more agressively * Original sha: c12f18d * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:46Z **Commit 3:** [courier/callClient] if there are no executable requests, do nothing * Original sha: 8fef03b * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:36:18Z **Commit 4:** [courier/tests] updated test * Original sha: 985f997 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T22:25:31Z
--------- **Commit 1:** [courier/segmentedRequest] mark the request "started" synchronously * Original sha: 8a49926 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:00Z **Commit 2:** [courier/fetch] detect aborted requests more agressively * Original sha: c12f18d * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:46Z **Commit 3:** [courier/callClient] if there are no executable requests, do nothing * Original sha: 8fef03b * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:36:18Z **Commit 4:** [courier/tests] updated test * Original sha: 985f997 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T22:25:31Z
--------- **Commit 1:** [courier/segmentedRequest] mark the request "started" synchronously * Original sha: 8a49926 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:00Z **Commit 2:** [courier/fetch] detect aborted requests more agressively * Original sha: c12f18d * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:46Z **Commit 3:** [courier/callClient] if there are no executable requests, do nothing * Original sha: 8fef03b * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:36:18Z **Commit 4:** [courier/tests] updated test * Original sha: 985f997 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T22:25:31Z
--------- **Commit 1:** [courier/segmentedRequest] mark the request "started" synchronously * Original sha: 8a49926 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:00Z **Commit 2:** [courier/fetch] detect aborted requests more agressively * Original sha: c12f18d * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:35:46Z **Commit 3:** [courier/callClient] if there are no executable requests, do nothing * Original sha: 8fef03b * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T21:36:18Z **Commit 4:** [courier/tests] updated test * Original sha: 985f997 * Authored by spalger <spalger@users.noreply.github.com> on 2016-03-24T22:25:31Z
The current implementation of the
SegmentedRequest
doesn't mark the request started until after thefieldStats
api provides an index list.This means that if two courier fetch cycles start in close succession then the same request will be included in both, causing a "Unable to start request because it has already started" error to be thrown.
This protects against that by calling the
super.start()
method synchronously and then asynchronously populating the index queue. It feels wrong to me that the request is marked "started" before it'sstart()
method is done, but the only other solution I have in mind requires that only one courier fetch cycle can initialize at a time (a much more impactful change).Fixes #5828