Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6388819
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T03:19:37+00:00 2026-05-25T03:19:37+00:00

Context I’m using sqlite version 3.7.7.1 in a Windows C++ program, I’m creating a

  • 0

Context

I’m using sqlite version 3.7.7.1 in a Windows C++ program, I’m creating a DB that has only one connection with SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE | SQLITE_OPEN_NOMUTEX.

I’m using SQLite because I need very fast ACID transaction. The Database is store on a NTFS solid state drive on Windows XP sp3.

This DataBase has 3 tables and each transaction implies the 3 tables and the biggest transaction inserts 12 rows in one of the table, insert 1 row in another and update the third table.

My application has a 400ms cycle and the database is used for a burst of 9 transactions that occurs at the beginning of each cycle. Knowing that my average transaction takes 15ms (with really rare peak at 60ms (about 1 of 60k transactions where time is lost in the Windows FlushFileBuffers function )), the DataBase is just used in the first 150ms of the 400ms cycle.

After benchmarking, the WAL journal offers the best performances for my application.

But, I have a problem with WAL journal : the xxx-wal file is growing and growing non stop (after 500k transaction, the wal file was 8GB!). Activating the auto_checkpoint doesn’t help.

When trying to manually do the checkpoint by calling sqlite3_wal_checkpoint_v2 with SQLITE_CHECKPOINT_RESTART option, sqlite3 kept returning SQLITE_LOCKED.

I discover that when I create a table using sqlite3_exec, the connection becomes lock forever. What’s the explanation ? Is there a way to avoid that ?

So closing the connection and reopening it, I retry to call sqlite3_wal_checkpoint_v2, but this time, it returned SQLITE_BUSY. Even if I call sqlite3_busy_timeout with 1 second, it still returns SQLITE_BUSY.

Questions

What cause a db to be busy, knowing that only one connection is used on the db, that this connection is used by several threads but are serialized via a mutex on my application side ?

More Info:

  • I’m using several prepared statements that I keep through the cycles (even one for the TRANSACTION BEGIN and TRANSACTION COMMIT)
  • The DB seems to be busy after the first transaction is commited.

I’m having a hard time to understand the locking and busy scheme of sqlite despite my reading on the sqlite web site. Does anyone have some good links on that ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T03:19:37+00:00Added an answer on May 25, 2026 at 3:19 am

    I found the cause to my problem and it was something 2 stupid things on my side :

    Querying the page size with a “PRAGMA page_size”, I was just reading the row and not resetting or finalizing the statement with “sqlite3_reset” or sqlite3_finalize (it was kind of hidden by the C++ wrapper I test with).

    This was causing the database to be locked. Then, I was not finalizing this query before closing the database and this was causing the database to return busy after reopening it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Context: I notice that the major databases support only the Gregorian calendar. Thus, it
Context: Suppose one has the following class structure: public static class SomeStaticClass { public
Context: I am building an Add-in using visual studio 2010. One of the actions
Context: I work at a small software company that has traditionally done research-type work,
Context: I have a WPF App that uses certain unmanaged DLLs in the D:\WordAutomation\MyApp_Source\Executables\MyApp
Context: I need to develop a monitoring server that monitors some of our applications
Context: HTML widgets generated using a Django ModelForm and template, jQuery 1.3.2, JavaScript on
Context I'm building a persistence layer to abstract different types of databases that I'll
CONTEXT: I am preparing a big C# merge using visual studio 2008 and TFS.
Context: From my javascript web UI, I launch a long-running (several minutes) operation that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.