“Database is locked” error in NDD Print Host

Failure

The NDD Print Host and NDD Print Releaser services are unavailable due to the “Database is locked” error, which prevents writing to the SQLite database.

Symptoms

  • Temporary communication failures between solution components.

  • Momentary interruption in request processing.

  • Cache synchronization services are unavailable.

  • Frequent need to manually restart the services.

  • Increased frequency of support calls.

Evidence

In the Windows Event Viewer, under Application Logs, you can find logs like the example below:

Failure while executing synchronization - Exception: System.AggregateException:
One or more errors...
-> System.Data.Entity.Infrastructure.CommitFailedException:
An error was reported while committing a database transaction...
-> System.Data.SQLite.SQLiteException:
database is locked

The error occurs during cache synchronization or when confirming database transactions.

Cause

The NDD Print Host and NDD Print Releaser modules use the SQLite database as the default.

SQLite is a single-file database, suitable for simple environments, testing, or small deployments. However, it has a significant concurrency limitation: it allows only one write process at a time.

In enterprise environments with high print volumes, multiple users, and equipment performing simultaneous operations, multiple write operations may occur at the same time. In these situations, the database file is temporarily blocked, causing the error:

System.Data.SQLite.SQLiteException: database is blocked

This limitation is inherent to SQLite and occurs more frequently as the environment’s level of usage increases.

Solution

Migrate the application’s database to Microsoft SQL Server.

SQL Server has a client-server architecture and was created for enterprise environments, offering:

  • Support for high concurrency of accesses.

  • Advanced locking control.

  • Better performance in concurrent operations.

  • Greater scalability.

  • Greater stability in high-volume printing environments.

The SQL Server Express edition meets the needs of most deployments that do not require advanced enterprise features.

Recommendations

New deployments

Use Microsoft SQL Server as the default database from the start.

Existing Environments

Plan to migrate from SQLite to SQL Server when the following occur:

  • Recurring “database is locked” errors.

  • Increased print volume.

  • Growth in the number of users.

  • Expansion in the number of monitored devices.

Technical Comparison

Feature

SQLite

Microsoft SQL Server

General Architecture

Based on a single local file

Corporate Multi-User Dedicated Server

Simultaneous Writing

Only one case at a time

High concurrency with locks at the record or page level

Behavior Under Level

Bottlenecks and the “database is locked” error

Performance Optimization and Automatic Recovery

Future Scalability

Limited for infrastructure expansion

High scalability and support for growth

Last updated: