Skip to content

Do not write to the cache if the plugin decides not to write#7461

Merged
vmamidi merged 1 commit intoapache:masterfrom
vmamidi:cache_no_store
Feb 2, 2021
Merged

Do not write to the cache if the plugin decides not to write#7461
vmamidi merged 1 commit intoapache:masterfrom
vmamidi:cache_no_store

Conversation

@vmamidi
Copy link
Copy Markdown
Contributor

@vmamidi vmamidi commented Jan 29, 2021

TSHttpTxnServerRespNoStoreSet can be called after READ_REQUEST_HDR state. For example, cache promotes plugin calls this at TS_EVENT_HTTP_CACHE_LOOKUP_COMPLETE hook.
Checking the api_server_response_no_store flag after receiving the origin server response could create a race condition when a request that is not chosen to update the cache by cache promote plugin is holding the lock.

request1---holds the locks( not chosen to write to cache)---request2---fails to acquire the lock(selected to write to cache)

This causes both the requests to not write to cache.

Checking for the flag api_server_response_no_store before moving into the CACHE_ISSUE_WRITE state avoids the cache write lock and avoids the race.

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants