Re: [pysqlite] Erratic behavior under high loads, with APSW code sample
Roger Binns <[email protected]> Mon, 30 Jun 2008 15:12:56 -0700
| Newsgroups | gmane.comp.python.db.pysqlite.user |
|---|---|
| Message-ID | <[email protected]> |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 For the record, APSW does not change SQLite's transaction behaviour in any way. It also does not attempt to parse and guess what your code is doing. This behaviour is not DBAPI compliant which is why pysqlite has to do all those things :-) Frank McIngvale wrote: > Hi, I'm having a strange problem with APSW & pysqlite that shows up > under higher loads. Your problem is strange because you made the mistake of silently ignoring all exceptions :-) > try: > cur = conn.cursor() > > # record writer > qs = 'insert into writers (pid,thread,nr) values (?,?,?)' > cur.execute(qs, (os.getpid(), currentThread().getName(), nr)) > > nr -= 1 > except: > pass If you remove the silent swallowing of all exceptions you'll find that SQLite is returning busy errors. If you add: conn.setbusytimeout(10000) # 10 seconds Then you will find there are no exceptions and you get all 90 rows. As to why you see this on Linux, it is because of greater concurrency. Roger -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.6 (GNU/Linux) iD8DBQFIaVpomOOfHg372QQRAtJsAKDK88gATAQLxpORfubfW60+68vPpwCgnLU4 lvOyaRKJebqA2oAHeatqbYw= =t+Ek -----END PGP SIGNATURE-----