[Zope] Another Zope E-Commerce Site Online - Transaction Errors

Brad Clements bkc@murkworks.com
Thu, 7 Dec 2000 13:41:36 -0500


On 7 Dec 2000, at 9:41, Diego Rodrigo Neufert wrote:

> Transaction Error too....
> 
> Are you trying to do session management and/or database querys in two
> different frames?


Thanks to everyone who emailed me about transaction errors, here's 
what was happening so you can avoid it too.

First, we're using Interbase on Linux. Apparently there's a bug in the 
Linux Interbase client that causes the client connection to dropped if no 
DB requests are made within .. (5 minutes?)

There's a fix in gvibDA that works around this by generating a dummy 
select before any query() is executed. If an exception is raised in the 
dummy select, the db-api connection is deleted and a new one opened.

This fix seems to work pretty well.

But I'm also using a gvib db-api connection from within Python code 
called through external methods. This second connection is used with 
SQLDict. I've wrapped it up with THUNK Zope code so SQLDict can 
participate in Zope's transaction machinery.

Unfortunately I did not have the Linux-broken-pipe-fix in my SQLDict 
code, so that second connection could fail.

The second connection is only activated when a person selects 
"Checkout". SQLDict registers itself with the transaction manager, then 
creates a cursor and executes an sql request.

This causes an exception to be raised (broken pipe). The Zope 
transaction manager does a rollback, which causes this second 
interbase connection to try to call rollback(), which raises another 
broken pipe exception.

This second exception within the transaction rollback causes a system-
wide failure and Zope disables all further transactions, which then kills 
the entire site.

--

The solution was to add the broken-pipe handling code to the external 
method before making calls into SQLDict.

Unfortunately my first fix was wrong, so it didn't work, but I think I have it 
right now.

This brings up a good issue. How do you work on a live Zope site 
without causing serious problems? Versions only go just so far.

Fortunately, because I'm using SQLSession to hold the shopping cart 
contents, I can restart Zope at any time without killing off active 
shopping carts.

--

Hopefully there will be a fix for this interbase client bug from the firebird 
group soon.



Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements