Opened 12 years ago
Closed 12 years ago
#2165 closed defect (fixed)
MgFeatureService::UpdateFeatures does not roll back transaction on exceptions when useTransaction = true
Reported by: | jng | Owned by: | |
---|---|---|---|
Priority: | high | Milestone: | |
Component: | Feature Service | Version: | 2.4.0 |
Severity: | blocker | Keywords: | |
Cc: | External ID: |
Description
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 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
Fixed trunk (r7180) and 2.4 (r7181)