HarperFast / HarperFast/harper

Race condition: create_table returns success before table is available

Open
#687 1 comment 0 reactions 1 assignee Claimed by @kriszyp View on GitHub
area:storage bug from-jira
Dominant language
JavaScript
Stars
89
Forks
10
Avg merge
2d 6h
Merged PRs (30d)
200

Description

## Problem

`create_table` (via the operations API) returns a success response before the table is fully initialized and available for subsequent operations. Downstream calls made immediately after creation fail as if the table does not exist — even with 2-second sleep guards in tests.

Observed in CI runs (GitHub Actions) across multiple runs.

## Symptoms

- Test calls `create_table` → receives success response
- Test (optionally sleeps 2s) → calls `insert` or queries the table
- Failure: table not found / does not exist

## Likely cause

The ITC-based schema sync path acknowledges the schema event synchronously on receipt and runs the actual schema handler in the background (see commit `59dec882`). This means the API response can be sent before the worker threads have fully propagated the new table schema. If a subsequent operation lands on a worker that hasn't yet processed the background handler, the table appears absent.

## Steps to reproduce

Flaky; occurs under CI load. Integration test: `16_terminologyUpdates.js` L52 in the operations API test suite.

🤖 Filed by Claude on behalf of Kris.

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.