Concurrent orphan scans can share scratch tables and report valid objects as orphans

Open
#1,537 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

@hsusul is already working on this.

Since Oct 17, 2026.

  • #1538 by @hsusul — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
20/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
aws, postgresql, typescript
Domain
backend, database

Research direction

Read the scanner and cleanup paths that derive scratch table names from Date.now(), then inspect the linked regression test for concurrent scans of different buckets. Confirm both paths avoid collisions when timestamps match and that the test no longer reports another bucket’s valid S3 object as an orphan.

Written by the indexing model from the issue text.

Description

Problem

Concurrent object scans that start within the same millisecond can reuse the same PostgreSQL scratch-table name. Their S3 keys are then mixed, and one scan can report a valid object from another bucket as an orphan. The cleanup path uses the same timestamp-only naming pattern.

Reproduction

A deterministic regression test fixes Date.now() to the same value for two concurrent scans of different buckets. On upstream, one scan includes the other bucket’s valid S3 object in its orphan results.

Root cause

Both scanner paths derive unlogged scratch-table names from Date.now() alone. The table is shared by database clients, so simultaneous scans collide.

Dominant language
TypeScript
Stars
1.4k
Forks
319
Avg merge
1d 14h
Merged PRs (30d)
106

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 supabase/storage

All issues in supabase/storage

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.