facebook / facebook/relay

Race condition in disposing selection reference in QueryRenderer#_fetch?

Open
#1,850 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

This may just be a misunderstanding on my part, but it seems like, on calling `_fetch`:

1. We call `this._pendingFetch.dispose()`: https://github.com/facebook/relay/blob/v1.0.0/packages/react-relay/modern/ReactRelayQueryRenderer.js#L251
2. This calls `nextReference.dispose()`: https://github.com/facebook/relay/blob/v1.0.0/packages/react-relay/modern/ReactRelayQueryRenderer.js#L266

But in the case where the query is streaming, isn't it possible that `nextReference` and `this._selectionReference` are the same?

In which case couldn't this lead to freeing essentially `this._selectionReference`? In which case is this a problem?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.