Forum Discussion

Kumar_107292's avatar
Kumar_107292
Icon for Nimbostratus rankNimbostratus
Jan 22, 2013

Transaction management

Hi

 

 

I have upgraded from iControl v10 to v11. I have successfully implemented session management in my code but having problems when implementing transaction management. I am working in Java.

 

This is my sample code:

 

createLoadBalancer(){

 

try{

 

iCtrlInterface.getSystemSession().start_transaction();

 

createVlan();

 

createRouteDomain();

 

createSelfIps();

 

createSnatIPs();

 

iCtrlInterface.getSystemSession().submit_transaction();

 

}catch(Exception e){

 

iCtrlInterface.getSystemSession().rollback_transaction();

 

}

 

}

 

 

My Question : Now when I am failing my code near createSelfIps(), it goes into the catch block and when executes the rollback it gives following error :

 

AxisFault

 

faultCode: {http://schemas.xmlsoap.org/soap/envelope/}Server

 

faultSubcode:

 

faultString: Exception caught in System::urn:iControl:System/Session::rollback_transaction()

 

Exception: Common::OperationFailed

 

primary_error_code : 16908289 (0x01020001)

 

secondary_error_code : 0

 

error_string : No transaction is open to roll back.

 

 

Pls help me understand the problem and the solution.

 

 

5 Replies

  • I haven't seen that error before. The only thing I can think of is to look at the transaction timeout value and try to bump it up. You can access the value with the get/set_transaction_timeout method.
  •  

    Does I need to specify rollback_transaction() in my catch block or does iControl automatically rollback the transaction if the submit_transaction() failed. If this is the case then I don't need to handle the rollback.

     

    I have one more question: Does I need to call iControl.SystemConfigSyncBindingStub.save_configuration() to save the configuration we just commited or the submit_transaction() does this for us.

     

     

     

    Thanks in advance.

     

  • We recommend issuing a rollback as that will force a flush of all resources associated with the opened transaction. But, it will timeout eventually and clean itself out if you omit it.
  • Sorry, I missed the second question about saving configuration. Yes you do need to manually issue the save_configuration() call. iControl will only effect in-memory objects. We did this because config-save operations are expensive and slow and we wanted to put it in the hands of the users as to when those changes were saved. BTW, this is another form of rollback as you can make iControl changes and then do a config.load to reload the previous config. Granted, that's probably not the best thing to do in a production system, but it is possible.

     

     

    -Joe
  • I ran into this as well. The key here is that some errors are caused at (1) iCtrlInterface.getSystemSession().submit_transaction() time and others (2) are validation errors that are thrown when the call is made. If you run into a (1) submit_transaction error, the transaction is already rollbacked for you and attempting to rollback will give you the error you are seeing. If you run into a (2) validation time error, the transaction is still open and you have an opportunity to submit or roll it back. To work around this confusion, you can wrap these commands in a utility and ignore the "No transaction is open to roll back" messages (iControl did it for you).

     

     

    At least, that's my understanding from the documentation.