[Mapguide-trac] [mapguide-trac] #2165: MgFeatureService::UpdateFeatures does not roll back transaction on exceptions when useTransaction = true

MapGuide Open Source trac_mapguide at osgeo.org
Wed Oct 31 20:56:18 PDT 2012


#2165: MgFeatureService::UpdateFeatures does not roll back transaction on
exceptions when useTransaction = true
-------------------------------+--------------------------------------------
   Reporter:  jng              |       Owner:       
       Type:  defect           |      Status:  new  
   Priority:  high             |   Milestone:       
  Component:  Feature Service  |     Version:  2.4.0
   Severity:  blocker          |    Keywords:       
External_id:                   |  
-------------------------------+--------------------------------------------
 If you do a call to MgFeatureService::UpdateFeatures with useTransaction =
 true, the transaction that gets created is not actually rolled back in the
 event of an exception

 The problem is in this line in
 [http://trac.osgeo.org/mapguide/browser/trunk/MgDev/Server/src/Services/Feature/ServerUpdateFeatures.cpp#L138
 ServerUpdateFeatures.cpp]

 {{{

 MG_FEATURE_SERVICE_CHECK_CONNECTION_CATCH_AND_THROW(resource,
 L"MgServerUpdateFeatures.UpdateFeatures")

 if (transaction != NULL && !commited)
 {
     transaction->Rollback();
 }

 MG_FEATURE_SERVICE_THROW()

 }}}

 We should not be using MG_FEATURE_SERVICE_CHECK_CONNECTION_CATCH_AND_THROW
 as any caught exceptions are immediately rethrown after its exception
 processing has occurred. Because of this, the transaction rollback code
 afterwards is never reached.

 The fix is to replace that macro with
 MG_FEATURE_SERVICE_CHECK_CONNECTION_CATCH, allowing the rollback code to
 be executed. There is already a MG_FEATURE_SERVICE_THROW() macro defined
 after the rollback code, so such caught exceptions will get re-thrown

-- 
Ticket URL: <http://trac.osgeo.org/mapguide/ticket/2165>
MapGuide Open Source <http://mapguide.osgeo.org/>
MapGuide Open Source Internals


More information about the mapguide-trac mailing list