On 18 Mar 2013, at 11:47pm, Alykhan Jetha <[email protected]> wrote:

> I have 2 processes (process A and process B) opening a connection to the a 
> database.

Just to be sure, you mean that the two processes are totally independent, right 
?our processes open one connection to the database /each/ ?

You are talking about two process of one application, not two threads, and not 
two applications ?

>  After process B is done its work, we call checkpoint(restart), process A 
> seems to lose its file handles (unknown IO error).

All file handles, or just ones used to access SQLite ?

> If we don't use a checkpoint or use checkpoint(passive), the database 
> eventually gets corrupt (malformed image) when using process A.

Once again, just being sure, you're talking about these, right ?

<http://www.sqlite.org/c3ref/wal_checkpoint_v2.html>

> We are using version 3.7.15.2 built into both apps.
> The problem is exhibited on Mac OS X 10.6 and 10.7 (haven't tried this case 
> on 10.8).
> 
> The database is opened in both processes in WAL mode and with Normal sync. 
> Everything else is stock.
> 
> I have the feeling I'm missing something or have it misconfigured.  

Doesn't ring any bells.  With what you've reported already, I'm suspecting some 
sort of memory mismanagement unrelated to SQLite.  Not casting aspersions: I've 
done it myself.

Make sure you're checking the result codes returned by /all/ your SQLite calls, 
including ones which don't appear to be related to this problem.  You should 
always deal with all results other than SQLITE_OK.

Use Activity Monitor.  Have it 'inspect' the processes.  Use it to look at Open 
Files and Ports both before and after process B finishes.  Make sure it agrees 
with what you wrote above.  If it's losing all file handles then it should be 
losing the handles for dynamic libraries and fonts.

Simon.
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to