Bugzilla doesn't roll back transactions on errors when using eval

Gervase Markham gerv at mozilla.org
Wed Aug 28 12:46:00 UTC 2013


On 27/08/13 12:31, Simon Green wrote:
> On 27/08/13 20:08, Gervase Markham wrote:
>> I've just found a long-standing bug in a Bugzilla extension I maintain.
>>
>> The fix was to manually close the transaction when I had a failure, but
>> the need to do this was not at all obvious.

Why do we refuse to roll back the transaction on eval? That's what I
don't get. If we don't want this transaction committed, why can't we
roll it back and then close the transaction? That keeps everything in a
consistent state.

>> This error behaviour seems wrong to me (in that it exposes weird
>> requirements on the user of an API which are not obvious and easy to
>> miss or get wrong), but I'm not entirely sure what the best fix is.
>> Comments?
> 
> brc was also affected by a similar issue not so long ago (wrapping some
> code in an eval that started a transaction, but did not finish). Took
> about four hours to debug it, followed by a lot of cursing.
> 
> Since all code is run by individual *cgi or *pl scripts (and doesn't
> have a global exit point), I'm not sure if there is a fix for the issue
> either (other than not using eval, which is the solution I went for)

Is there any way of getting some code to run always as the last thing
that happens, which can at least print "Warning: script exiting with
uncommitted and unrolled-back transactions"?



Gerv



More information about the developers mailing list