Subject Re: [firebird-support] What can cause "Transaction start failed. deadlock" in Firebird 2.0.3?
Author Antti Nivala
Hi Vlad,

> Is this threads share the same connection or its have own connections
?

We are not using the same connection from two threads simultaneously,
but for performance reasons, we are caching (pooling) connections.
Another thread may pick the connection at a later time and start a new
transaction.

Whenever a thread needs to do something with the database, it performs
the following steps:

1. Gets an existing connection from the pool (and removes it from the
pool).

2. Starts a new transaction.

3. Executes the query.

4. Commits the transaction.

5. Puts the connection back to the pool.

> Could you post database header statitstics here ?

I do not have access to that database at the moment. Here are the
statistics from another database (a new database just created by our
application). The settings in the real database are the same (e.g. sweep
interval is zero). Page buffers and transaction numbers etc. of course
would be different.

Database header page information:
Flags 0
Checksum 12345
Generation 153
Page size 4096
ODS version 11.0
Oldest transaction 128
Oldest active 129
Oldest snapshot 129
Next transaction 130
Bumped transaction 1
Sequence number 0
Next attachment ID 22
Implementation ID 16
Shadow count 0
Page buffers 1606
Next header page 0
Database dialect 3
Creation date Aug 28, 2008 19:34:31
Attributes force write

Variable header data:
Sweep interval: 0
*END*

> Any chance automatic sweep was running at time this error's raised ?

We are not using automatic sweep. We back up and restore the database
once a week.

> Does isc_start_transaction set tra_handle into not NULL value ?

I don't know. We are accessing Firebird via IBProvider (an OLE DB
provider for Firebird) so we are not invoking Firebird API functions
ourselves.

Best regards,
Antti