Skip to content
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

Events: TOCTOU Race when subscribing to new events #12111

Open
Stebalien opened this issue Jun 18, 2024 · 1 comment
Open

Events: TOCTOU Race when subscribing to new events #12111

Stebalien opened this issue Jun 18, 2024 · 1 comment

Comments

@Stebalien
Copy link
Member

We:

  1. Lock, get the latest processed height, unlock.
  2. Apply a "pre" filter to query for already processed events.
  3. Lock, install the new filter, unlock.

But blocks can come in between step 2 and step 3. We need to do one of:

  1. Hold the lock the entire time (probably not viable).
  2. Re-try if the height changes between when we release the lock and when we retake it. Or, really, req-query for the new tipsets (taking reverts into account, unfortunately...).
  3. Install the filter first (buffering events instead of emitting them), recording the current height, then prefill up to that height, then start processing the buffered events. Need to be careful here to avoid DoS vectors.
@aarshkshah1992
Copy link
Contributor

#12116 proporsed a solution for this along with a host of other problems with the event indexing/filtering.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants