TransactionTimeout with Oracle 11g
Using Oracle Database 11g. I have a service that is labeled:
[ServiceBehavior (InstanceContextMode = InstanceContextMode.PerCall, TransactionTimeout = "00:00:10")]
The method itself looks like this:
[OperationBehavior(TransactionScopeRequired = true)]
[TransactionFlow(TransactionFlowOption.NotAllowed)]
public OrderMessage AddOrder(OrderMessage orderMessage)
{
ValidateMessage(orderMessage);
return this.orderBusiness.Add(orderMessage);
}
If I put a breakpoint in the orderBusiness.Add method and wait 10 seconds, the transaction will expire. If I hit a breakpoint, but then lock the table participating in the transaction, it waits for much more than 10 seconds, at least until the service times out after 60 seconds. Any ideas on how to get the transaction to timeout at a given interval if the table is locked?
a source to share
Here's what I had to do in this case. I found that my transactional crash was unaffected because I was waiting for a lock for my transaction. I didn't know that because distributed_lock_timeout was set to 60 seconds in my database and the service had been shut down before that. Since I couldn't change the distrib_lock_timeout, I increased the timeout for the service and then started:
InnerException: Oracle.DataAccess.Client.OracleException
Message="ORA-02049: timeout: distributed transaction waiting for lock"
This way, the transaction runtime worked when I had a breakpoint because it cares about how long the transaction actually takes to complete. This had no effect when the table was locked because it did not start executing. I have to use try catch to make sure the resource is not blocked before starting transactional work.
a source to share