Ticket #649 (new defect)

Opened 4 years ago

Last modified 9 months ago

FeatureService.UpdateFeatures doesn't log errors and reports them as succesful

Reported by: zspitzer Owned by:
Priority: high Milestone:
Component: Feature Service Version: 2.2.0
Severity: critical Keywords:
Cc: External ID:

Description

When doing an insert with FeatureService?.UpdateFeatures? it returne if there's a problem, it's returns as string GetPropertyType?(9) or on success as a featureReader GetPropertyType?(12).

When an error occurs, the access.log still logs it as successful rather than failed and the error is not logged to error.log

I triggered it by attempting to insert features into a non existent class

An exception occurred in FDO component. Item 'Rail3' not found in collection
  Exception occurred in method  MgServerUpdateFeatures.UpdateFeatures at line 97 in
 file  d:\buildforgeprojects\mapguide_open_source_v2.0\build_27.13\mgdev\server
\src\services\feature\ServerUpdateFeatures.cpp 

Using Mg 2.0.1 on XP

Attachments

Change History

  Changed 3 years ago by zspitzer

  • severity changed from major to critical
  • summary changed from FeatureService.UpdateFeatures doesn't log errors correctly to FeatureService.UpdateFeatures doesn't log or throw errors

I am bumping this to critical, only because this is a potential dataloss bug

Most code (including samples which many users follow) will assume if an update/insert completes without throwing an error, it was successful, which is not true

  Changed 3 years ago by tomfukushima

Please add step-by-step instructions to recreate the problem; and it seems that a package and sample PHP script would also be required. Thanks, Tom

Changed 3 years ago by zspitzer

  Changed 3 years ago by zspitzer

  • version changed from 2.0.1 to 2.0.2
  • summary changed from FeatureService.UpdateFeatures doesn't log or throw errors to FeatureService.UpdateFeatures doesn't log errors and reports them as succesful

Ok, test case attached, it uses the a feature source from the Sheboygan Samples. It will fail to make any changes, due to the SDF being marked as READ ONLY and the FeatureClass? name is wrong ( should be Rail, is Rail3)

Simply run the script, tweaking the user/pass if required.

Current Behaviour: An error is returned in the result which must be manually inspected and the access.log reports the UpdateFeatures? operation as being Successful.

UpdateFeatures.1.0.0:3(Library://Samples/Sheboygan/Data/Rail.FeatureSource,MgFeatureCommandCollection,false,) Success

Expected Behaviour: An error should be thrown (to be caught), the UpdateFeatures? accesslog entry should be marked as Failure

UpdateFeatures.1.0.0:3(Library://Samples/Sheboygan/Data/Rail.FeatureSource,MgFeatureCommandCollection,false,) Failure

In addition the error message should be logged to error.log

An exception occurred in FDO component. Item 'Rail3' not found in collection
Exception occurred in method MgServerUpdateFeatures.UpdateFeatures at line 97 in 
file d:\buildforgeprojects\mapguide_open_source_v2.0\build_27.13\mgdev\server
\src\services\feature\ServerUpdateFeatures.cpp 

follow-up: ↓ 6   Changed 3 years ago by milicevic

Hello,

i wolud like to report the same behaviour on deleting features. In fact, I don't get it, the code looks and works well, class name is just fine, filter condition also but no errors or exceptions has been thrown.

        string TIMgisUser = System.Configuration.ConfigurationManager.AppSettings["TIMgisUser"];
        MapGuideApi.MgInitializeWebTier(@"C:\program files\MapguideOpenSource2.0\WebServerExtensions\www\webconfig.ini");
        MgUserInformation userInfo = new MgUserInformation("Administrator", "" + System.Configuration.ConfigurationManager.AppSettings["mgP"] + "");
        MgSite site = new MgSite();
        site.Open(userInfo);
        String mgSessionId = site.CreateSession();

        MgUserInformation userInfoNew = new MgUserInformation(mgSessionId);
        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfoNew);

        MgResourceService resourceService = siteConnection.CreateService(MgServiceType.ResourceService) as MgResourceService;
        MgFeatureService featureService = siteConnection.CreateService(MgServiceType.FeatureService) as MgFeatureService;

        MgResourceIdentifier resId = new MgResourceIdentifier("Library://PROJEKTI/ZLZ/PODACI/DIONICE.FeatureSource");
        MgFeatureCommandCollection commands = new MgFeatureCommandCollection();

        string layerClassName = "DIONICE";
        
        MgDeleteFeatures deleteCmd = new MgDeleteFeatures(layerClassName , "(FeatId=1)");
        commands.Add(deleteCmd);

        featureService.UpdateFeatures(resId, commands, false);

  Changed 3 years ago by zspitzer

  • priority changed from medium to high

in reply to: ↑ 4   Changed 3 years ago by milicevic

Replying to milicevic:

Hello, i wolud like to report the same behaviour on deleting features. In fact, I don't get it, the code looks and works well, class name is just fine, filter condition also but no errors or exceptions has been thrown. {{{ string TIMgisUser = System.Configuration.ConfigurationManager?.AppSettings?TIMgisUser?; MapGuideApi?.MgInitializeWebTier?(@"C:\program files\MapguideOpenSource?2.0\WebServerExtensions?\www\webconfig.ini"); MgUserInformation? userInfo = new MgUserInformation?("Administrator", "" + System.Configuration.ConfigurationManager?.AppSettings?mgP? + ""); MgSite? site = new MgSite?(); site.Open(userInfo); String mgSessionId = site.CreateSession?(); MgUserInformation? userInfoNew = new MgUserInformation?(mgSessionId); MgSiteConnection? siteConnection = new MgSiteConnection?(); siteConnection.Open(userInfoNew); MgResourceService? resourceService = siteConnection.CreateService?(MgServiceType?.ResourceService?) as MgResourceService?; MgFeatureService? featureService = siteConnection.CreateService?(MgServiceType?.FeatureService?) as MgFeatureService?; MgResourceIdentifier? resId = new MgResourceIdentifier?(" Library://PROJEKTI/ZLZ/PODACI/DIONICE.FeatureSource"); MgFeatureCommandCollection? commands = new MgFeatureCommandCollection?(); string layerClassName = "DIONICE"; MgDeleteFeatures? deleteCmd = new MgDeleteFeatures?(layerClassName , "(FeatId?=1)"); commands.Add(deleteCmd); featureService.UpdateFeatures?(resId, commands, false); }}}

Hello,

I wolud like fill up my report. Thanks to Zac i have solved my problem. The reason was read only feature source.

  Changed 2 years ago by zspitzer

  • version changed from 2.0.2 to 2.1.0
  • milestone set to 2.1

  Changed 9 months ago by zspitzer

  • version changed from 2.1.0 to 2.2.0
Note: See TracTickets for help on using tickets.