Problem with apsw and garbage collection

Nikolaus Rath Nikolaus at
Thu Jun 11 22:28:05 EDT 2009


Please consider this example:

-------------- next part --------------
A non-text attachment was scrubbed...
Type: text/x-python
Size: 1006 bytes
Desc: not available
URL: <>
-------------- next part --------------

While the first execute("VACUUM") call succeeds, the second does not but
raises an apsw.BusyError (meaning that sqlite thinks that it cannot get
an exclusive lock on the database).

I suspect that the reason for that is that the cursor object that is
created in the function is not destroyed when the function is left with
raise (rather than return), which in turn prevents sqlite from obtaining
the lock.

However, if I exchange the VACUUM command by something else (e.g. CREATE
TABLE), the program runs fine. I think this casts some doubt on the
above explanation, since, AFAIK sqlite always locks the entire file and
should therefore have the some problem as before.

Can someone explain what exactly is happening here?



 ?Time flies like an arrow, fruit flies like a Banana.?

  PGP fingerprint: 5B93 61F8 4EA2 E279 ABF6  02CF A9AD B7F8 AE4E 425C

More information about the Python-list mailing list