20
Oct

Timeout for wait transactions in FirebirdClient

I have implemented new feature available from FB2.0, it’s timeout for wait transaction. It’s a nice feature, ’cause you can specify how long do you wanna wait before getting deadlock error. Thanks also to Dmitry Yemanov for debug (that also revealed couple of new bugs; now already fixed).

The current implementation is pretty straightforward. If you don’t specify timeout then it’s not used (which is important for <FB2.0). Else (and you’re using wait transactions) is used. :) With this I redesigned a little bit the options for transactions. Now it’s more flexible and open for future improvements. Defining options for transaction is little bit different:

conn.BeginTransaction(new FbTransactionOptions() { TransactionBehavior = FbTransactionBehavior.Wait, WaitTimeout = 3 }))

Of course, you can create options object separately and put to method only variable. Changing old code to new one is just couple of rewriting, no new logic.

Enjoy!

There's 10 Comments So Far

  • Bounz
    November 7th, 2008 at 15:36

    Hello again!I’m expecting troubles with updating data model from database. Using this feature lead VS to hang. And then I have to end task. I don’t know where is the problem: Firebird server, client dll or Visual Studio. I’m using VS2008, test build of Firebird server (link on which you have posted some time earlier), and latest client dll from nightly builds.Any ideas?

  • cincura.net
    November 7th, 2008 at 19:01

    Me too. It’s IMO server related. In 2.1 this isn’t happening.

  • Bounz
    November 8th, 2008 at 07:27

    So, if I right understand you, FB 2.1 doesn’t hang up VS, but it has `left outer join` problem. And test build of FB 2.5, which works right with `left outer join` hangs up VS on updates?

  • cincura.net
    November 8th, 2008 at 12:04

    Yep.

  • aleksey
    January 25th, 2010 at 14:22

    WaitTimeout – in seconds ?

  • cincura.net
    January 25th, 2010 at 14:27

    Yes.

  • aleksey
    January 25th, 2010 at 15:09

    thanks.

    why is it might not working?

    Exception:
    deadlock
    update conflicts with concurrent update

    i’m writing in 2 thread into 1 field

  • cincura.net
    January 25th, 2010 at 15:12

    Looks like you have NO WAIT transaction. I recommend you to continue in .NET provider list http://www.firebirdsql.org/index.php?op=lists .

Who Linked To This Post?

  1. Firebird News » Timeout for wait transactions in FirebirdClient
  2. cincura.net

Share your thoughts, leave a comment!