SQLite Forum

DATA RACE: Found in sqlite3.c
Login
Dear SQLite developers:

I used my fuzz-testing tool, connzer, to detect data race in SQLite. Here is a data race found by connzer. I wish you can help me check whether it is a real race, thanks!!

The following is the race report.

## Race report ##

Race object: `pInfo->nBackfill`

**Thread 1:**

**Access:** `pInfo->nBackfill==pWal->hdr.mxFrame`

**Line number:** `sqlite3.c, 61048`

**Call stack:**

1. `walTryBeginRead()`
2. `sqlite3WalBeginReadTransaction()`
3. `pagerBeginReadTransaction()`
4. `sqlite3PagerSharedLock()`
5. `lockBtree()`
6. `sqlite3BtreeBeginTrans()`
7. `sqlite3VdbeExec()`
8. `sqlite3Step()`
9. `sqlite3_step()`
10. `execsql_i64_x()`
11. `walthread3_thread()`
12. `launch_thread_main()`

**Lock:**

* None

**Thread 2:**

**Access:** `pInfo->nBackfill = 0;`

**Line number:** `sqlite3.c, 60269`

**Call stack:**

1. `walRestartHdr()`
2. `walRestartLog()`
3. `sqlite3WalFrames()`
4. `pagerWalFrames()`
5. `sqlite3PagerCommitPhaseOne()`
6. `sqlite3BtreeCommitPhaseOne()`
7. `vdbeCommit()`
8. `sqlite3VdbeHalt()`
9. `sqlite3VdbeExec()`
10. `sqlite3_step->sqlite3Step()`
11. `execsql_i64_x()`
12. `walthread3_thread()`
13. `launch_thread_main()`

**Lock:**
  
* None

My fuzzer finds that these 2 accesses can be executed concurrently, and they are not protected by any lock, so my fuzzer report this race.