Queries that send the same request can share parsed results

Open
#878 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
54/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
php, wordpress
Domain
backend

Research direction

Read the options and tradeoffs in issue #874, then trace how the parsed-results cache keys requests and how cache_get and cache_save are used. Check how the fix preserves duplicate suppression for failed and PUT, PATCH, or DELETE requests, along with subclass overrides and existing cache keys. Done means queries with the same request but different response processing no longer share parsed results.

Written by the indexing model from the issue text.

Description

Description

The in-memory cache for parsed results is keyed only by the request details. If two queries send the same request but process the response differently in one PHP request, the second gets the first one's result.

The same can happen within one query when an input changes the result but not the request.

Impact

Narrow. It mainly affects custom queries that share a URL, or the same data source set up twice with different mappings. The built-in Google Sheets item and list queries aren't affected, because the item query sends an extra header.

We haven't had a report of it.

Notes for a fix

  • The current behaviour also stops identical failed and PUT, PATCH or DELETE requests from being sent twice. A fix needs to keep that, or accept the change.
  • Changing cache_get or cache_save would break subclasses that override them.
  • A subclass may also rely on the current cache keys.

The options considered and their tradeoffs are in #874.

Dominant language
PHP
Stars
86
Forks
14
Avg merge
1d 5h
Merged PRs (30d)
23

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Automattic/remote-data-blocks

All issues in Automattic/remote-data-blocks

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.