Skip to content

sqlite: backup() never settles when rate is 0 #64892

Description

@trivikr

Version

main

Platform

N/A

Subsystem

sqlite

What steps will reproduce the bug?

import { backup, DatabaseSync } from 'node:sqlite';
import { setTimeout } from 'node:timers/promises';

const source = new DatabaseSync(':memory:');
source.exec(`
  CREATE TABLE data (value TEXT);
  INSERT INTO data VALUES ('example');
`);

const outcome = await Promise.race([
  backup(source, 'backup.db', { rate: 0 }),
  setTimeout(1_000, 'backup still pending after 1 second'),
]);

console.log(outcome);
process.exit();

How often does it reproduce? Is there a required condition?

Always

What is the expected behavior? Why is that the expected behavior?

zero should be rejected as an invalid rate, or explicitly treated as a documented single-call mode.

What do you see instead?

backup still pending after 1 second

backup() accepts rate: 0 and its promise remains pending indefinitely while zero-page jobs are repeatedly scheduled.

Additional information

No response

Metadata

Metadata

Assignees

Labels

sqliteIssues and PRs related to the SQLite subsystem.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions