Workaround for If-Modified-Since HTTP request header causing cache corruption#665
Merged
bitwiseman merged 11 commits intohub4j:masterfrom Jan 18, 2020
Merged
Conversation
e29b1b2 to
0d9ec1c
Compare
0d9ec1c to
72aedbb
Compare
bitwiseman
commented
Jan 14, 2020
| // | ||
| // NOTE: This is even worse than you might think: 404 responses don't return an ETAG, but 304 responses do. | ||
| // | ||
| // Due erroneous 304 returned from "If-Modified-Since", the ETAG returned by the first 304 |
Member
Author
There was a problem hiding this comment.
|
@bitwiseman I would suggest looking into the logic of the github branch source plugin as well. The problem here as per https://issues.jenkins-ci.org/browse/JENKINS-60353 is that Jenkins checks the existence of the Jenkinsfile for the 'MERGE' head of a non-mergeable request, the one that does not exist a priori and then consequently marks the pr as dead/non-buildable. |
Member
Author
|
@aglarendil |
This is a first cut at working round hub4j#669. It is hacky as hell and I hate it.
This reverts commit 90d7fea.
This is much more reasonable way to address this issue. When the Requester detects a 404 response with an ETag (only happpens when the server's 304 is bogus and would cause cache corruption), try the query again with new request header that forces the server to not return 304 and return new data instead. Ths solution is transparent to users of this library and autmatically fixes a situation that was causing cache corruption. If GitHub ever fixes the issue and begins providing accurate ETags to their 404 responses, this will result in two calls being made for each 404 response. While that would be unfortunate, it would still be better than the current situation.
OkHttp2 doesn't invalidate caches sometimes when it probably should
983c72b to
3479e4f
Compare
If-Modified-Since HTTP request header causing cache corruption
55e1d3b to
66a1803
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR shows a low level repro of an issue that has been plaguing Jenkins users for at least the last year.
EDIT: Similar to isaacs/github#692 but not the same
Key Takeaways
Basic Repro Steps
This basic process can be used for many queries that return 404. Using Ref creation as an example: